Spatial C++ Library
Generic MultiDimensional Containers and Spatial Operations

Defines a metric in the Euclidian space where only the square of the distances are being computed into a scalar value expressed with the DistanceType which is one of C++'s arithmetic types. More...
#include <metric.hpp>
Inherits Diff.
Inherited by spatial::details::Compress< quadrance< Ct, DistanceType, Diff >, typename spatial::container_traits< const Ct >::key_type > [private]
, and spatial::details::Compress< quadrance< Ct, DistanceType, Diff >, typename spatial::container_traits< Ct >::key_type > [private]
.
Public Types  
typedef details::rebind_builtin_difference< Diff, DistanceType >::type  difference_type 
The type used to compute the difference between 2 keys along the same dimension. More...  
typedef DistanceType  distance_type 
Public Member Functions  
quadrance (const difference_type &diff=Diff())  
The constructor allows you to specify a custom difference type. More...  
template<typename AnyDistanceType >  
quadrance (const quadrance< Ct, AnyDistanceType, Diff > &other)  
Copy the metric from another metric with any DistanceType. More...  
distance_type  distance_to_key (dimension_type rank, const key_type &origin, const key_type &key) const 
Compute the distance between the point of origin and the key . More...  
distance_type  distance_to_plane (dimension_type, dimension_type dim, const key_type &origin, const key_type &key) const 
The distance between the point of origin and the closest point to the plane orthogonal to the axis of dimension dim and crossing key . More...  
difference_type  difference () const 
Returns the difference functor used in this type. More...  
Private Types  
typedef enable_if< import::is_arithmetic< DistanceType > >::type  check_concept_distance_type_is_arithmetic 
typedef container_traits< Ct >::key_type  key_type 
The key_type of the container being used for calculations. More...  
Defines a metric in the Euclidian space where only the square of the distances are being computed into a scalar value expressed with the DistanceType which is one of C++'s arithmetic types.
This method of distance calculation is more flexible than spatial::euclidian since it can support all of the C++'s arithmetic types.
When using this metric and reading the distance value, you must remember that you are reading the square of the distance, and not the real distance. Thus, you should use square root to recover the real distance.
This metric has one important drawback: if you are working with large value over the entire range permissible by DistanceType, then chances that the computation overflows is nonnegligible. To receive an arithmetic_error exception upon overflow, compile your application with #define
SPATIAL_SAFER_ARITHEMTICS
.
Definition at line 138 of file metric.hpp.

private 
Definition at line 142 of file metric.hpp.
typedef details::rebind_builtin_difference<Diff, DistanceType>::type spatial::quadrance< Ct, DistanceType, Diff >::difference_type 
The type used to compute the difference between 2 keys along the same dimension.
Definition at line 150 of file metric.hpp.
typedef DistanceType spatial::quadrance< Ct, DistanceType, Diff >::distance_type 
Definition at line 159 of file metric.hpp.

private 
The key_type of the container being used for calculations.
Definition at line 156 of file metric.hpp.

explicit 
The constructor allows you to specify a custom difference type.
Definition at line 162 of file metric.hpp.
spatial::quadrance< Ct, DistanceType, Diff >::quadrance  (  const quadrance< Ct, AnyDistanceType, Diff > &  other  ) 
Copy the metric from another metric with any DistanceType.
Definition at line 166 of file metric.hpp.
difference_type spatial::quadrance< Ct, DistanceType, Diff >::difference  (  )  const 
Returns the difference functor used in this type.
Definition at line 200 of file metric.hpp.
distance_type spatial::quadrance< Ct, DistanceType, Diff >::distance_to_key  (  dimension_type  rank, 
const key_type &  origin,  
const key_type &  key  
)  const 
Compute the distance between the point of origin
and the key
.
Definition at line 174 of file metric.hpp.
distance_type spatial::quadrance< Ct, DistanceType, Diff >::distance_to_plane  (  dimension_type  , 
dimension_type  dim,  
const key_type &  origin,  
const key_type &  key  
)  const 
The distance between the point of origin
and the closest point to the plane orthogonal to the axis of dimension dim
and crossing key
.
Definition at line 189 of file metric.hpp.