Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@patrick-han

Description

@patrick-han

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);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions