Skip to main content

Module length

Module length 

Source
Expand description

Strategy for summing the length of a sequence of points.

Mirrors three pieces of Boost.Geometry that collaborate to make boost::geometry::length(g) and boost::geometry::perimeter(g) work for any linestring / ring / polygon in any coordinate system:

  • boost/geometry/strategies/length/services.hpp — the services::default_strategy<G> metafunction that picks the per-CS length strategy.
  • boost/geometry/strategies/length/cartesian.hppstrategies::length::cartesian<> plus its services::default_strategy<Geometry, cartesian_tag> specialisation; the Cartesian implementation hands a strategy::distance::pythagoras<> to the algorithm.
  • boost/geometry/algorithms/length.hpp:80-107detail::length::range_length walks the iterator pair and sums the per-segment distances; this file performs the same walk in Rust against the Linestring / Ring traits.

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

Structs§

CartesianLength
Cartesian length: sum of Pythagorean distances between consecutive points (linestring case).
CartesianPerimeter
Cartesian perimeter: sum of Pythagorean distances between consecutive points of a ring, plus the closing edge when the ring is open.

Traits§

DefaultLength
“Which length strategy do we pick by default for this CS family?”
DefaultPerimeter
“Which perimeter strategy do we pick by default for this CS family?”
LengthStrategy
A strategy for computing the length of a sequence of points.

Type Aliases§

DefaultLengthStrategy
Type alias resolving the default length strategy for geometry G by walking G -> G::Point -> Cs -> Family -> DefaultLength::Strategy.
DefaultPerimeterStrategy
Default perimeter strategy for the coordinate-system family of G.