Boost.Geometry    Boost C++ Libraries
Classes | Functions
distance: calculate distance between two geometries

Classes

struct  boost::geometry::comparable_distance_result< Geometry1, Geometry2, Strategy >
 Meta-function defining return type of comparable_distance function. More...
struct  boost::geometry::concept::PointDistanceStrategy< Strategy, Point1, Point2 >
 Checks strategy for point-point or point-box or box-box distance. More...
struct  boost::geometry::default_comparable_distance_result< Geometry1, Geometry2 >
 Meta-function defining return type of comparable_distance function. More...
struct  boost::geometry::default_distance_result< Geometry1, Geometry2 >
 Meta-function defining return type of distance function. More...
struct  boost::geometry::distance_result< Geometry1, Geometry2, Strategy >
 Meta-function defining return type of distance function. More...
struct  boost::geometry::strategy::distance::services::default_strategy< GeometryTag1, GeometryTag2, Point1, Point2, CsTag1, CsTag2, UnderlyingStrategy >
 Traits class binding a default strategy for distance to one (or possibly two) coordinate system(s) More...

Functions

template<typename Geometry1 , typename Geometry2 , typename Strategy >
comparable_distance_result
< Geometry1, Geometry2,
Strategy >::type 
boost::geometry::comparable_distance (Geometry1 const &geometry1, Geometry2 const &geometry2, Strategy const &strategy)
 Calculate the comparable distance measurement of two geometries using the specified strategy.
template<typename Geometry1 , typename Geometry2 >
default_comparable_distance_result
< Geometry1, Geometry2 >::type 
boost::geometry::comparable_distance (Geometry1 const &geometry1, Geometry2 const &geometry2)
 Calculate the comparable distance measurement of two geometries.
template<typename Geometry1 , typename Geometry2 , typename Strategy >
distance_result< Geometry1,
Geometry2, Strategy >::type 
boost::geometry::distance (Geometry1 const &geometry1, Geometry2 const &geometry2, Strategy const &strategy)
 Calculate the distance of two geometries using the specified strategy.
template<typename Geometry1 , typename Geometry2 >
default_distance_result
< Geometry1, Geometry2 >::type 
boost::geometry::distance (Geometry1 const &geometry1, Geometry2 const &geometry2)
 Calculate the distance of two geometries.

Function Documentation

template<typename Geometry1 , typename Geometry2 , typename Strategy >
comparable_distance_result<Geometry1, Geometry2, Strategy>::type boost::geometry::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.

Template Parameters:
Geometry1first geometry type
Geometry2second geometry type
StrategyAny type fulfilling a Distance Strategy Concept
Parameters:
geometry1A model of the specified concept
geometry2A model of the specified concept
strategyThe strategy which will be used for distance calculations
Returns:
The calculated \1
template<typename Geometry1 , typename Geometry2 >
default_comparable_distance_result<Geometry1, Geometry2>::type boost::geometry::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.

Template Parameters:
Geometry1first geometry type
Geometry2second geometry type
Parameters:
geometry1A model of the specified concept
geometry2A model of the specified concept
Returns:
The calculated \1
template<typename Geometry1 , typename Geometry2 , typename Strategy >
distance_result<Geometry1, Geometry2, Strategy>::type boost::geometry::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.

Template Parameters:
Geometry1Any type fulfilling a Geometry Concept
Geometry2Any type fulfilling a Geometry Concept
StrategyAny type fulfilling a Distance Strategy Concept
Parameters:
geometry1A model of the specified concept
geometry2A model of the specified concept
strategyThe strategy which will be used for distance calculations
Returns:
The calculated \1
Note:
The strategy can be a point-point strategy. In case of distance point-line/point-polygon it may also be a point-segment strategy.
Examples:
01_point_example.cpp, 02_linestring_example.cpp, 07_a_graph_route_example.cpp, 07_b_graph_route_example.cpp, c01_custom_point_example.cpp, and x03_a_soci_example.cpp.
template<typename Geometry1 , typename Geometry2 >
default_distance_result<Geometry1, Geometry2>::type boost::geometry::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

Template Parameters:
Geometry1Any type fulfilling a Geometry Concept
Geometry2Any type fulfilling a Geometry Concept
Parameters:
geometry1A model of the specified concept
geometry2A model of the specified concept
Returns:
The calculated \1

April 2, 2011

Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands
Copyright © 2008-2011 Bruno Lalande, Paris, France
Copyright © 2009-2010 Mateusz Loskot, London, UK
Documentation is generated by Doxygen