Skip to content

Commit e17e01d

Browse files
committed
Remove call to set_face_normal in translation and rotation
Fixes #889
1 parent 3530f00 commit e17e01d

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

books/RayTracingTheNextWeek.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,7 +3017,6 @@
30173017

30183018
// Move the intersection point forwards by the offset
30193019
rec.p += offset;
3020-
rec.set_face_normal(offset_r, rec.normal);
30213020

30223021
return true;
30233022
}
@@ -3050,7 +3049,6 @@
30503049

30513050
// Move the intersection point forwards by the offset
30523051
rec.p += offset;
3053-
rec.set_face_normal(offset_r, rec.normal);
30543052

30553053
return true;
30563054
}
@@ -3225,7 +3223,7 @@
32253223
normal[2] = -sin_theta*rec.normal[0] + cos_theta*rec.normal[2];
32263224

32273225
rec.p = p;
3228-
rec.set_face_normal(rotated_r, normal);
3226+
rec.normal = normal;
32293227

32303228
return true;
32313229
}

src/TheNextWeek/hittable.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class translate : public hittable {
6464

6565
// Move the intersection point forwards by the offset
6666
rec.p += offset;
67-
rec.set_face_normal(offset_r, rec.normal);
6867

6968
return true;
7069
}
@@ -140,7 +139,7 @@ class rotate_y : public hittable {
140139
normal[2] = -sin_theta*rec.normal[0] + cos_theta*rec.normal[2];
141140

142141
rec.p = p;
143-
rec.set_face_normal(rotated_r, normal);
142+
rec.normal = normal;
144143

145144
return true;
146145
}

src/TheRestOfYourLife/hittable.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class translate : public hittable {
7272

7373
// Move the intersection point forwards by the offset
7474
rec.p += offset;
75-
rec.set_face_normal(offset_r, rec.normal);
7675

7776
return true;
7877
}
@@ -148,7 +147,7 @@ class rotate_y : public hittable {
148147
normal[2] = -sin_theta*rec.normal[0] + cos_theta*rec.normal[2];
149148

150149
rec.p = p;
151-
rec.set_face_normal(rotated_r, normal);
150+
rec.normal = normal;
152151

153152
return true;
154153
}

0 commit comments

Comments
 (0)