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

Click here to view the latest version of this page.
PrevUpHomeNext

strategy::distance::pythagoras

Strategy to calculate the distance between two points.

Synopsis

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

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

Member Function(s)

Function

Description

Parameters

Returns

calculation_type apply(Point1 const & p1, Point2 const & p2)

applies the distance calculation using pythagoras

Point1 const &: p1: first point

Point2 const &: p2: second point

the calculated distance (including taking the square root)

Header

#include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>

Notes
[Note] Note

Can be used for points with two, three or more dimensions

See also

distance (with strategy)


PrevUpHomeNext