From 4e1e7d8c16553d9b294f739c513c1f75dd788f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 26 Jun 2019 10:52:48 +0200 Subject: [PATCH 1/4] fix wrong index --- .../internal/Corefinement/Face_graph_output_builder.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index c9eed95cef6..d15a3c5d047 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -579,12 +579,12 @@ public: if ( opposite(next(h1, tm1), tm1) == prev(opposite(h1, tm1), tm1) ) { inter_edges_to_remove1.insert(edge(next(h1, tm1),tm1)); - inter_edges_to_remove1.insert(edge(next(h2, tm2),tm2)); + inter_edges_to_remove2.insert(edge(next(h2, tm2),tm2)); } if ( opposite(prev(h1, tm1), tm1) == next(opposite(h1, tm1), tm1) ) { inter_edges_to_remove1.insert(edge(prev(h1, tm1), tm1)); - inter_edges_to_remove1.insert(edge(prev(h2, tm2), tm2)); + inter_edges_to_remove2.insert(edge(prev(h2, tm2), tm2)); } } // same but for h2 @@ -598,12 +598,12 @@ public: if ( opposite(next(h2, tm2), tm2) == prev(opposite(h2, tm2), tm2) ) { inter_edges_to_remove1.insert(edge(next(h1, tm1),tm1)); - inter_edges_to_remove1.insert(edge(next(h2, tm2),tm2)); + inter_edges_to_remove2.insert(edge(next(h2, tm2),tm2)); } if ( opposite(prev(h2, tm2), tm2) == next(opposite(h2, tm2), tm2) ) { inter_edges_to_remove1.insert(edge(prev(h1, tm1), tm1)); - inter_edges_to_remove1.insert(edge(prev(h2, tm2), tm2)); + inter_edges_to_remove2.insert(edge(prev(h2, tm2), tm2)); } } } From f882c5d3a63dfc7060d1abf52b9daeba946eebf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 26 Jun 2019 15:09:19 +0200 Subject: [PATCH 2/4] Sanitize result of square root --- .../CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h index c6d3f292454..136d4722cae 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Basic_predicates_C2.h @@ -146,8 +146,11 @@ public: static FT to_ft(const Sqrt_3& x) { - FT sqrt_e = compute_sqrt( to_ft(x.e()), FT_Has_sqrt() ); - FT sqrt_f = compute_sqrt( to_ft(x.f()), FT_Has_sqrt() ); + // If the number type does not offer a square root, x.e() and x.f() (which are of type sqrt_1) + // might be negative after (approximately) evaluating them. Taking the max sanitize these values + // to ensure that we do not take the square root of a negative number. + FT sqrt_e = compute_sqrt( (std::max)(FT(0), to_ft(x.e())), FT_Has_sqrt() ); + FT sqrt_f = compute_sqrt( (std::max)(FT(0), to_ft(x.f())), FT_Has_sqrt() ); FT sqrt_ef = sqrt_e * sqrt_f; return to_ft(x.a()) + to_ft(x.b()) * sqrt_e + to_ft(x.c()) * sqrt_f + to_ft(x.d()) * sqrt_ef; From c78f1ef812376504798c8de9470e3af11cf43965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 26 Jun 2019 15:57:32 +0200 Subject: [PATCH 3/4] Remove superfluous 'typename's --- Intersections_2/test/Intersections_2/test_intersections_2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Intersections_2/test/Intersections_2/test_intersections_2.cpp b/Intersections_2/test/Intersections_2/test_intersections_2.cpp index f501bf75211..073adae0846 100644 --- a/Intersections_2/test/Intersections_2/test_intersections_2.cpp +++ b/Intersections_2/test/Intersections_2/test_intersections_2.cpp @@ -798,9 +798,9 @@ int main() { CGAL::Set_ieee_double_precision pfr; - Test< CGAL::Simple_cartesian::Type > >().run(); + Test< CGAL::Simple_cartesian::Type > >().run(); Test< CGAL::Cartesian >().run(); - Test< CGAL::Homogeneous::Type > >().run(); + Test< CGAL::Homogeneous::Type > >().run(); Test< CGAL::Exact_predicates_inexact_constructions_kernel >().run(); Test< CGAL::Exact_predicates_exact_constructions_kernel >().run(); } From df9a63b2b40f09b60ccb614bd3c9798d13597ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 27 Jun 2019 08:44:46 +0200 Subject: [PATCH 4/4] update marks on removed edges --- .../internal/Corefinement/Face_graph_output_builder.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index 2e4a3b33bc4..b079f204e1b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -560,9 +560,15 @@ public: ++epp_it; } BOOST_FOREACH(edge_descriptor ed, inter_edges_to_remove1) + { + put(marks_on_input_edges.ecm1, ed, false); intersection_edges1.erase(ed); + } BOOST_FOREACH(edge_descriptor ed, inter_edges_to_remove2) + { + put(marks_on_input_edges.ecm2, ed, false); intersection_edges2.erase(ed); + } // (1) Assign a patch id to each facet indicating in which connected // component limited by intersection edges of the surface they are.