Skip to content

Commit 5bd2487

Browse files
committed
Incorporate review feedback
1 parent 4d24032 commit 5bd2487

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

books/RayTracingTheNextWeek.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,10 +2304,12 @@
23042304
![Figure [quad-def]: Quadrilateral Components](../images/fig-2.05-quad-def.jpg)
23052305

23062306
<div class='together'>
2307-
Quads are flat, which means that their axis-aligned bounding box can have zero thickness in one
2308-
dimension (if the quad lies in one of the XY, YZ, or ZX planes). This can lead to numerical problems
2309-
with ray intersection, but we can address this by padding any zero-sized dimensions of the bounding
2310-
box. To this end, we add a new `aabb::pad()` method that remedies this situation:
2307+
Quads are flat, so their axis-aligned bounding box will have zero thickness in one dimension if the
2308+
quad lies in the XY, YZ, or ZX plane. This can lead to numerical problems with ray intersection, but
2309+
we can address this by padding any zero-sized dimensions of the bounding box. Padding is fine
2310+
because we aren't changing the intersection of the quad; we're only expanding its bounding box to
2311+
remove the possibility of numerical problems, and the bounds are just a rough approximation to the
2312+
actual shape anyway. To this end, we add a new `aabb::pad()` method that remedies this situation:
23112313

23122314
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
23132315
...
@@ -2364,7 +2366,7 @@
23642366
return false; // To be implemented
23652367
}
23662368

2367-
protected:
2369+
private:
23682370
point3 Q;
23692371
vec3 u, v;
23702372
shared_ptr<material> mat;
@@ -2481,7 +2483,7 @@
24812483
}
24822484
...
24832485

2484-
protected:
2486+
private:
24852487
point3 Q;
24862488
vec3 u, v;
24872489
shared_ptr<material> mat;
@@ -2527,7 +2529,7 @@
25272529
return true;
25282530
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
25292531
}
2530-
};
2532+
...
25312533
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25322534
[Listing [quad-plane2]: <kbd>[quad.h]</kbd> hit() method for the infinite plane]
25332535

@@ -2653,7 +2655,7 @@
26532655
}
26542656
...
26552657

2656-
protected:
2658+
private:
26572659
point3 Q;
26582660
vec3 u, v;
26592661
shared_ptr<material> mat;

books/RayTracingTheRestOfYourLife.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2643,7 +2643,7 @@
26432643
}
26442644
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
26452645

2646-
protected:
2646+
private:
26472647
point3 Q;
26482648
vec3 u, v;
26492649
shared_ptr<material> mat;

images/fig-2.05-quad-def.jpg

2.57 KB
Loading

src/TheNextWeek/quad.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include "hittable.h"
1515
#include "hittable_list.h"
1616

17-
#include <cmath>
18-
1917
class quad : public hittable {
2018
public:
2119
quad(const point3& _Q, const vec3& _u, const vec3& _v, shared_ptr<material> m)
@@ -77,7 +75,7 @@ class quad : public hittable {
7775
return true;
7876
}
7977

80-
protected:
78+
private:
8179
point3 Q;
8280
vec3 u, v;
8381
shared_ptr<material> mat;

src/TheRestOfYourLife/quad.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include "hittable.h"
1515
#include "hittable_list.h"
1616

17-
#include <cmath>
18-
1917
class quad : public hittable {
2018
public:
2119
quad(const point3& _Q, const vec3& _u, const vec3& _v, shared_ptr<material> m)
@@ -95,7 +93,7 @@ class quad : public hittable {
9593
return p - origin;
9694
}
9795

98-
protected:
96+
private:
9997
point3 Q;
10098
vec3 u, v;
10199
shared_ptr<material> mat;

0 commit comments

Comments
 (0)