GGL    Boost C++ Libraries

ggl::cartesian_distance< T > Struct Template Reference
[distance: calculate distance between two geometries]

Encapsulate the results of distance calculation. More...

List of all members.

Public Member Functions

 cartesian_distance (T const &v)
 Constructor with a value.
 operator cast_type () const
bool operator< (cartesian_distance< T > const &other) const
bool operator== (cartesian_distance< T > const &other) const
bool operator> (cartesian_distance< T > const &other) const
squared_value () const
 The "squared_value" method returns the internal squared value.
bool very_small () const

Friends

template<typename Char , typename Traits >
std::basic_ostream< Char,
Traits > & 
operator<< (std::basic_ostream< Char, Traits > &os, cartesian_distance< T > const &d)
 Make streamable to enable std::cout << ggl::distance( ).


Detailed Description

template<typename T = double>
struct ggl::cartesian_distance< T >

Encapsulate the results of distance calculation.

Distance calculation for xy points or xyz points is done by taking the square root. However, for distance comparison drawing the square root is not necessary. Therefore the distance strategies are allowed to return the squares of the distance. This structure contains the distance, and a boolean to indicate if it is squared. It has an automatic conversion to a double value, which does the square root if necessary.

Note:
Thanks to Phil Endecott for his suggestion to change the pair to the double-convertable http://article.gmane.org/gmane.comp.lib.boost.devel/172709/match=greatcircle_distance

Definition at line 41 of file distance_result.hpp.


Constructor & Destructor Documentation

template<typename T = double>
ggl::cartesian_distance< T >::cartesian_distance ( T const &  v  )  [explicit]

Constructor with a value.

Definition at line 63 of file distance_result.hpp.


Member Function Documentation

template<typename T = double>
ggl::cartesian_distance< T >::operator cast_type (  )  const

Automatic conversion to double or higher precision, taking squareroot if necessary

Definition at line 67 of file distance_result.hpp.

template<typename T = double>
bool ggl::cartesian_distance< T >::operator< ( cartesian_distance< T > const &  other  )  const

Definition at line 85 of file distance_result.hpp.

template<typename T = double>
bool ggl::cartesian_distance< T >::operator> ( cartesian_distance< T > const &  other  )  const

Definition at line 89 of file distance_result.hpp.

template<typename T = double>
bool ggl::cartesian_distance< T >::operator== ( cartesian_distance< T > const &  other  )  const

Definition at line 93 of file distance_result.hpp.

template<typename T = double>
bool ggl::cartesian_distance< T >::very_small (  )  const

Definition at line 118 of file distance_result.hpp.

template<typename T = double>
T ggl::cartesian_distance< T >::squared_value (  )  const

The "squared_value" method returns the internal squared value.

Definition at line 124 of file distance_result.hpp.


Friends And Related Function Documentation

template<typename T = double>
template<typename Char , typename Traits >
std::basic_ostream<Char, Traits>& operator<< ( std::basic_ostream< Char, Traits > &  os,
cartesian_distance< T > const &  d 
) [friend]

Make streamable to enable std::cout << ggl::distance( ).

Definition at line 132 of file distance_result.hpp.


November 5, 2009

Copyright © 1995-2009 Barend Gehrels, Geodan, Amsterdam
Copyright © 2008-2009 Bruno Lalande, Paris
Copyright © 2009 Mateusz Loskot, Cadcorp, London
Documentation is generated by Doxygen