Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
|
Defines a metric working on the Euclidian space where distances are expressed in one of C++'s floating point types. More...
#include <metric.hpp>
Inherits Diff.
Inherited by spatial::details::Compress< euclidian< Ct, DistanceType, Diff >, typename spatial::container_traits< const Ct >::key_type > [private]
, and spatial::details::Compress< euclidian< 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 |
The distance type being used for distance calculations. More... | |
Public Member Functions | |
euclidian (const difference_type &diff=Diff()) | |
The constructors allows you to specify a custom difference type. More... | |
template<typename AnyDistanceType > | |
euclidian (const euclidian< 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_floating_point< DistanceType > >::type | check_concept_distance_type_is_floating_point |
typedef container_traits< Ct >::key_type | key_type |
The key_type of the container being used for calculations. More... | |
Defines a metric working on the Euclidian space where distances are expressed in one of C++'s floating point types.
This
metric works on floating types only. It will fail to compile if given non-floating types as a parameter for the distance.euclidian uses square root calculation in the distance. It will return proper distances therefore but will be slower than quadrance. When defining SPATIAL_SAFER_ARITHMETICS however, euclidian uses the hypot algorithm which has much less chance to overflow or underflow than quadrance. However is it also much slower.
Definition at line 42 of file metric.hpp.
|
private |
Definition at line 46 of file metric.hpp.
typedef details::rebind_builtin_difference<Diff, DistanceType>::type spatial::euclidian< Ct, DistanceType, Diff >::difference_type |
The type used to compute the difference between 2 keys along the same dimension.
Definition at line 54 of file metric.hpp.
typedef DistanceType spatial::euclidian< Ct, DistanceType, Diff >::distance_type |
The distance type being used for distance calculations.
Definition at line 66 of file metric.hpp.
|
private |
The key_type of the container being used for calculations.
Definition at line 60 of file metric.hpp.
|
explicit |
The constructors allows you to specify a custom difference type.
Definition at line 69 of file metric.hpp.
spatial::euclidian< Ct, DistanceType, Diff >::euclidian | ( | const euclidian< Ct, AnyDistanceType, Diff > & | other | ) |
Copy the metric from another metric with any DistanceType.
Definition at line 73 of file metric.hpp.
difference_type spatial::euclidian< Ct, DistanceType, Diff >::difference | ( | ) | const |
Returns the difference functor used in this type.
Definition at line 111 of file metric.hpp.
distance_type spatial::euclidian< 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 81 of file metric.hpp.
distance_type spatial::euclidian< 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
.
Given any 2 points 'origin' and 'key', the result of distance_to_plane must always be less or equal to the result of distance_to_key.
Definition at line 100 of file metric.hpp.