computational-geometry geometry
Definition
Orientation Predicate
Let , , and be points in the plane. The orientation predicate is
Its sign tells how lies relative to the directed line :
Intuition
Intuition
The predicate measures the turn from the vector to the vector .
- A positive value means an anticlockwise turn.
- A negative value means a clockwise turn.
- A zero value means no turn, so the three points lie on one line.
The absolute value is twice the area of the triangle :
Why the Formula Works
Move to the origin. This does not change whether is left or right of . The shifted points are
The points and span a parallelogram from the origin. Its signed area is the determinant
The sign records the order of the two shifted points:
- positive if turns anticlockwise to ,
- negative if turns clockwise to ,
- zero if the parallelogram collapses to a line.
Substituting
gives
Coordinate Convention
The left/right interpretation assumes the usual Cartesian plane, where the -axis points upward. In screen coordinates, where the -axis often points downward, the sign interpretation is reversed.
Examples
Left of a horizontal directed line
Let , , and . Then
Hence lies left of .
Right of a horizontal directed line
Let , , and . Then
Hence lies right of .
Collinear points
Let , , and . Then
Hence , , and are collinear.