diff --git a/Distance_3/include/CGAL/squared_distance_3_0.h b/Distance_3/include/CGAL/squared_distance_3_0.h index d99300e9e81..814ffc5871d 100644 --- a/Distance_3/include/CGAL/squared_distance_3_0.h +++ b/Distance_3/include/CGAL/squared_distance_3_0.h @@ -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&) -{ - typename K::Construct_vector_3 construct_vector; - typedef typename K::Vector_3 Vector_3; - Vector_3 vec = construct_vector(pt2, pt1); - return vec*vec; + const K& k) +{ + return k.compute_squared_distance_3_object()(pt1, pt2); } diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index d0571472cd5..0e07cd53838 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -212,7 +212,8 @@ namespace CommonKernelFunctors { template class Compute_squared_distance_3 { - typedef typename K::FT FT; + 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