removing Get_geometric_object_for_element and adding Squared_distance_of_element to CollectionPartitioningOrthtreeTraits

This commit is contained in:
Sven Oesau 2024-02-02 11:56:14 +01:00
parent ad5807f5e6
commit bd11275ad1
3 changed files with 11 additions and 10 deletions

View File

@ -36,11 +36,12 @@ public:
using Node_data_element = unspecified_type;
/*!
* \brief Functor with an operator to produce a geometric object from a `Node_data_element`.
* \brief Functor with an operator calculate the squared distance of `Node_data_element` from a point.
*
* The return type of the functor must be a valid argument to `CGAL::squared_distance()`.
* Provides the operator:
* `FT operator()(const Node_data_element&, const Point_d&)`
*/
using Get_geometric_object_for_element = unspecified_type;
using Squared_distance_of_element = unspecified_type;
/// @}
@ -48,9 +49,9 @@ public:
/// @{
/*!
* constructs an object of type `Get_geometric_object_for_element`.
* constructs an object of type `Squared_distance_of_element`.
*/
Get_geometric_object_for_element get_geometric_object_for_element_object() const;
Squared_distance_of_element get_squared_distance_of_element_object() const;
/// @}
};

View File

@ -38,7 +38,7 @@ void nearest_k_neighbors_recursive(const Tree& orthtree,
// Pair that point with its distance from the search point
Result current_point_with_distance =
{p, squared_distance(orthtree.traits().get_geometric_object_for_element_object()(p), search_bounds.center())};
{p, orthtree.traits().get_squared_distance_of_element_object()(p, search_bounds.center())};
// Check if the new point is within the bounds
if (current_point_with_distance.distance < search_bounds.squared_radius()) {

View File

@ -149,10 +149,10 @@ public:
};
}
auto get_geometric_object_for_element_object() const {
return [&](const Node_data_element& index) -> typename Self::Point_d {
return get(m_point_map, index);
};
auto get_squared_distance_of_element_object() const {
return [&](const Node_data_element& index, const Point_d& point) -> typename FT {
return CGAL::squared_distance(get(m_point_map, index), point);
};
}
private: