Skip to content

Commit d5525d2

Browse files
committed
Refined algorithm steps for intersections while instancing
1 parent 4732ced commit d5525d2

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

books/RayTracingTheNextWeek.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,13 +3159,13 @@
31593159
The pseudocode for the `translate::hit` function above describes the function in terms of _moving_:
31603160

31613161
1. Move the ray backwards by the offset
3162-
2. Determine where (if any) an intersection occurs along the offset ray
3163-
3. Move the intersection point forwards by
3162+
2. Determine whether an intersection exists along the offset ray (and if so, where)
3163+
3. Move the intersection point forwards by the offset
31643164

31653165
But this can also be thought of in terms of a _changing of coordinates_:
31663166

31673167
1. Change the ray from world space to object space
3168-
2. Determine where (if any) an intersection occurs in object space
3168+
2. Determine whether an intersection exists in object space (and if so, where)
31693169
3. Change the intersection point from object space to world space
31703170

31713171

src/TheNextWeek/hittable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class translate : public hittable {
5858
// Move the ray backwards by the offset
5959
ray offset_r(r.origin() - offset, r.direction(), r.time());
6060

61-
// Determine where (if any) an intersection occurs along the offset ray
61+
// Determine whether an intersection exists along the offset ray (and if so, where)
6262
if (!object->hit(offset_r, ray_t, rec))
6363
return false;
6464

@@ -124,7 +124,7 @@ class rotate_y : public hittable {
124124

125125
ray rotated_r(origin, direction, r.time());
126126

127-
// Determine where (if any) an intersection occurs in object space
127+
// Determine whether an intersection exists in object space (and if so, where)
128128
if (!object->hit(rotated_r, ray_t, rec))
129129
return false;
130130

src/TheRestOfYourLife/hittable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class translate : public hittable {
6666
// Move the ray backwards by the offset
6767
ray offset_r(r.origin() - offset, r.direction(), r.time());
6868

69-
// Determine where (if any) an intersection occurs along the offset ray
69+
// Determine whether an intersection exists along the offset ray (and if so, where)
7070
if (!object->hit(offset_r, ray_t, rec))
7171
return false;
7272

@@ -132,7 +132,7 @@ class rotate_y : public hittable {
132132

133133
ray rotated_r(origin, direction, r.time());
134134

135-
// Determine where (if any) an intersection occurs in object space
135+
// Determine whether an intersection exists in object space (and if so, where)
136136
if (!object->hit(rotated_r, ray_t, rec))
137137
return false;
138138

0 commit comments

Comments
 (0)