Skip to main content

Module envelope

Module envelope 

Source
Expand description

Per-CS strategy for the axis-aligned bounding box (envelope).

Mirrors three pieces of Boost.Geometry that collaborate to make boost::geometry::envelope(g, mbr) work for any geometry in any coordinate system:

  • boost/geometry/strategies/envelope/services.hpp — the services::default_strategy<G> metafunction that picks the per-CS envelope strategy.
  • boost/geometry/strategies/envelope/cartesian.hppstrategies::envelope::cartesian<>, whose per-tag dispatch selects envelope::cartesian_point / cartesian_box / cartesian_segment / expand::point / expand::box_ and so on. The Cartesian case for non-trivial geometries is a plain per-coordinate min/max walk — no great-circle bookkeeping, unlike the spherical / geographic strategies.
  • boost/geometry/algorithms/detail/envelope/range.hpp:33-66envelope_range_of_boxes and envelope_range_of_points, which walk a point sequence and grow a Box by component-wise min / max. The Rust port collapses the C++ template recursion dimension_one / dimension_two of algorithms/detail/envelope/initialize.hpp into the seed_from_point / grow_from_point helpers below, written against fold_dims.

§Coherence note

Boost dispatches on the geometry’s tag via partial template specialisation — dispatch::envelope<G, point_tag> and dispatch::envelope<G, linestring_tag> are mutually exclusive because the C++ side can ask the compiler to prove tags are distinct. Rust’s trait system cannot prove that a downstream type does not implement both geometry_trait::Point and (say) geometry_trait::Linestring simultaneously, so two open blankets on one strategy struct would collide (E0119). The port reproduces Boost’s tag dispatch instead: one per-kind strategy struct (EnvelopePoint, EnvelopeLinestring, …) carries a single concept-bounded EnvelopeStrategy impl — distinct Self, so no overlap — and the tag-keyed [EnvelopeStrategyForKind] picker routes G::Kind to the right struct (disjoint on the tag). Because the picker keys on the tag geometry_trait::Geometry::Kind already carries, any concept-adapted foreign type resolves through the same path as the equivalent geometry-model value.

T35 lands the Cartesian implementation only — Boost’s Spherical/Geographic envelope strategies arrive alongside the Haversine / Andoyer / Vincenty distance strategies in later tasks (T40+).

Structs§

EnvelopeBox
Cartesian envelope of a geometry_trait::Box. See EnvelopePoint.
EnvelopeLinestring
Cartesian envelope of a geometry_trait::Linestring. See EnvelopePoint.
EnvelopeMultiLinestring
Cartesian envelope of a geometry_trait::MultiLinestring. See EnvelopePoint.
EnvelopeMultiPoint
Cartesian envelope of a geometry_trait::MultiPoint. See EnvelopePoint.
EnvelopeMultiPolygon
Cartesian envelope of a geometry_trait::MultiPolygon. See EnvelopePoint.
EnvelopePoint
Cartesian envelope, per geometry kind: component-wise min / max across every coordinate of every point in the geometry.
EnvelopePolygon
Cartesian envelope of a geometry_trait::Polygon. See EnvelopePoint.
EnvelopeRing
Cartesian envelope of a geometry_trait::Ring. See EnvelopePoint.
EnvelopeSegment
Cartesian envelope of a geometry_trait::Segment. See EnvelopePoint.

Traits§

EnvelopeStrategy
A strategy for computing the axis-aligned bounding box of a geometry.

Functions§

envelope_of_points
Walk an iterator of points seeding the box from the first and growing by the rest.
grow_from_point
Widen out per-dimension by pmin into the min corner, max into the max corner.
seed_from_point
Initialise out so both its corners equal p.