Skip to content

Comment logic is wrong in Listing 18 #1729

Description

@Rickfdalton

In Listing 18: Remembering the side of the surface

bool front_face;
if (dot(ray_direction, outward_normal) > 0.0) {
    // ray is inside the sphere
    normal = -outward_normal;
    front_face = false;
} else {
    // ray is outside the sphere
    normal = outward_normal;
    front_face = true;
}

The dot product between the outward_normal and the ray_direction being positive implies the point in in the backside of the sphere and negative implies the point in in the frontside of the sphere. But the comment says the ray is inside/outside. This is ambiguous.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions