Skip to content

Commit 313f07a

Browse files
committed
Update book for image 1.14 fix
Resolves #559
1 parent 5041eb5 commit 313f07a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Change Log -- Ray Tracing in One Weekend
3333
- Fix: Listing 30: Add missing `camera.h` include
3434
- Fix: Listing 42: Don't need to include `ray.h` when using `rtweekend.h`
3535
- Fix: Listing 48: Add missing `material.h` include
36+
- Fix: Listing 51: `refract()` function was missing `fabs()` on `sqrt()` argument (#559
3637
- Fix: Listing 61: Include updated `cam` declaration, show context w/highlighting
3738
- Fix: Listing 62: Highlight rename of `camera::get_ray()` parameters to s, t (#616)
3839
- Fix: Listing 63: Show reverted scene declarations

books/RayTracingInOneWeekend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@
23992399
vec3 refract(const vec3& uv, const vec3& n, double etai_over_etat) {
24002400
auto cos_theta = dot(-uv, n);
24012401
vec3 r_out_parallel = etai_over_etat * (uv + cos_theta*n);
2402-
vec3 r_out_perp = -sqrt(1.0 - r_out_parallel.length_squared()) * n;
2402+
vec3 r_out_perp = -sqrt(fabs(1.0 - r_out_parallel.length_squared())) * n;
24032403
return r_out_parallel + r_out_perp;
24042404
}
24052405
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)