File tree Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Expand file tree Collapse file tree 2 files changed +2
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments