Skip to main content

Module equals

Module equals 

Source
Expand description

Per-CS strategy for the equals set-relation algorithm.

Compares two geometries for equality up to vertex sequence: a ring may start at a different vertex and run in either direction and still compare equal, but the two rings must have the same distinct vertices. This is a v1 simplification of boost::geometry::equals (boost/geometry/algorithms/equals.hpp), whose areal arm is fully topological (point-set + area via collect_vectors, so a ring with a redundant collinear vertex still equals the same ring without it).

Consequence: two polygons that describe the same region but differ in how many collinear vertices they list compare not equal here. Run remove_spikes / unique first to normalise vertices if full topological equality is needed. The full topological comparison is deferred; see algorithms/detail/equals/implementation.hpp:36-160.

§Symmetry

equals is symmetric: equals(a, b) == equals(b, a). Only the three diagonal (same-kind) pairs are implemented, and the algorithm layer does not need a reversed direction, so no Reversed wrapper is required here.

§Tag dispatch (open to foreign types)

Each diagonal pair is a distinct per-pair strategy struct (EqPointPoint, EqSegmentSegment, EqPolygonPolygon) with a single concept-pair-bounded EqualsStrategy impl; the tag-keyed [EqualsPairStrategy] picker routes (A::Kind, B::Kind) to the right struct. Because it keys on the tags, a concept-adapted foreign type resolves through the same path as the equivalent geometry-model value.

Structs§

EqPointPoint
Cartesian equals for a pair of points. See the module docs.
EqPolygonPolygon
Cartesian equals for a pair of polygons. See the module docs.
EqSegmentSegment
Cartesian equals for a pair of segments. See the module docs.

Traits§

EqualsStrategy
A strategy for “do these two geometries describe the same point set?”.