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 the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

strategy::distance::haversine

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

Synopsis

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

Template parameter(s)

Parameter

Default

Description

typename Point1

point type

typename Point2

Point1

second point type

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(calculation_type const & radius = 1.0)

Constructor.

calculation_type const &: radius: radius of the sphere, defaults to 1.0 for the unit sphere

Member Function(s)

Function

Description

Parameters

Returns

calculation_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)

calculation_type radius()

access to radius value

the radius

Header

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

See also

distance (with strategy)


PrevUpHomeNext