Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2022. The current version is 1.89.0.
Calculate the distance between two geometries using the specified strategy.
The free function distance calculates the distance between two geometries 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.
template<typename Geometry1, typename Geometry2, typename Strategy> auto distance(Geometry1 const & geometry1, Geometry2 const & geometry2, Strategy const & strategy)
|
Type |
Concept |
Name |
Description |
|---|---|---|---|
|
Geometry1 const & |
Any type fulfilling a Geometry Concept |
geometry1 |
A model of the specified concept |
|
Geometry2 const & |
Any type fulfilling a Geometry Concept |
geometry2 |
A model of the specified concept |
|
Strategy const & |
Any type fulfilling a Distance Strategy Concept |
strategy |
The strategy which will be used for distance calculations |
The calculated distance
Either
#include <boost/geometry.hpp>
Or
#include <boost/geometry/algorithms/distance.hpp>