Distance calculation for spherical coordinates on a perfect sphere using haversine.
More...
#include <distance_haversine.hpp>
template<typename RadiusType, typename CalculationType = void>
class boost::geometry::strategy::distance::haversine< RadiusType, CalculationType >
Distance calculation for spherical coordinates on a perfect sphere using haversine.
- Template Parameters
-
RadiusType | |
CalculationType | |
- Author
- Adapted from: http://williams.best.vwh.net/avform.htm
- See also
- http://en.wikipedia.org/wiki/Great-circle_distance
- Note
- (from Wiki:) The great circle distance d between two points with coordinates {lat1,lon1} and {lat2,lon2} is given by: d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2)) A mathematically equivalent formula, which is less subject to rounding error for short distances is: d=2*asin(sqrt((sin((lat1-lat2) / 2))^2
- cos(lat1)*cos(lat2)*(sin((lon1-lon2) / 2))^2))
{ [heading See also] [link geometry.reference.algorithms.distance.distance_3_with_strategy distance (with strategy)] }
template<typename RadiusType, typename CalculationType = void>
template<typename RadiusType, typename CalculationType = void>
Constructor.
- Parameters
-
radius | radius of the sphere, defaults to 1.0 for the unit sphere |
template<typename RadiusType, typename CalculationType = void>
template<typename Point1 , typename Point2 >
applies the distance calculation
- Returns
- the calculated distance (including multiplying with radius)
- Parameters
-
p1 | first point |
p2 | second point |
template<typename RadiusType, typename CalculationType = void>
The documentation for this class was generated from the following file: