Boost.Geometry    Boost C++ Libraries
Functions
boost::geometry::math Namespace Reference

Functions

template<typename T >
abs (T const &value)
 Short utility to workaround gcc/clang problem that abs is converting to integer and that older versions of MSVC does not support abs of long long... More...
 
template<typename DegreeOrRadian , typename T >
as_radian (T const &value)
 
template<typename T >
d2r ()
 
template<typename T1 , typename T2 >
bool equals (T1 const &a, T2 const &b)
 returns true if both arguments are equal. More...
 
template<typename T1 , typename T2 >
bool equals_with_epsilon (T1 const &a, T2 const &b)
 
template<typename DegreeOrRadian , typename T >
from_radian (T const &value)
 
template<typename T >
half_pi ()
 
template<typename T >
hav (T const &theta)
 Calculates the haversine of an angle. More...
 
template<typename T1 , typename T2 >
bool larger (T1 const &a, T2 const &b)
 
template<typename T1 , typename T2 >
bool larger_or_equals (T1 const &a, T2 const &b)
 
template<typename Units , typename CoordinateType >
CoordinateType longitude_distance_signed (CoordinateType const &longitude1, CoordinateType const &longitude2)
 Short utility to calculate difference between two longitudes normalized in range (-180, 180]. More...
 
template<typename Units , typename CoordinateType >
CoordinateType longitude_distance_unsigned (CoordinateType const &longitude1, CoordinateType const &longitude2)
 Short utility to calculate difference between two longitudes normalized in range [0, 360). More...
 
template<typename T >
detail::modulo< T >::return_type mod (T const &value1, T const &value2)
 Short utility to return the modulo of two values. More...
 
template<typename Units , typename CoordinateType >
void normalize_longitude (CoordinateType &longitude)
 Short utility to normalize the longitude on a spheroid. Note that in general both coordinates should be normalized at once. This utility is suitable e.g. for normalization of the difference of longitudes. More...
 
template<typename Units , typename CoordinateType >
void normalize_spheroidal_box_coordinates (CoordinateType &longitude1, CoordinateType &latitude1, CoordinateType &longitude2, CoordinateType &latitude2)
 Short utility to normalize the coordinates of a box on a spheroid. More...
 
template<typename Units , typename CoordinateType >
void normalize_spheroidal_box_coordinates (CoordinateType &longitude1, CoordinateType &latitude1, CoordinateType &longitude2, CoordinateType &latitude2, bool band)
 Short utility to normalize the coordinates of a box on a spheroid. More...
 
template<typename Units , typename CoordinateType >
void normalize_spheroidal_coordinates (CoordinateType &longitude, CoordinateType &latitude)
 Short utility to normalize the coordinates on a spheroid. More...
 
template<typename T >
pi ()
 
template<typename T >
r2d ()
 
template<typename T >
relaxed_epsilon (T const &factor)
 
template<typename Result , typename T >
Result rounding_cast (T const &v)
 Short utility to cast a value possibly rounding it to the nearest integral value. More...
 
template<typename T >
scaled_epsilon (T const &value)
 
template<typename T >
int sign (T const &value)
 Short utility to calculate the sign of a number: -1 (negative), 0 (zero), 1 (positive) More...
 
template<typename T1 , typename T2 >
bool smaller (T1 const &a, T2 const &b)
 
template<typename T1 , typename T2 >
bool smaller_or_equals (T1 const &a, T2 const &b)
 
template<typename T >
sqr (T const &value)
 Short utility to return the square. More...
 
template<typename T >
detail::square_root< T >
::return_type 
sqrt (T const &value)
 Short utility to return the square root. More...
 
template<typename T >
two_pi ()
 

Function Documentation

template<typename T >
T boost::geometry::math::pi ( )
template<typename T >
T boost::geometry::math::two_pi ( )
template<typename T >
T boost::geometry::math::half_pi ( )
template<typename T >
T boost::geometry::math::relaxed_epsilon ( T const &  factor)
template<typename T >
T boost::geometry::math::scaled_epsilon ( T const &  value)
template<typename T1 , typename T2 >
bool boost::geometry::math::equals ( T1 const &  a,
T2 const &  b 
)

returns true if both arguments are equal.

Parameters
afirst argument
bsecond argument
Returns
true if a == b
Note
If both a and b are of an integral type, comparison is done by ==. If one of the types is floating point, comparison is done by abs and comparing with epsilon. If one of the types is non-fundamental, it might be a high-precision number and comparison is done using the == operator of that class.
template<typename T1 , typename T2 >
bool boost::geometry::math::equals_with_epsilon ( T1 const &  a,
T2 const &  b 
)
template<typename T1 , typename T2 >
bool boost::geometry::math::smaller ( T1 const &  a,
T2 const &  b 
)
template<typename T1 , typename T2 >
bool boost::geometry::math::larger ( T1 const &  a,
T2 const &  b 
)
template<typename T1 , typename T2 >
bool boost::geometry::math::smaller_or_equals ( T1 const &  a,
T2 const &  b 
)
template<typename T1 , typename T2 >
bool boost::geometry::math::larger_or_equals ( T1 const &  a,
T2 const &  b 
)
template<typename T >
T boost::geometry::math::d2r ( )
template<typename T >
T boost::geometry::math::r2d ( )
template<typename DegreeOrRadian , typename T >
T boost::geometry::math::as_radian ( T const &  value)
template<typename DegreeOrRadian , typename T >
T boost::geometry::math::from_radian ( T const &  value)
template<typename T >
T boost::geometry::math::hav ( T const &  theta)

