Module orientation

Source
Expand description

Certified orientation predicates.

orient2d answers “does C lie left of, right of, or exactly on the directed line AB”. The answer is a sign, and a sign drives topology, so a plausible answer is not good enough: this module returns Certified and escalates to exact arithmetic rather than guessing when the filter is inconclusive.

The strategy is the standard filtered cascade:

  1. Evaluate the determinant in plain f64 and compute a forward error bound.
  2. If the magnitude exceeds the bound, the sign is proven; return it.
  3. Otherwise recompute exactly with error-free transformations.

Step 1 succeeds for almost all real inputs, so the exact path is rare.

Functions§

orient2d
Orientation of c relative to the directed line a -> b.
orient2d_filter
The fast filter alone, exposed so the escalation can be observed and tested.