Orientation records directional order: geometric points or triangle vertices may run clockwise or counterclockwise. In 2D, a cross product supplies both a signed area and this directional test. section 9.3.3
Orientation becomes useful when an algorithm needs consistent geometric direction:
- Test whether a point lies inside a consistently ordered triangle by checking that it stays on the same side of every directed edge. section 9.3.3
- Replace larger area calculations with cross-product comparisons; omit the common division by two when only relative areas matter. section 9.3.3
- Use an initial orientation as a tangent direction for a moving object, allowing a spline to start smoothly even from a stationary point. section 7.2.2
Point-in-triangle test
For a clockwise-oriented triangle, an interior point lies to the right of all three directed sides. Compute each 2D cross-product sign and require all three tests to agree; a failed test places the point outside. section 9.3.3
Figure 9.17 If points of the triangle are clockwise-oriented, the point that lies inside the triangle must lie on the right side of all the triangle’s side vectors. If this check fails for any of the side vectors—in the figure on the right, that’s for the (x3 - x2, x3 - y2) side—the point is lying outside.
The figure makes the same-side rule visual by showing how one failed edge test identifies a point outside the triangle. section 9.3.3
