distance

# distance: calculate distance between two geometries

boost::geometry::comparable_distance_result
boost::geometry::concept::PointDistanceStrategy
boost::geometry::default_comparable_distance_result
boost::geometry::default_distance_result
boost::geometry::distance_result
boost::geometry::strategy::distance::services::default_strategy
typename Geometry1
typename Geometry2
typename Strategy
comparable_distance_result< Geometry1, Geometry2, Strategy >::type comparable_distance_result<Geometry1, Geometry2, Strategy>::type boost::geometry::comparable_distance (Geometry1 const &geometry1, Geometry2 const &geometry2, Strategy const &strategy) comparable_distance Geometry1 const & geometry1 Geometry2 const & geometry2 Strategy const & strategy

Calculate the comparable distance measurement of two geometries using the specified strategy.

The free function comparable_distance does not necessarily calculate the distance, but it calculates a distance measure such that two distances are comparable to each other. For example: for the Cartesian coordinate system, Pythagoras is used but the square root is not taken, which makes it faster and the results of two point pairs can still be compared to each other. Geometry1

first geometry type

Geometry2

second geometry type

Strategy

Any type fulfilling a Distance Strategy Concept

geometry1

A model of the specified concept

geometry2

A model of the specified concept

strategy

The strategy which will be used for distance calculations

The calculated \1

with strategy
typename Geometry1
typename Geometry2
default_comparable_distance_result< Geometry1, Geometry2 >::type default_comparable_distance_result<Geometry1, Geometry2>::type boost::geometry::comparable_distance (Geometry1 const &geometry1, Geometry2 const &geometry2) comparable_distance Geometry1 const & geometry1 Geometry2 const & geometry2

Calculate the comparable distance measurement of two geometries.

The free function comparable_distance does not necessarily calculate the distance, but it calculates a distance measure such that two distances are comparable to each other. For example: for the Cartesian coordinate system, Pythagoras is used but the square root is not taken, which makes it faster and the results of two point pairs can still be compared to each other. Geometry1

first geometry type

Geometry2

second geometry type

geometry1

A model of the specified concept

geometry2

A model of the specified concept

The calculated \1

[include reference/algorithms/comparable_distance.qbk]
typename Geometry1
typename Geometry2
typename Strategy
distance_result< Geometry1, Geometry2, Strategy >::type distance_result<Geometry1, Geometry2, Strategy>::type boost::geometry::distance (Geometry1 const &geometry1, Geometry2 const &geometry2, Strategy const &strategy) distance Geometry1 const & geometry1 Geometry2 const & geometry2 Strategy const & strategy

Calculate the distance of two geometries using the specified strategy.

The free function area calculates the area of a geometry. using the specified strategy. Reasons to specify a strategy include: use another coordinate system for calculations; construct the strategy beforehand (e.g. with the radius of the Earth); select a strategy when there are more than one available for a calculation.

Geometry1

Any type fulfilling a Geometry Concept

Geometry2

Any type fulfilling a Geometry Concept

Strategy

Any type fulfilling a Distance Strategy Concept

geometry1

A model of the specified concept

geometry2

A model of the specified concept

strategy

The strategy which will be used for distance calculations

The calculated \1

The strategy can be a point-point strategy. In case of distance point-line/point-polygon it may also be a point-segment strategy.

with strategy

[heading Available Strategies] \* [link geometry.reference.strategies.strategy_distance_pythagoras Pythagoras (cartesian)] \* [link geometry.reference.strategies.strategy_distance_haversine Haversine (spherical)] \* [link geometry.reference.strategies.strategy_distance_cross_track Cross track (spherical, point-to-segment)] \* [link geometry.reference.strategies.strategy_distance_projected_point Projected point (cartesian, point-to-segment)] \* more (currently extensions): Vincenty, Andoyer (geographic)

typename Geometry1
typename Geometry2
default_distance_result< Geometry1, Geometry2 >::type default_distance_result<Geometry1, Geometry2>::type boost::geometry::distance (Geometry1 const &geometry1, Geometry2 const &geometry2) distance Geometry1 const & geometry1 Geometry2 const & geometry2

Calculate the distance of two geometries.

The default strategy is used, corresponding to the coordinate system of the geometries Geometry1

Any type fulfilling a Geometry Concept

Geometry2

Any type fulfilling a Geometry Concept

geometry1

A model of the specified concept

geometry2

A model of the specified concept

The calculated \1

[include reference/algorithms/distance.qbk]