Expand description
remove_spikes(&mut g) — drop collinear-and-reversed vertices.
Mirrors boost::geometry::remove_spikes from
boost/geometry/algorithms/remove_spikes.hpp. A spike is a triple
(a, b, c) where (b-a) × (c-b) == 0 (collinear) AND
(b-a) · (c-b) < 0 (reversed). The middle vertex b is removed;
the walk repeats until no spike remains, because collapsing one
spike can create a new one at the now-adjacent pair.
Per-kind:
Linestring,Ring→ spike-walk the backingVec<P>Polygon→ walk outer + every inner ringMultiPolygon→ walk each member
Cartesian-only: the collinearity / reversal predicate is the 2D cross/dot product. Spherical / geographic spike detection needs angle-aware predicates; deferred until a downstream caller appears.
Functions§
- remove_
spikes - Remove spikes from
gin place.