Skip to main content

Module intersects

Module intersects 

Source
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§

CartesianIntersects
The Cartesian intersection facade — Boost’s default for the Cartesian coordinate system.
IxLinestringLinestring
Linestring × Linestring. See the module docs.
IxLinestringPolygon
Linestring × Polygon. See the module docs.
IxLinestringSegment
Linestring × Segment. See the module docs.
IxPointPoint
Point × Point. See the module docs.
IxPointPolygon
Point × Polygon. See the module docs.
IxPointSegment
Point × Segment. See the module docs.
IxPolygonLinestring
Polygon × Linestring (reverse of IxLinestringPolygon). See the module docs.
IxPolygonPoint
Polygon × Point (reverse of IxPointPolygon). See the module docs.
IxPolygonPolygon
Polygon × Polygon. See the module docs.
IxSegmentLinestring
Segment × Linestring (reverse of IxLinestringSegment). See the module docs.
IxSegmentPoint
Segment × Point (reverse of IxPointSegment). See the module docs.
IxSegmentSegment
Segment × Segment. See the module docs.
Reversed
Lift a strategy for (A, B) into the same strategy concept for (B, A).

Traits§

IntersectsStrategy
A strategy for “do these two geometries share at least one point?”.