Skip to main content

Module correct

Module correct 

Source
Expand description

correct(&mut g) — fix ring closure and orientation in place.

Mirrors boost::geometry::correct from boost/geometry/algorithms/correct.hpp and the closure-fix helper at algorithms/correct_closure.hpp.

Per-kind:

  • Ring<P, CW, true> → push closing vertex if missing
  • Ring<P, CW, false> → pop closing vertex if duplicated
  • exterior ring → reverse so its strategy-level signed area (which already folds the declared PointOrder) is positive — i.e. the stored order matches the declaration, for CW- and CCW-declared rings alike
  • Polygon outer → as above; inners → opposite of outer
  • MultiPolygon → correct each member

Empty and 1-point rings are left unchanged (silent no-op, matching Boost). Cartesian-only: the orientation test uses the Cartesian shoelace area.

Functions§

correct
Fix closure and orientation of g in place.
correct_closure
Fix only ring closure, leaving orientation unchanged.