Solution

ID: past-exam-of-the-computer-science-course-of-the-university-of-oxford/2015/computer-graphics/3/c/solution

Let the oriented vertices be , in an order such that points out of the front face. The given nondegeneracy guarantees . A ray with nonzero direction approaches the front face only if
Reject . This combines back-face culling with rejection of parallel rays, including the coplanar case for this ordinary surface-hit test. The ray-plane intersection parameter is
Reject ; for rays launched from existing surfaces use a positive lower cutoff to avoid counting the launch surface. Form .
Finally determine whether lies inside the triangle. For , , , compute
These solve . The barycentric coordinates are , so the complete acceptance criterion is
The inequalities include the edges and vertices. A renderer sharing edges between triangles should use a consistent numerical edge convention; small floating-point arithmetic errors near a shared boundary should not create cracks. Normalizing is unnecessary for this intersection calculation because its scale cancels.

New to topics? Read the docs here!