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— theservices::default_strategy<G>metafunction that picks the per-CS envelope strategy.boost/geometry/strategies/envelope/cartesian.hpp—strategies::envelope::cartesian<>, whose per-tag dispatch selectsenvelope::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-66—envelope_range_of_boxesandenvelope_range_of_points, which walk a point sequence and grow aBoxby component-wisemin/max. The Rust port collapses the C++ template recursiondimension_one/dimension_twoofalgorithms/detail/envelope/initialize.hppinto theseed_from_point/grow_from_pointhelpers below, written againstfold_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§
- Envelope
Box - Cartesian envelope of a
geometry_trait::Box. SeeEnvelopePoint. - Envelope
Linestring - Cartesian envelope of a
geometry_trait::Linestring. SeeEnvelopePoint. - Envelope
Multi Linestring - Cartesian envelope of a
geometry_trait::MultiLinestring. SeeEnvelopePoint. - Envelope
Multi Point - Cartesian envelope of a
geometry_trait::MultiPoint. SeeEnvelopePoint. - Envelope
Multi Polygon - Cartesian envelope of a
geometry_trait::MultiPolygon. SeeEnvelopePoint. - Envelope
Point - Cartesian envelope, per geometry kind: component-wise min / max across every coordinate of every point in the geometry.
- Envelope
Polygon - Cartesian envelope of a
geometry_trait::Polygon. SeeEnvelopePoint. - Envelope
Ring - Cartesian envelope of a
geometry_trait::Ring. SeeEnvelopePoint. - Envelope
Segment - Cartesian envelope of a
geometry_trait::Segment. SeeEnvelopePoint.
Traits§
- Envelope
Strategy - 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
outper-dimension byp—mininto the min corner,maxinto the max corner. - seed_
from_ point - Initialise
outso both its corners equalp.