| Home | Libraries | People | FAQ | More

#### strategy::distance::haversine

Distance calculation for spherical coordinates on a perfect sphere using haversine.

###### Synopsis

    template<typename RadiusTypeOrSphere, typename CalculationType>
    class strategy::distance::haversine
    {
      // ...
    };

###### Template parameter(s)

Parameter | Default | Description
--- | --- | ---
typename RadiusTypeOrSphere | double | numeric type for radius (of sphere, earth) or sphere model
typename CalculationType | void | numeric type for calculation (e.g. high precision); if void then it is extracted automatically from the coordinate type and (if necessary) promoted to floating point

###### Constructor(s)

Function | Description | Parameters
--- | --- | ---
    haversine()
| Default constructor, radius set to 1.0 for the unit sphere. |
    template<typename RadiusOrSphere>
    haversine(RadiusOrSphere const & radius_or_sphere)
| Constructor. | RadiusOrSphere const &: radius_or_sphere: radius of the sphere or sphere model

###### Member Function(s)

Function | Description | Parameters | Returns
--- | --- | --- | ---
    template<typename Point1, typename Point2>
    calculation_type< Point1, Point2 >::type apply(Point1 const & p1, Point2 const & p2)
| applies the distance calculation | Point1 const &: p1: first point Point2 const &: p2: second point | the calculated distance (including multiplying with radius)
    radius_type radius()
| access to radius value |  | the radius

###### Header

`#include <boost/geometry/strategies/spherical/distance_haversine.hpp>`