using Construct_projected_point_3 in Closest_point as it meant to be documented

This commit is contained in:
Sébastien Loriot 2016-09-01 14:41:03 +02:00
parent c751ab4310
commit e8939a8db1
3 changed files with 21 additions and 7 deletions

View File

@ -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.

View File

@ -19,6 +19,3 @@
// Author(s) : Camille Wormser, Pierre Alliez, Stephane Tayeb
#include <CGAL/intersections.h>
#include <CGAL/internal/AABB_tree/nearest_point_segment_3.h>
#include <CGAL/internal/AABB_tree/nearest_point_triangle_3.h>

View File

@ -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<AT>::get_datum(pr,m_traits), bound);
GeomTraits geom_traits;
Point closest_point = geom_traits.construct_projected_point_3_object()(
internal::Primitive_helper<AT>::get_datum(pr,m_traits), p);
return
geom_traits.compare_distance_3_object()(p, closest_point, bound)==LARGER ?
bound : closest_point;
}
};