From a92e6e603982ca96f997189e56c2ca64a563117a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 16 Mar 2022 15:00:02 +0100 Subject: [PATCH] Nef_3: Use has_smaller_distance_to_point() --- Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index 0cb23307d66..9b4ede6b4d8 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -349,10 +349,8 @@ public: CGAL_assertion( initialized); _CGAL_NEF_TRACEN( "locate "<objects_around_point(p); @@ -366,23 +364,23 @@ public: if(p==v->point()) return make_object(v); - min_distance = CGAL::squared_distance(v->point(),p); - result = make_object(v); + closest = v; ++o; while(o!=candidates.end() && CGAL::assign(v,*o)) { if ( p == v->point()) { _CGAL_NEF_TRACEN("found on vertex "<point()); return make_object(v); } - tmp_distance = CGAL::squared_distance(v->point(),p); - if(tmp_distance < min_distance) { - result = make_object(v); - min_distance = tmp_distance; + + if(CGAL::has_smaller_distance_to_point(p, v->point(), closest->point())){ + closest = v; } ++o; } - CGAL::assign(v, result); + v = closest; + result = make_object(v); + Segment_3 s(p,v->point()); // bool first = true; Point_3 ip;