Skip to content

Commit e46df59

Browse files
committed
Correct book 3 listing 20, geom type + unit vec
`on_light` is a point, not a vector. The code also used obsolete vec3 method function `make_unit_vector`. Resolves #606
1 parent 8ce483f commit e46df59

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Change Log -- Ray Tracing in One Weekend
66
### _The Rest of Your Life_
77
- Fix: Missing closing parenthesis in listing 10 (#603)
88
- Fix: Tiny improvements to the lambertian::scatter() development (#604)
9+
- Fix: Correct geometry type and unit vector method in `ray_color()`, listing 20 (#606)
910

1011

1112
----------------------------------------------------------------------------------------------------

books/RayTracingTheRestOfYourLife.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,10 +1391,10 @@
13911391
return emitted;
13921392

13931393
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
1394-
auto on_light = vec3(random_double(213,343), 554, random_double(227,332));
1394+
auto on_light = point3(random_double(213,343), 554, random_double(227,332));
13951395
auto to_light = on_light - rec.p;
13961396
auto distance_squared = to_light.length_squared();
1397-
to_light.make_unit_vector();
1397+
to_light = unit_vector(to_light);
13981398

13991399
if (dot(to_light, rec.normal) < 0)
14001400
return emitted;

0 commit comments

Comments
 (0)