CGAL 5.1 - dD Spatial Searching
GeneralDistance Concept Reference

## Definition

Requirements of a distance class defining a distance between a query item denoting a spatial object and a point. To optimize distance computations transformed distances are used, e.g., for a Euclidean distance the transformed distance is the squared Euclidean distance.

Has Models:

CGAL::Manhattan_distance_iso_box_point<Traits>

CGAL::Euclidean_distance_sphere_point<Traits>

## Types

typedef unspecified_type D
Dimension Tag.

typedef unspecified_type FT
Number type.

typedef unspecified_type Point_d
Point type.

typedef unspecified_type Query_item
Query item type.

## Operations

FT transformed_distance (Query_item q, Point_d r)
Returns the transformed distance between q and r.

template<typename Coord_iterator >
FT transformed_distance_from_coordinates (Query_item q, Coord_iterator begin, Coord_iterator end) const
Optional: must be defined when used with a Kd_tree where EnablePointsCache is set to Tag_true. More...

template<typename Coord_iterator >
FT interruptible_transformed_distance (Query_item q, Coord_iterator begin, Coord_iterator end, FT stop_if_geq_to_this) const
Optional: in most cases (e.g., Euclidean distance), the distance computation algorithm knows before its end that the distance will be greater than or equal to some given value. More...

FT min_distance_to_rectangle (Query_item q, Kd_tree_rectangle< FT, D > r) const
Returns the transformed distance between q and the point on the boundary of r closest to q.

FT max_distance_to_rectangle (Query_item q, Kd_tree_rectangle< FT, D > r) const
Returns the transformed distance between q and the point on the boundary of r furthest to q.

FT transformed_distance (FT d) const
Returns the transformed distance.

FT inverse_of_transformed_distance (FT d) const
Returns the inverse of the transformed distance.

## ◆ interruptible_transformed_distance()

template<typename Coord_iterator >
 FT GeneralDistance::interruptible_transformed_distance ( Query_item q, Coord_iterator begin, Coord_iterator end, FT stop_if_geq_to_this ) const

Optional: in most cases (e.g., Euclidean distance), the distance computation algorithm knows before its end that the distance will be greater than or equal to some given value.

In this function, the computation can be stopped when the distance is going to be greater than or equal to stop_if_geq_to_this. In this case, the only requirement of the return value it to be $$\geq$$ stop_if_geq_to_this. Note that points cache does not have to be activated to enable this optimization.

Returns the transformed distance between q and the point whose Cartesian coordinates are contained in the range [begin, end), or any value $$\geq$$ stop_if_geq_to_this if the transformed distance is $$\geq$$ stop_if_geq_to_this.

## ◆ transformed_distance_from_coordinates()

template<typename Coord_iterator >
 FT GeneralDistance::transformed_distance_from_coordinates ( Query_item q, Coord_iterator begin, Coord_iterator end ) const

Optional: must be defined when used with a Kd_tree where EnablePointsCache is set to Tag_true.

Returns the transformed distance between q and the point whose Cartesian coordinates are contained in the range [begin, end).