Calculates the haversine of an angle.

Note
See http://en.wikipedia.org/wiki/Haversine_formula haversin(alpha) = sin2(alpha/2)
template<typename T >
T boost::geometry::math::sqr ( T const &  value)

Short utility to return the square.

Parameters
valueValue to calculate the square from
Returns
The squared value
template<typename T >
detail::square_root<T>::return_type boost::geometry::math::sqrt ( T const &  value)

Short utility to return the square root.

Parameters
valueValue to calculate the square root from
Returns
The square root value
template<typename T >
detail::modulo<T>::return_type boost::geometry::math::mod ( T const &  value1,
T const &  value2 
)

Short utility to return the modulo of two values.

Parameters
value1First value
value2Second value
Returns
The result of the modulo operation on the (ordered) pair (value1, value2)
template<typename T >
T boost::geometry::math::abs ( T const &  value)

Short utility to workaround gcc/clang problem that abs is converting to integer and that older versions of MSVC does not support abs of long long...

template<typename T >
int boost::geometry::math::sign ( T const &  value)

Short utility to calculate the sign of a number: -1 (negative), 0 (zero), 1 (positive)

template<typename Result , typename T >
Result boost::geometry::math::rounding_cast ( T const &  v)

Short utility to cast a value possibly rounding it to the nearest integral value.

Note
If the source T is NOT an integral type and Result is an integral type the value is rounded towards the closest integral value. Otherwise it's casted without rounding.
template<typename Units , typename CoordinateType >
void boost::geometry::math::normalize_spheroidal_box_coordinates ( CoordinateType &  longitude1,
CoordinateType &  latitude1,
CoordinateType &  longitude2,
CoordinateType &  latitude2 
)

Short utility to normalize the coordinates of a box on a spheroid.

Template Parameters
UnitsThe units of the coordindate system in the spheroid
CoordinateTypeThe type of the coordinates
Parameters
longitude1Minimum longitude of the box
latitude1Minimum latitude of the box
longitude2Maximum longitude of the box
latitude2Maximum latitude of the box
template<typename Units , typename CoordinateType >
void boost::geometry::math::normalize_spheroidal_box_coordinates ( CoordinateType &  longitude1,
CoordinateType &  latitude1,
CoordinateType &  longitude2,
CoordinateType &  latitude2,
bool  band 
)

Short utility to normalize the coordinates of a box on a spheroid.

Template Parameters
UnitsThe units of the coordindate system in the spheroid
CoordinateTypeThe type of the coordinates
Parameters
longitude1Minimum longitude of the box
latitude1Minimum latitude of the box
longitude2Maximum longitude of the box
latitude2Maximum latitude of the box
bandIndicates whether the box should be treated as a band or not and avoid the computation done in the other version of the function
template<typename Units , typename CoordinateType >
void boost::geometry::math::normalize_spheroidal_coordinates ( CoordinateType &  longitude,
CoordinateType &  latitude 
)

Short utility to normalize the coordinates on a spheroid.

Template Parameters
UnitsThe units of the coordindate system in the spheroid
CoordinateTypeThe type of the coordinates
Parameters
longitudeLongitude
latitudeLatitude
template<typename Units , typename CoordinateType >
void boost::geometry::math::normalize_longitude ( CoordinateType &  longitude)

Short utility to normalize the longitude on a spheroid. Note that in general both coordinates should be normalized at once. This utility is suitable e.g. for normalization of the difference of longitudes.

Template Parameters
UnitsThe units of the coordindate system in the spheroid
CoordinateTypeThe type of the coordinates
Parameters
longitudeLongitude
template<typename Units , typename CoordinateType >
CoordinateType boost::geometry::math::longitude_distance_signed ( CoordinateType const &  longitude1,
CoordinateType const &  longitude2 
)

Short utility to calculate difference between two longitudes normalized in range (-180, 180].

Template Parameters
UnitsThe units of the coordindate system in the spheroid
CoordinateTypeThe type of the coordinates
Parameters
longitude1Longitude 1
longitude2Longitude 2
template<typename Units , typename CoordinateType >
CoordinateType boost::geometry::math::longitude_distance_unsigned ( CoordinateType const &  longitude1,
CoordinateType const &  longitude2 
)

Short utility to calculate difference between two longitudes normalized in range [0, 360).

Template Parameters
UnitsThe units of the coordindate system in the spheroid
CoordinateTypeThe type of the coordinates
Parameters
longitude1Longitude 1
longitude2Longitude 2

April 2, 2011

Copyright © 2007-2011 Barend Gehrels, Amsterdam, the Netherlands
Copyright © 2008-2011 Bruno Lalande, Paris, France
Copyright © 2009-2010 Mateusz Loskot, London, UK
Documentation is generated by Doxygen