Spatial C++ Library
Generic MultiDimensional Containers and Spatial Operations

Defines a metric for the a space where distances are the sum of all the elements of the vector. More...
#include <metric.hpp>
Inherits Diff.
Inherited by spatial::details::Compress< manhattan< Ct, DistanceType, Diff >, typename spatial::container_traits< const Ct >::key_type > [private]
, and spatial::details::Compress< manhattan< 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  
manhattan (const difference_type &diff=Diff())  
A constructor that allows you to specify the Difference type. More...  
template<typename AnyDistanceType >  
manhattan (const manhattan< 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 for the a space where distances are the sum of all the elements of the vector.
Also known as the taxicab metric.
Ct  The container used with this metric. 
DistanceType  The type used to compute distance values. 
Diff  A difference functor that compute the difference between 2 elements of a the Container's key type, along the same dimension. 
This method of distance calculation is more flexible than spatial::euclidian since it can support all of the C++'s arithmetic types.
This metric is the fastest of all builtin metric, and generally offers an acceptable approaximation to the euclidian metric. However the distance calculated by this metric cannot be converted into Euclidian distances. If you are looking for a fast metric that is convertible in Euclidian distances, check out quadrance.
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 231 of file metric.hpp.

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

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

explicit 
A constructor that allows you to specify the Difference type.
Definition at line 255 of file metric.hpp.
spatial::manhattan< Ct, DistanceType, Diff >::manhattan  (  const manhattan< Ct, AnyDistanceType, Diff > &  other  ) 
Copy the metric from another metric with any DistanceType.
Definition at line 259 of file metric.hpp.
difference_type spatial::manhattan< Ct, DistanceType, Diff >::difference  (  )  const 
Returns the difference functor used in this type.
Definition at line 294 of file metric.hpp.
distance_type spatial::manhattan< 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 267 of file metric.hpp.
distance_type spatial::manhattan< 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 283 of file metric.hpp.