Have squared_distance(Point_3, Point_3) call its functor.

This commit is contained in:
Sylvain Pion 2006-08-04 12:41:56 +00:00
parent c7f1f68b40
commit fcbacc1284
2 changed files with 13 additions and 7 deletions

View File

@ -188,12 +188,9 @@ inline
typename K::FT
squared_distance(const typename CGAL_WRAP(K)::Point_3 & pt1,
const typename CGAL_WRAP(K)::Point_3 & pt2,
const K&)
const K& k)
{
typename K::Construct_vector_3 construct_vector;
typedef typename K::Vector_3 Vector_3;
Vector_3 vec = construct_vector(pt2, pt1);
return vec*vec;
return k.compute_squared_distance_3_object()(pt1, pt2);
}

View File

@ -213,6 +213,7 @@ namespace CommonKernelFunctors {
class Compute_squared_distance_3
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
public:
typedef FT result_type;
typedef Arity_tag< 2 > Arity;
@ -222,6 +223,14 @@ namespace CommonKernelFunctors {
FT
operator()( const T1& t1, const T2& t2) const
{ return CGALi::squared_distance(t1, t2, K()); }
FT
operator()( const Point_3& pt1, const Point_3& pt2) const
{
typedef typename K::Vector_3 Vector_3;
Vector_3 vec = pt2 - pt1;
return vec*vec;
}
};
template <typename K>