CGAL 5.1 - dD Spatial Searching
CGAL::Weighted_Minkowski_distance< Traits > Class Template Reference

#include <CGAL/Weighted_Minkowski_distance.h>

Definition

template<typename Traits>
class CGAL::Weighted_Minkowski_distance< Traits >

The class Weighted_Minkowski_distance provides an implementation of the concept OrthogonalDistance, with a weighted Minkowski metric on \( d\)-dimensional points defined by \( l_p(w)(r,q)= ({\Sigma_{i=1}^{i=d} \, w_i(r_i-q_i)^p})^{1/p}\) for \( 0 < p <\infty\) and defined by \( l_{\infty}(w)(r,q)=max \{w_i |r_i-q_i| \mid 1 \leq i \leq d\}\). For the purpose of the distance computations it is more efficient to compute the transformed distance \( {\sigma_{i=1}^{i=d} \, w_i(r_i-q_i)^p}\) instead of the actual distance.

Template Parameters
Traitsmust be a model of the concept SearchTraits, for example Search_traits_2.
Is Model Of:
OrthogonalDistance
See also
OrthogonalDistance
CGAL::Euclidean_distance<Traits>
Examples
Spatial_searching/weighted_Minkowski_distance.cpp.

Types

typedef Traits::Dimension D
 Dimension tag. More...
 
typedef Traits::FT FT
 Number type. More...
 
typedef Traits::Point_d Point_d
 Point type. More...
 

Creation

 Weighted_Minkowski_distance (int d, Traits t=Traits())
 Constructor implementing \( l_2\) metric for \( d\)-dimensional points. More...
 
template<class InputIterator >
 Weighted_Minkowski_distance (FT power, int dim, InputIterator wb, InputIterator we, Traits t=Traits())
 Constructor implementing the \( l_{power}(weights)\) metric. More...
 

Operations

FT transformed_distance (Point_d q, Point_d r) const
 Returns \( d^{power}\), where \( d\) denotes the distance between q and r. More...
 
FT min_distance_to_rectangle (Point_d q, Kd_tree_rectangle< FT, D > r) const
 Returns \( d^{power}\), where \( d\) denotes the distance between the query item q and the point on the boundary of r closest to q. More...
 
FT min_distance_to_rectangle (Point_d q, Kd_tree_rectangle< FT, D > r, vector< FT > &dists)
 Returns \( d^{power}\), where \( d\) denotes the distance between the query item q and the point on the boundary of r closest to q. More...
 
FT max_distance_to_rectangle (Point_d q, Kd_tree_rectangle< FT, D > r) const
 Returns \( d^{power}\), where \( d\) denotes the distance between the query item q and the point on the boundary of r farthest to q. More...
 
FT max_distance_to_rectangle (Point_d q, Kd_tree_rectangle< FT, D > r, vector< FT > &dists)
 Returns \( d^{power}\), where \( d\) denotes the distance between the query item q and the point on the boundary of r farthest to q. More...
 
FT new_distance (FT dist, FT old_off, FT new_off, int cutting_dimension) const
 Updates dist incrementally and returns the updated distance. More...
 
FT transformed_distance (FT d) const
 Returns \( d^p\) for \( 0 < p <\infty\) . More...
 
FT inverse_of_transformed_distance (FT d) const
 Returns \( d^{1/p}\) for \( 0 < p <\infty\). More...
 

Member Typedef Documentation

◆ D

template<typename Traits >
typedef Traits::Dimension CGAL::Weighted_Minkowski_distance< Traits >::D

Dimension tag.

◆ FT

template<typename Traits >
typedef Traits::FT CGAL::Weighted_Minkowski_distance< Traits >::FT

Number type.

◆ Point_d

template<typename Traits >
typedef Traits::Point_d CGAL::Weighted_Minkowski_distance< Traits >::Point_d

Point type.

Constructor & Destructor Documentation

◆ Weighted_Minkowski_distance() [1/2]

template<typename Traits >
CGAL::Weighted_Minkowski_distance< Traits >::Weighted_Minkowski_distance ( int  d,
Traits  t = Traits() 
)

Constructor implementing \( l_2\) metric for \( d\)-dimensional points.

◆ Weighted_Minkowski_distance() [2/2]

template<typename Traits >
template<class InputIterator >
CGAL::Weighted_Minkowski_distance< Traits >::Weighted_Minkowski_distance ( FT  power,
int  dim,
InputIterator  wb,
InputIterator  we,
Traits  t = Traits() 
)

Constructor implementing the \( l_{power}(weights)\) metric.

\( power \leq0\) denotes the \( l_{\infty}(weights)\) metric. The values in the iterator range [wb,we) are the weight.

Member Function Documentation

◆ inverse_of_transformed_distance()

template<typename Traits >
FT CGAL::Weighted_Minkowski_distance< Traits >::inverse_of_transformed_distance ( FT  d) const

Returns \( d^{1/p}\) for \( 0 < p <\infty\).

Returns \( d\) for \( p=\infty\).

◆ max_distance_to_rectangle() [1/2]

template<typename Traits >
FT CGAL::Weighted_Minkowski_distance< Traits >::max_distance_to_rectangle ( Point_d  q,
Kd_tree_rectangle< FT, D r 
) const

Returns \( d^{power}\), where \( d\) denotes the distance between the query item q and the point on the boundary of r farthest to q.

◆ max_distance_to_rectangle() [2/2]

template<typename Traits >
FT CGAL::Weighted_Minkowski_distance< Traits >::max_distance_to_rectangle ( Point_d  q,
Kd_tree_rectangle< FT, D r,
vector< FT > &  dists 
)

Returns \( d^{power}\), where \( d\) denotes the distance between the query item q and the point on the boundary of r farthest to q.

Stores the distances in each dimension in dists.

◆ min_distance_to_rectangle() [1/2]

template<typename Traits >
FT CGAL::Weighted_Minkowski_distance< Traits >::min_distance_to_rectangle ( Point_d  q,
Kd_tree_rectangle< FT, D r 
) const

Returns \( d^{power}\), where \( d\) denotes the distance between the query item q and the point on the boundary of r closest to q.

◆ min_distance_to_rectangle() [2/2]

template<typename Traits >
FT CGAL::Weighted_Minkowski_distance< Traits >::min_distance_to_rectangle ( Point_d  q,
Kd_tree_rectangle< FT, D r,
vector< FT > &  dists 
)

Returns \( d^{power}\), where \( d\) denotes the distance between the query item q and the point on the boundary of r closest to q.

Stores the distances in each dimension in dists.

◆ new_distance()

template<typename Traits >
FT CGAL::Weighted_Minkowski_distance< Traits >::new_distance ( FT  dist,
FT  old_off,
FT  new_off,
int  cutting_dimension 
) const

Updates dist incrementally and returns the updated distance.

◆ transformed_distance() [1/2]

template<typename Traits >
FT CGAL::Weighted_Minkowski_distance< Traits >::transformed_distance ( FT  d) const

Returns \( d^p\) for \( 0 < p <\infty\) .

Returns \( d\) for \( p=\infty\) .

◆ transformed_distance() [2/2]

template<typename Traits >
FT CGAL::Weighted_Minkowski_distance< Traits >::transformed_distance ( Point_d  q,
Point_d  r 
) const

Returns \( d^{power}\), where \( d\) denotes the distance between q and r.