Skip to main content

Module is_simple

Module is_simple 

Source
Expand description

is_simple(&g) -> bool — OGC Simple Feature predicate.

Mirrors boost::geometry::is_simple(g) from boost/geometry/algorithms/is_simple.hpp. The v1 linestring implementation is brute-force O(n²); a sweepline-based variant lands once phase_03’s overlay infrastructure is in place.

A linestring is simple iff no two non-adjacent segments intersect, adjacent segments touch only at their shared vertex (no zero-length edge, no collinear doubling-back), and it has no repeated non-consecutive vertex. A closed linestring / ring is allowed to share exactly its first and last vertex — that is the ring closure, not a self-intersection.

An areal geometry (polygon) is simple iff every ring is non-empty and free of consecutive duplicate vertices — nothing more. This mirrors Boost exactly (algorithms/detail/is_simple/areal.hpp): “a Polygon is always a simple geometric object provided that it is valid”. Self-intersections, ring touches, and ring crossings are validity concerns — see geometry_overlay::validity::is_valid_polygon.

Functions§

is_simple
true iff g satisfies the OGC “is simple” predicate.