Skip to content

[Book 1][10.3] Code snippet has a stray bracket #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
patrick-han opened this issue Oct 15, 2020 · 1 comment
Closed

[Book 1][10.3] Code snippet has a stray bracket #768

patrick-han opened this issue Oct 15, 2020 · 1 comment
Assignees
Milestone

Comments

@patrick-han
Copy link

patrick-han commented Oct 15, 2020

In listing 56, the if statement in the highlighted green "new" code has a stray bracket

double cos_theta = fmin(dot(-unit_direction, rec.normal), 1.0);
double sin_theta = sqrt(1.0 - cos_theta*cos_theta);

bool cannot_refract = refraction_ratio * sin_theta > 1.0;
vec3 direction;

if (cannot_refract) { // Right here
    direction = reflect(unit_direction, rec.normal);
else
    direction = refract(unit_direction, rec.normal, refraction_ratio);

scattered = ray(rec.p, direction);
@hollasch hollasch added this to the v3.2.2 milestone Oct 24, 2020
@hollasch hollasch self-assigned this Oct 24, 2020
hollasch added a commit that referenced this issue Oct 25, 2020
Caption: Dielectric material class with reflection

Resolves #768
@hollasch
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants