Skip to content

Commit 0eb5aec

Browse files
committed
Synchronized the text in book and src with fmin in refract
1 parent 6ae7f82 commit 0eb5aec

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
@@ -4,6 +4,7 @@ Change Log -- Ray Tracing in One Weekend
44
# v3.2.2 (in progress)
55

66
### Common
7+
- Fix: Addded `fmin` to book text for `cos_theta` of `refract`
78

89
### In One Weekend
910

books/RayTracingInOneWeekend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2380,7 +2380,7 @@
23802380

23812381
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
23822382
vec3 refract(const vec3& uv, const vec3& n, double etai_over_etat) {
2383-
auto cos_theta = dot(-uv, n);
2383+
auto cos_theta = fmin(dot(-uv, n), 1.0);
23842384
vec3 r_out_perp = etai_over_etat * (uv + cos_theta*n);
23852385
vec3 r_out_parallel = -sqrt(fabs(1.0 - r_out_perp.length_squared())) * n;
23862386
return r_out_perp + r_out_parallel;

0 commit comments

Comments
 (0)