diff --git a/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h b/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h index c2e1e77e98b..7f0f67cca88 100644 --- a/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h +++ b/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h @@ -59,9 +59,16 @@ typedef unspecified_type Construct_sphere_3; /*! A functor object to compute the point on a geometric primitive which is closest from a query. Provides the operator: -`Point_3 operator()(const Point_3& p, const Type_2& type_2);` where `Type_2` is any type among `Segment_3` and `Triangle_3`. The operator returns the point on `type_2` which is closest to `p`. +`Point_3 operator()(const Type_2& type_2, const Point_3& p);` where `Type_2` is any type among `Segment_3` and `Triangle_3`. The operator returns the point on `type_2` which is closest to `p`. */ -typedef unspecified_type Compute_closest_point_3; +typedef unspecified_type Construct_projected_point_3; + +/*! +A functor object to compare the distance of two points wrt a third one. +Provides the operator: +`CGAL::Comparision_result operator()(const Point_3& p1, const Point_3& p2, const Point_3& p3)`. The operator compare the distance between `p1 and `p2`, and between `p2` and `p3`. +*/ +typedef unspecified_type Compare_distance_3 /*! A functor object to detect if a point lies inside a sphere or not. @@ -106,7 +113,12 @@ Construct_sphere_3 construct_sphere_3_object(); /*! Returns the closest point constructor. */ -Compute_closest_point_3 compute_closest_point_3_object(); +Construct_projected_point_3 construct_projected_point_3_object(); + +/*! +Returns the compare distance constructor. +*/ +Compare_distance_3 compare_distance_3_object(); /*! Returns the closest point constructor. diff --git a/AABB_tree/include/CGAL/AABB_intersections.h b/AABB_tree/include/CGAL/AABB_intersections.h index f1df4ab0925..d7344df618a 100644 --- a/AABB_tree/include/CGAL/AABB_intersections.h +++ b/AABB_tree/include/CGAL/AABB_intersections.h @@ -19,6 +19,3 @@ // Author(s) : Camille Wormser, Pierre Alliez, Stephane Tayeb #include - -#include -#include diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 39e677d3126..d17eeb10664 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -397,7 +397,12 @@ public: Point operator()(const Point& p, const Primitive& pr, const Point& bound) const { - return CGAL::nearest_point_3(p, internal::Primitive_helper::get_datum(pr,m_traits), bound); + GeomTraits geom_traits; + Point closest_point = geom_traits.construct_projected_point_3_object()( + internal::Primitive_helper::get_datum(pr,m_traits), p); + return + geom_traits.compare_distance_3_object()(p, closest_point, bound)==LARGER ? + bound : closest_point; } };