From 43ef4e35ba0fdda55c8902da85b6519e450cf47f Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 11 Aug 2022 15:32:18 +0200 Subject: [PATCH 1/3] temporarily replace explicit call to kernel there are more than 90% filter failures in calls to Compare_distance_3()(Point_3, Segment_3, Point_3) this commits divides by 10 the initialization (protecting ball placement) time, at least on polyhedral surfaces input --- Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 67006e8bbea..34b80017c3c 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -434,9 +434,8 @@ private: const T1& obj1, const T2& obj2) const { - typename Kernel::Compare_distance_3 compare_distance = - Kernel().compare_distance_3_object(); - return compare_distance(p,obj1,obj2); + return CGAL::compare(CGAL::squared_distance(p, obj1), + CGAL::squared_distance(p, obj2)); } public: From e7ffd0b943d79c377801ee9c32dcb909290a7ebe Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 19 Aug 2022 15:25:28 +0200 Subject: [PATCH 2/3] New patch This patch removes the cause of filter failures of `Compare_distance_3`, and keep the exactness. --- .../Mesh_domain_with_polyline_features_3.h | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 34b80017c3c..8f71ba0f24a 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -373,16 +373,23 @@ private: if(nearest_is_a_segment) { - if(compare_distance(p, seg, nearest_segment) == CGAL::SMALLER) - { - nearest_segment = seg; - result = previous; - } if(compare_distance(p, *it, nearest_segment) == CGAL::SMALLER) { nearest_vertex = it; nearest_is_a_segment = false; result = it; + if (possibly(angle(*previous, *it, p) == CGAL::ACUTE) && + compare_distance(p, seg, *nearest_vertex) == CGAL::SMALLER) + { + nearest_segment = seg; + nearest_is_a_segment = true; + result = previous; + } + } + else if(compare_distance(p, seg, nearest_segment) == CGAL::SMALLER) + { + nearest_segment = seg; + result = previous; } } else { @@ -391,7 +398,9 @@ private: nearest_vertex = it; result = it; } - if(compare_distance(p, seg, *nearest_vertex) == CGAL::SMALLER) + if ((nearest_vertex != it || + possibly(angle(*previous, *it, p) == CGAL::ACUTE)) && + compare_distance(p, seg, *nearest_vertex) == CGAL::SMALLER) { nearest_segment = seg; nearest_is_a_segment = true; From 67a5a69e7f9a07ca8bf041d7deb6a1359a2b80c8 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 25 Aug 2022 10:29:04 +0200 Subject: [PATCH 3/3] Revert "temporarily replace explicit call to kernel" This reverts commit 43ef4e35ba0fdda55c8902da85b6519e450cf47f. --- Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 8f71ba0f24a..819ff13f88b 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -443,8 +443,9 @@ private: const T1& obj1, const T2& obj2) const { - return CGAL::compare(CGAL::squared_distance(p, obj1), - CGAL::squared_distance(p, obj2)); + typename Kernel::Compare_distance_3 compare_distance = + Kernel().compare_distance_3_object(); + return compare_distance(p,obj1,obj2); } public: