Ray Triangle Intersection
To perform a ray-triangle intersection test we need:
- A ray with a known point of origin , and direction vector .
- A triangle with three known vertex positions , and .
Ray/triangle intersection using barycentric coordinates
There are several ways of computing ray-triangle intersections. The one described here uses barycentric coordinates to parameterise the triangle using two variables u and v. The point represented by the u and v is defined:
As the parametric ray equation is
we can derive a ray/triangle intersection by inserting this into the parametric triangle equation:
or as described by Möller and Trumbore (1997):