From 910c930eded5f8dc1e906462d1c3d1d94f2752bb Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 1 Jun 2022 12:26:50 +0200 Subject: [PATCH] Better usage of the dispatch on `itag` --- .../CGAL/Constrained_triangulation_2.h | 68 ++----------------- .../CGAL/Constrained_triangulation_plus_2.h | 3 +- 2 files changed, 7 insertions(+), 64 deletions(-) diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index e9614c72575..bb74cb78c9c 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -1042,7 +1042,7 @@ Constrained_triangulation_2:: intersect(Face_handle f, int i, Vertex_handle vaa, Vertex_handle vbb, - Exact_intersections_tag) + Exact_intersections_tag itag) // compute the intersection of the constraint edge (f,i) // with the subconstraint (vaa,vbb) being inserted // insert the intersection point @@ -1063,7 +1063,6 @@ intersect(Face_handle f, int i, const Point& pc = f->vertex(cw(i))->point(); const Point& pd = f->vertex(ccw(i))->point(); Point pi; - Itag itag = Itag(); CGAL_triangulation_assertion_code( bool ok = ) intersection(geom_traits(), pa, pb, pc, pd, pi, itag ); CGAL_triangulation_assertion(ok); @@ -1077,7 +1076,7 @@ Constrained_triangulation_2:: intersect(Face_handle f, int i, Vertex_handle vaa, Vertex_handle vbb, - Exact_predicates_tag) + Exact_predicates_tag itag) { Vertex_handle vcc, vdd; vcc = f->vertex(cw(i)); @@ -1097,7 +1096,6 @@ intersect(Face_handle f, int i, << " )\n"; #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS Point pi; //creator for point is required here - Itag itag = Itag(); bool ok = intersection(geom_traits(), pa, pb, pc, pd, pi, itag ); auto intersection_not_in_the_two_triangles = [&](const Point& pi) { @@ -1133,11 +1131,11 @@ intersect(Face_handle f, int i, } } else{ //intersection computed - if(can_construct_almost_exact_intersection(geom_traits(), itag) && + if(can_construct_almost_exact_intersection(geom_traits()) && intersection_not_in_the_two_triangles(pi)) { // now compute the exact intersection point - pi = almost_exact_intersection(geom_traits(), pa, pb, pc, pd, itag); + pi = almost_exact_intersection(geom_traits(), pa, pb, pc, pd); if (intersection_not_in_the_two_triangles(pi)) { // If the most-exact intersection point is not in the union of the two // triangles, then snap to `pc` or `pd`... @@ -1779,42 +1777,6 @@ compute_intersection(const Gt& gt, return false; } -template -int -limit_intersection(const Gt& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - No_constraint_intersection_tag) -{ - return 0; -} - -template -int -limit_intersection(const Gt& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - No_constraint_intersection_requiring_constructions_tag) -{ - return 0; -} - -template -int -limit_intersection(const Gt& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - const typename Gt::Point_2& , - Exact_intersections_tag) -{ - return 0; -} - template int limit_intersection(const Gt& gt, @@ -1853,35 +1815,17 @@ struct Can_construct_almost_exact_intersection : public CGAL::Tag_false {}; template -constexpr bool can_construct_almost_exact_intersection(const Gt&, Exact_predicates_tag) { +constexpr bool can_construct_almost_exact_intersection(const Gt&) { return Can_construct_almost_exact_intersection::value; } -template -constexpr bool can_construct_almost_exact_intersection(const Gt&, Tag) { - return false; -} - -template -typename Gt::Point_2 -almost_exact_intersection(const Gt&, - const typename Gt::Point_2&, - const typename Gt::Point_2&, - const typename Gt::Point_2&, - const typename Gt::Point_2&, - Tag) -{ - CGAL_error_msg("this function should be call only with Exact_predicates_tag"); -} - template typename Gt::Point_2 almost_exact_intersection(const Gt& gt, const typename Gt::Point_2& pa, const typename Gt::Point_2& pb, const typename Gt::Point_2& pc, - const typename Gt::Point_2& pd, - Exact_predicates_tag) + const typename Gt::Point_2& pd) { Boolean_tag::value> tag; return almost_exact_intersection(gt, pa, pb, pc, pd, tag); diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h index fe11801fddd..3d9c3d96793 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_plus_2.h @@ -1208,7 +1208,7 @@ Constrained_triangulation_plus_2:: intersect(Face_handle f, int i, Vertex_handle vaa, Vertex_handle vbb, - Exact_predicates_tag) + Exact_predicates_tag itag) { Vertex_handle vcc, vdd; vcc = f->vertex(cw(i)); @@ -1228,7 +1228,6 @@ intersect(Face_handle f, int i, #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS Point pi; //creator for point is required here - Intersection_tag itag = Intersection_tag(); bool ok = intersection(geom_traits(), pa, pb, pc, pd, pi, itag ); Vertex_handle vi;