From 0ccbfc4c7830d08fb89b57edf6271d54d272202b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 30 May 2025 14:48:39 +0100 Subject: [PATCH] Use functor to compute squared distance --- .../NewKernel_d/function_objects_cartesian.h | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h index 2fa984f2b12..4fbf2441276 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -1199,25 +1199,13 @@ template struct Compare_squared_distance : private Store_kernel { typedef R_ R; typedef typename Get_type::type RT; typedef typename Get_type::type result_type; - typedef typename Get_functor >::type CI; + typedef typename Get_functor::type CSD; template result_type operator()(V const&a, V const&b, W const&c)const{ // Point, Point. FT - CI ci(this->kernel()); - - auto a_begin=ci(a,Begin_tag()); - auto b_begin=ci(b,Begin_tag()); - auto a_end=ci(a,End_tag()); - RT sqdist(0); - result_type res; - // can't we do slightly better for Uncertain<*> ? - // after res=...; if(is_uncertain(res))return indeterminate(); - do{ - RT d = (*a_begin++ - *b_begin++); - sqdist += d*d; - }while(a_begin!=a_end); - res=CGAL_NTS compare(sqdist,c); - return res; + CSD csd(this->kernel()); + RT sqdist = csd(a,b); + return compare(sqdist,c); } }; }