Ray-triangle intersection determines whether a ray hits a triangle and, when it does, finds the intersection point. The computation supports raytracing, where rays select pixel colors, and 3D collision tasks such as testing points against triangle meshes or gluing bodies together. section 3.8.1
Represent a ray point as R = P + td and a triangle-plane point as S = A + ABu + ACv. A hit occurs when these points are equal: P + td = A + ABu + ACv. In 3D, this vector equation becomes three scalar equations for t, u, and v. section 3.8.2
Filter the plane intersection using the triangle’s barycentric-style coordinates:
- Require t >= 0 so the candidate lies along the ray rather than behind its origin. section 3.8.2
- Require u >= 0, v >= 0, and u + v <= 1 so the candidate lies inside triangle ABC rather than elsewhere on its plane. section 3.8.2
Use the spatial figure to distinguish rays that hit the triangle from rays that miss it. section 3.8.1
Use the triangle’s own coordinate basis to visualize why the inequalities describe exactly its interior and edges. section 3.8.2
