Ray-Triangle and Ray-Quadrilateral Intersections in Homogeneous Coordinates

Recent articles in Ray Tracing News have discussed solutions to the problem of intersecting a ray with a triangle using the triangle’s barycentric coordinates. This article shows yet another way to think about the ray-triangle intersection problem. The idea is to think of the barycentric coordinates of the intersection point, not as the ratio of areas, but rather as the as ratios of the volume of tetrahedra. This technique can also be used to derive formulae for ray-quadrilateral intersection by using the fact that associated with every planar quadrilateral is a unique triangle. Finally, I would like to show the connection between these results and Plucker line coordinates. This insight leads to quite an efficient algorithm. Most people studying computer graphics learn about homogeneous coordinates and projective geometry because they allow perspective transformations to be expressed as linear transformations involving 4x4 matrices. When writing a ray tracer, however, most authors have duplicated Turner Whitted’s original approach where eye rays are directly formed in world space, obviating the need for a explicit viewing transformation. As a result the geometric calculations are usually expressed using familiar vector algebra in a Euclidean coordinate system. However, homogeneous coordinates were not invented to just express projective transformations; they have the advantage that many geometric calculations have elegant solutions when expressed in term of these coordinates. In fact, Felix Klein goes on to say in the same book from which the opening quote is taken.