Expand description
Per-CS strategy for the intersects set-relation algorithm.
Mirrors boost::geometry::intersects(g1, g2) from
boost/geometry/algorithms/intersects.hpp together with the
per-pair dispatch tables it pulls in from
algorithms/detail/intersects/{interface,implementation}.hpp and,
transitively, the Cartesian segment-segment / point-on-segment
kernels in strategy/cartesian/. Two geometries intersects iff
they are not disjoint — Boost’s interface header is literally
intersects(a, b) == !disjoint(a, b)
(algorithms/detail/intersects/interface.hpp:64-78). The Rust port
flips that around: intersects is the primary kernel here and
crate::disjoint is the negation, because every constructive
per-pair test is naturally an “is there a shared point?” question.
§Coherence note
Rust’s trait system cannot prove a downstream type does not implement
several geometry traits at once, so two open blankets on one strategy
struct would collide (E0119). The port reproduces Boost’s per-pair
tag dispatch instead: one per-ordered-pair strategy struct
(IxPointPoint, IxLinestringPolygon, …) carries a single
concept-pair-bounded IntersectsStrategy impl — distinct Self, so
no overlap — and the tag-keyed [IntersectsPairStrategy] 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.
CartesianIntersects remains as a thin
facade that routes through the picker, so disjoint / is_simple and
the Reversed symmetry adapter keep resolving unchanged.
§Symmetry
intersects is symmetric: intersects(a, b) == intersects(b, a).
Each pair appears in exactly one canonical direction here and the
Reversed blanket at the bottom lifts every
IntersectsStrategy<A, B> to an IntersectsStrategy<B, A> for
free — mirroring boost::geometry::reverse_dispatch at
core/reverse_dispatch.hpp.
Structs§
- Cartesian
Intersects - The Cartesian intersection facade — Boost’s default for the Cartesian coordinate system.
- IxLinestring
Linestring - Linestring × Linestring. See the module docs.
- IxLinestring
Polygon - Linestring × Polygon. See the module docs.
- IxLinestring
Segment - Linestring × Segment. See the module docs.
- IxPoint
Point - Point × Point. See the module docs.
- IxPoint
Polygon - Point × Polygon. See the module docs.
- IxPoint
Segment - Point × Segment. See the module docs.
- IxPolygon
Linestring - Polygon × Linestring (reverse of
IxLinestringPolygon). See the module docs. - IxPolygon
Point - Polygon × Point (reverse of
IxPointPolygon). See the module docs. - IxPolygon
Polygon - Polygon × Polygon. See the module docs.
- IxSegment
Linestring - Segment × Linestring (reverse of
IxLinestringSegment). See the module docs. - IxSegment
Point - Segment × Point (reverse of
IxPointSegment). See the module docs. - IxSegment
Segment - Segment × Segment. See the module docs.
- Reversed
- Lift a strategy for
(A, B)into the same strategy concept for(B, A).
Traits§
- Intersects
Strategy - A strategy for “do these two geometries share at least one point?”.