liveBook · Manning

Relative orientation criterion

As explained in Geometry for Programmers

A relative orientation criterion determines a point's position relative to directed triangle sides by testing the signs of their oriented areas or cross products.

The relative orientation criterion tests a point against each directed side of a triangle. A 2D cross product gives a signed area: consistent signs place the point on the same side of all three edges, while a differing sign places it outside. section 9.3.3

To test a point:

  • Form the three edge vectors from the triangle’s ordered vertices. section 9.3.3
  • Compute the signed cross product between each edge and the vector to the point. section 9.3.3
  • Accept the point when all three results have the required consistent sign for the vertex orientation. section 9.3.3

Efficient point-in-triangle test

For clockwise vertices, compare each cross-product expression with zero and require all three to be positive. The implementation uses subtractions and multiplications only; division by two is unnecessary because only relative areas matter. 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.
09-17

The figure shows why an interior point lies on the same side of every directed edge and identifies the failing edge for an exterior point. section 9.3.3

How Geometry for Programmers covers it

How deep it goes
Explains signed cross-product areas, orientation, operation counts, and coordinate-level implementations, but not numerical robustness.
Examples
Uses directed triangle edges, an exterior-point failure case, and Python point-in-triangle predicates.
What it assumes
Assumes triangle vertices and 2D vectors, then derives the test from coordinate differences and signed areas.
What you can do after
Evaluate whether a 2D point lies inside a triangle using three signed cross products.
How it connects
Connects point-in-triangle testing with 2D cross products, signed area, and triangle orientation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.