Skip to content

Maybe use smart constructor for Ray #3

@rrruko

Description

@rrruko

It might be useful to write an interface that ensures that rays always have a unit-length direction.

This would eliminate the need to normalize ray direction in places like intersectTri and generally be more correct since a ray's direction doesn't conceptually have a length at all. On the other hand, this would cause every single ray that is cast to get normalized exactly once, as opposed to a possibly zero indefinite number of times like we have now, which might hurt run time a lot.

Potential problem: what should happen if somebody tries to build a ray with a direction of length 0? Throwing an exception is kind of a lame solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions