16 #ifndef SPATIAL_METRIC_HPP
17 #define SPATIAL_METRIC_HPP
19 #include "function.hpp"
21 #include "bits/spatial_math.hpp"
22 #include "bits/spatial_builtin.hpp"
41 template<
typename Ct,
typename DistanceType,
typename Diff>
69 explicit euclidian(
const difference_type& diff = Diff()) : Diff(diff) { }
72 template <
typename AnyDistanceType>
82 const key_type& origin,
const key_type& key)
const
101 const key_type& origin,
const key_type& key)
const
112 {
return *
static_cast<const Diff*
>(
this); }
137 template<
typename Ct,
typename DistanceType,
typename Diff>
162 explicit quadrance(
const difference_type& diff = Diff()) : Diff(diff) { }
165 template <
typename AnyDistanceType>
175 const key_type& origin,
const key_type& key)
const
190 const key_type& origin,
const key_type& key)
const
201 {
return *
static_cast<const Diff*
>(
this); }
230 template<
typename Ct,
typename DistanceType,
typename Diff>
255 explicit manhattan(
const difference_type& diff = Diff()) : Diff(diff) { }
258 template <
typename AnyDistanceType>
268 const key_type& origin,
const key_type& key)
const
284 const key_type& origin,
const key_type& key)
const
295 {
return *
static_cast<const Diff*
>(
this); }
300 #endif // SPATIAL_METRIC_HPP
details::rebind_builtin_difference< Diff, DistanceType >::type difference_type
The type used to compute the difference between 2 keys along the same dimension.
euclidian(const euclidian< Ct, AnyDistanceType, Diff > &other)
Copy the metric from another metric with any DistanceType.
difference_type difference() const
Returns the difference functor used in this type.
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.
manhattan(const difference_type &diff=Diff())
A constructor that allows you to specify the Difference type.
enable_if< import::is_arithmetic< Unit >, Unit >::type square_euclid_distance_to_key(dimension_type rank, const Key &origin, const Key &key, Difference diff)
Compute the square value of the distance between origin and key.
DistanceType distance_type
quadrance(const quadrance< Ct, AnyDistanceType, Diff > &other)
Copy the metric from another metric with any DistanceType.
enable_if< import::is_floating_point< Unit >, Unit >::type euclid_distance_to_key(dimension_type rank, const Key &origin, const Key &key, Difference diff)
Computes the euclidian distance between 2 points.
Defines a metric in the Euclidian space where only the square of the distances are being computed int...
enable_if< import::is_arithmetic< DistanceType > >::type check_concept_distance_type_is_arithmetic
enable_if< import::is_arithmetic< DistanceType > >::type check_concept_distance_type_is_arithmetic
difference_type difference() const
Returns the difference functor used in this type.
container_traits< Ct >::key_type key_type
The key_type of the container being used for calculations.
euclidian(const difference_type &diff=Diff())
The constructors allows you to specify a custom difference type.
quadrance(const difference_type &diff=Diff())
The constructor allows you to specify a custom difference type.
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.
enable_if< import::is_arithmetic< Unit >, Unit >::type manhattan_distance_to_key(dimension_type rank, const Key &origin, const Key &key, Difference diff)
Compute the manhattan distance between origin and key.
container_traits< Ct >::key_type key_type
The key_type of the container being used for calculations.
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...
details::rebind_builtin_difference< Diff, DistanceType >::type difference_type
The type used to compute the difference between 2 keys along the same dimension.
The traits type for all containers in the spatial namespace.
std::size_t dimension_type
Defines the type for the dimension as being a size.
If Diff is a builtin difference type, change the current unit of Diff to the DistanceType specified i...
manhattan(const manhattan< Ct, AnyDistanceType, Diff > &other)
Copy the metric from another metric with any DistanceType.
container_traits< Ct >::key_type key_type
The key_type of the container being used for calculations.
Defines a metric working on the Euclidian space where distances are expressed in one of C++'s floatin...
details::rebind_builtin_difference< Diff, DistanceType >::type difference_type
The type used to compute the difference between 2 keys along the same dimension.
The main namespace used in the library.
Defines a metric for the a space where distances are the sum of all the elements of the vector...
enable_if< import::is_floating_point< Unit >, Unit >::type euclid_distance_to_plane(dimension_type dim, const Key &origin, const Key &key, Difference diff)
Compute the distance between the origin and the closest point to the plane orthogonal to the axis of ...
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.
DistanceType distance_type
The distance type being used for distance calculations.
enable_if< import::is_arithmetic< Unit >, Unit >::type square_euclid_distance_to_plane(dimension_type dim, const Key &origin, const Key &key, Difference diff)
Compute the distance between the origin and the closest point to the plane orthogonal to the axis of ...
enable_if< import::is_floating_point< DistanceType > >::type check_concept_distance_type_is_floating_point
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...
DistanceType distance_type
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...
difference_type difference() const
Returns the difference functor used in this type.
enable_if< import::is_arithmetic< Unit >, Unit >::type manhattan_distance_to_plane(dimension_type dim, const Key &origin, const Key &key, Difference diff)
Compute the distance between the origin and the closest point to the plane orthogonal to the axis of ...