From 2e24249f13e0b474ff0b7e61a4a3285edb60f899 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 4 Dec 2020 16:44:22 +0000 Subject: [PATCH 01/10] Triangulation_2: Change the result type of the Intersect_2 functor --- .../CGAL/internal/Projection_traits_3.h | 27 +++++++++---- .../ConstrainedTriangulationTraits_2.h | 3 +- .../CGAL/Constrained_triangulation_2.h | 38 ++++++++++++------- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/Kernel_23/include/CGAL/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/internal/Projection_traits_3.h index ec721a715ee..a579c4beedd 100644 --- a/Kernel_23/include/CGAL/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/internal/Projection_traits_3.h @@ -308,8 +308,13 @@ public: return (CGAL::abs(dx)>CGAL::abs(dy)) ? ( p.x()-source.x() ) / dx : (p.y()-source.y() ) / dy; } - Object operator()(const Segment_3& s1, const Segment_3& s2) const + + + boost::optional< boost::variant > + operator()(const Segment_3& s1, const Segment_3& s2) const { + typedef boost::variant variant_type; + Point_2 s1_source = project(s1.source()); Point_2 s1_target = project(s1.target()); Point_2 s2_source = project(s2.source()); @@ -321,11 +326,14 @@ public: //compute intersection points in projected plane //We know that none of the segment is degenerate - Object o = intersection(s1_2,s2_2); - const Point_2* pi=CGAL::object_cast(&o); - if (pi==nullptr) { //case of segment or empty - const Segment_2* si=CGAL::object_cast(&o); - if (si==nullptr) return Object(); + + CGAL::cpp11::result_of::type + o = intersection(s1_2,s2_2); + if(! 0){ + return boost::none; + } + + if(const Segment_2* si = boost::get(&*o)){ FT src[3],tgt[3]; //the third coordinate is the midpoint between the points on s1 and s2 FT z1 = s1.source()[dim] + ( alpha(si->source(), s1_source, s1_target) * ( s1.target()[dim] - s1.source()[dim] )); @@ -343,8 +351,11 @@ public: src[Projector::y_index] = si->source().y(); tgt[Projector::x_index] = si->target().x(); tgt[Projector::y_index] = si->target().y(); - return make_object( Segment_3( Point_3(src[0],src[1],src[2]),Point_3(tgt[0],tgt[1],tgt[2]) ) ); + return boost::make_optional(variant_type(Segment_3( Point_3(src[0],src[1],src[2]),Point_3(tgt[0],tgt[1],tgt[2]) ) ) ); } + + + const Point_2* pi = boost::get(&*o); FT coords[3]; //compute the third coordinate of the projected intersection point onto 3D segments FT z1 = s1.source()[dim] + ( alpha(*pi, s1_source, s1_target) * ( s1.target()[dim] - s1.source()[dim] )); @@ -356,7 +367,7 @@ public: Point_3 res(coords[0],coords[1],coords[2]); CGAL_assertion(x(res)==pi->x() && y(res)==pi->y()); - return make_object(res); + return boost::make_optional(variant_type(res)); } }; diff --git a/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h b/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h index 0a26f8ee02d..eae059ac51e 100644 --- a/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h +++ b/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h @@ -39,7 +39,7 @@ public: /*! A function object whose `operator()` computes the intersection of two segments. -`Object_2 operator()(Segment_2 s1, Segment_2 s2);` +`boost:optional > operator()(Segment_2 s1, Segment_2 s2);` Returns the intersection of `s1` and `s2`. */ typedef unspecified_type Intersect_2; @@ -113,4 +113,3 @@ compute_squared_distance_2_object(); /// @} }; /* end ConstrainedTriangulationTraits_2 */ - diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 1ec49ab1581..1d337cd3aaf 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -1710,23 +1710,33 @@ compute_intersection(const Gt& gt, const typename Gt::Point_2& pd, typename Gt::Point_2& pi) { - typename Gt::Intersect_2 compute_intersec=gt.intersect_2_object(); - typename Gt::Construct_segment_2 - construct_segment=gt.construct_segment_2_object(); - Object result = compute_intersec(construct_segment(pa,pb), - construct_segment(pc,pd)); + typedef typename Gt::Point_2 Point_2; + typedef typename Gt::Segment_2 Segment_2; + typename Gt::Intersect_2 compute_intersec = gt.intersect_2_object(); + typename Gt::Construct_segment_2 construct_segment = gt.construct_segment_2_object(); + + auto // CGAL::cpp11::result_of::type + result = compute_intersec(construct_segment(pa,pb), + construct_segment(pc,pd)); + + #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS - typename Gt::Segment_2 s; - if(assign(s, result)) { - std::cerr << CGAL::internal::cdt_2_indent_level - << "compute_intersection: " << s << '\n'; - } - if(assign(pi, result)) { - std::cerr << CGAL::internal::cdt_2_indent_level - << "compute_intersection: " << pi << '\n'; + if(result){ + if (const Segment_2* s = boost::get(&*result)){ + std::cerr << CGAL::internal::cdt_2_indent_level + << "compute_intersection: " << *s << '\n'; + }else if(const Point_2* p = boost::get(&*result)) + std::cerr << CGAL::internal::cdt_2_indent_level + << "compute_intersection: " << *p << '\n'; } #endif // CGAL_CDT_2_DEBUG_INTERSECTIONS - return assign(pi, result); + if(result){ + if(const Point_2* p = boost::get(&*result)){ + pi = *p; + return true; + } + } + return false; } From 7314f83ac8f6289c28e77eb0e47ceeae04d54acc Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 7 Dec 2020 12:41:15 +0000 Subject: [PATCH 02/10] Fixes after comments by Laurent and Marc --- Kernel_23/include/CGAL/internal/Projection_traits_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel_23/include/CGAL/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/internal/Projection_traits_3.h index a579c4beedd..eb94a85caf6 100644 --- a/Kernel_23/include/CGAL/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/internal/Projection_traits_3.h @@ -327,9 +327,9 @@ public: //compute intersection points in projected plane //We know that none of the segment is degenerate - CGAL::cpp11::result_of::type + typename CGAL::cpp11::result_of::type o = intersection(s1_2,s2_2); - if(! 0){ + if(! o){ return boost::none; } From 4079954ee0d2eadba4d20d0fc5c0f62b4e5b8e71 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 8 Dec 2020 16:27:21 +0000 Subject: [PATCH 03/10] Fix Triangulation_2_projection_traits_3 --- ...Triangulation_2_projection_traits_base_3.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h index 984d2381035..f5b8135a83d 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h @@ -185,7 +185,8 @@ public: CGAL_TIME_PROFILER("Construct Projected_intersect_3") } - Object operator()(const Segment& s1, const Segment& s2) + boost::optional > + operator()(const Segment& s1, const Segment& s2) { CGAL_PROFILER("Projected_intersect_3::operator()") CGAL_TIME_PROFILER("Projected_intersect_3::operator()") @@ -200,12 +201,12 @@ public: const Plane_3 plane_1(s1.source(), u1); const Plane_3 plane_2(s2.source(), u2); - Object planes_intersection = intersection(plane_1, plane_2); - if(planes_intersection.empty()) { + auto planes_intersection = intersection(plane_1, plane_2); + if(! planes_intersection) { std::cerr << "planes_intersection is empty\n"; - return planes_intersection; + return boost::none; } - if(const Line* line = object_cast(&planes_intersection)) + if(const Line* line = boost::get(&*planes_intersection)) { const Point& pi = line->point(0); if(cross_product(normal, pi - s1.source()) @@ -216,7 +217,7 @@ public: { // the intersection of the lines is not inside the segments std::cerr << "intersection not inside\n"; - return Object(); + return boost::none; } else { @@ -228,13 +229,13 @@ public: s2.to_vector()))); } } - if(object_cast(&planes_intersection)) + if(boost::get(&*planes_intersection)) { std::cerr << "coplanar lines\n"; CGAL_error(); - return Object(); + return boost::none; } - return Object(); + return boost::none; } }; // end class Projected_intersect_3 From 31037aa014052938766512102ef0cb1aadb9465d Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 8 Dec 2020 16:48:19 +0000 Subject: [PATCH 04/10] Fix Triangulation_2_projection_traits_3 --- .../Triangulation_2_projection_traits_base_3.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h index f5b8135a83d..04ae968671e 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h @@ -224,9 +224,16 @@ public: // Let the plane passing through s1.source() and with normal // the cross product of s1.to_vector() and s2.to_vector(). That // plane should intersect *l, now. - return intersection(*line, Plane_3(s1.source(), - cross_product(s1.to_vector(), - s2.to_vector()))); + auto inter = intersection(*line, Plane_3(s1.source(), + cross_product(s1.to_vector(), + s2.to_vector()))); + if(! inter){ + return boost::none; + } + if(const Point* point = boost::get(&*inter)){ + typedef boost::variant variant_type; + return boost::make_optional(variant_type(*point)); + } } } if(boost::get(&*planes_intersection)) From 695ff0f3b316ded9725b9b6ebc145bc4d88c6887 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 5 Jan 2021 15:39:06 +0000 Subject: [PATCH 05/10] Fix doc of Projection_traits_xy_3 --- Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h index 56b476d9735..63759e8c3ba 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h @@ -77,7 +77,7 @@ typedef Line_3 Line_2; A construction object. Provides the operator : -`Object_2 operator()(Segment_2 s1, Segment_2 s2);` +`boost::optional< boost::variant > operator()(Segment_2 s1, Segment_2 s2);` which returns a 3D object whose projection on the xy-plane is the intersection of the projections of `s1` and `s2`. If non empty, the returned object is either a segment or a point. From f25363131dd14414093f433e77f6cfd6020e744d Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 7 Jan 2021 10:27:22 +0000 Subject: [PATCH 06/10] Switch to variant in Nef_3 --- ...xact_triangulation_euclidean_traits_xy_3.h | 62 +++++++++++-------- ...xact_triangulation_euclidean_traits_xz_3.h | 59 +++++++++++------- ...xact_triangulation_euclidean_traits_yz_3.h | 58 ++++++++++------- 3 files changed, 108 insertions(+), 71 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h index ccd9e3fdb37..4e84e3eebc7 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h @@ -28,13 +28,16 @@ template struct Exact_intersect_xy_2; template struct Exact_intersect_xy_2 { - typedef typename R::Point_2 Point_2; - typedef typename R::Segment_2 Segment_2; + typedef typename R::Point_2 Point_2; + typedef typename R::Segment_2 Segment_2; - typedef typename R::Point_3 Point_3; - typedef typename R::Segment_3 Segment_3; + typedef typename R::Point_3 Point_3; + typedef typename R::Segment_3 Segment_3; - CGAL::Object operator() (Segment_3 s3, Segment_3 t3) + typedef boost::variant variant_type; + + boost::optional + operator() (const Segment_3& s3, const Segment_3& t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -50,17 +53,21 @@ struct Exact_intersect_xy_2 // convert intersection from Object_2 to Object_3 // Note: there is not necessarily a spartial intersection, // so all third components are faked! - CGAL::Object obj = intersection (s2,t2); - if ( CGAL::assign(p2, obj) ) - { obj = make_object (Point_3 (p2.x(),p2.y(),0)); + auto obj = intersection (s2,t2); + if(! obj){ + return boost::none; } - else if ( CGAL::assign(s2, obj) ) - { p2 = s2.source(); - q2 = s2.target(); - obj = make_object( Segment_3( - Point_3(p2.x(),p2.y(),0), Point_3(q2.x(),q2.y(),0) ) ); + if (const Point_2* pi = boost::get(&*obj)) + { + return boost::make_optional(variant_type(Point_3(p2.x(),p2.y(),0))); } - return obj; + + const Segment_2* si = boost::get(&*obj); + p2 = s2.source(); + q2 = s2.target(); + + return boost::make_optional(variant_type(Segment_3(Point_3(p2.x(),p2.y(),0), + Point_3(q2.x(),q2.y(),0) ) )); } }; @@ -73,7 +80,9 @@ struct Exact_intersect_xy_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - CGAL::Object operator() (Segment_3 s3, Segment_3 t3) + typedef boost::variant variant_type; + + boost::optional operator() (Segment_3 s3, Segment_3 t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -91,18 +100,21 @@ struct Exact_intersect_xy_2 // convert intersection from Object_2 to Object_3 // Note: there is not necessarily a spartial intersection, // so all third components are faked! - CGAL::Object obj = intersection (s2,t2); - if ( CGAL::assign(p2, obj) ) - { obj = make_object (Point_3 (p2.hx(),p2.hy(),0,p2.hw())); + auto obj = intersection (s2,t2); + if(! obj){ + return boost::none; } - else if ( CGAL::assign(s2, obj) ) - { p2 = s2.source(); - q2 = s2.target(); - obj = make_object( Segment_3( - Point_3 (p2.hx(),p2.hy(),0,p2.hw()), - Point_3 (q2.hx(),q2.hy(),0,q2.hw()) ) ); + if (const Point_2* pi = boost::get(&*obj)) + { + return boost::make_optional(variant_type(Point_3(p2.hx(),p2.hy(),0,p2.hw()))); } - return obj; + + const Segment_2* si = boost::get(&*obj); + p2 = s2.source(); + q2 = s2.target(); + + return boost::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),p2.hy(),0,p2.hw()), + Point_3 (q2.hx(),q2.hy(),0,q2.hw())) )); } }; diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h index 0e1ccf6864a..178b8b6ad2c 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h @@ -33,7 +33,10 @@ struct Exact_intersect_xz_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - CGAL::Object operator() (Segment_3 s3, Segment_3 t3) + typedef boost::variant variant_type; + + boost::optional + operator() (const Segment_3& s3, const Segment_3& t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -48,18 +51,22 @@ struct Exact_intersect_xz_2 // convert intersection from Object_2 to Object_3 // Note: there is not necessarily a spartial intersection, - // so all second components are faked! - CGAL::Object obj = intersection (s2,t2); - if ( CGAL::assign(p2, obj) ) - { obj = make_object (Point_3 (p2.x(),0,p2.y())); + // so all third components are faked! + auto obj = intersection (s2,t2); + if(! obj){ + return boost::none; } - else if ( CGAL::assign(s2, obj) ) - { p2 = s2.source(); - q2 = s2.target(); - obj = make_object( Segment_3( - Point_3(p2.x(),0,p2.y()), Point_3(q2.x(),0,q2.y()) ) ); + if (const Point_2* pi = boost::get(&*obj)) + { + return boost::make_optional(variant_type(Point_3(p2.x(),0,p2.y()))); } - return obj; + + const Segment_2* si = boost::get(&*obj); + p2 = s2.source(); + q2 = s2.target(); + + return boost::make_optional(variant_type(Segment_3(Point_3(p2.x(),0,p2.y()), + Point_3(q2.x(),0,q2.y()) ) )); } }; @@ -72,7 +79,9 @@ struct Exact_intersect_xz_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - CGAL::Object operator() (Segment_3 s3, Segment_3 t3) + typedef boost::variant variant_type; + + boost::optional operator() (Segment_3 s3, Segment_3 t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -89,20 +98,24 @@ struct Exact_intersect_xz_2 // convert intersection from Object_2 to Object_3 // Note: there is not necessarily a spartial intersection, - // so all second components are faked! - CGAL::Object obj = intersection (s2,t2); - if ( CGAL::assign(p2, obj) ) - { obj = make_object (Point_3 (p2.hx(),0,p2.hy(),p2.hw())); + // so all third components are faked! + auto obj = intersection (s2,t2); + if(! obj){ + return boost::none; } - else if ( CGAL::assign(s2, obj) ) - { p2 = s2.source(); - q2 = s2.target(); - obj = make_object( Segment_3( - Point_3 (p2.hx(),0,p2.hy(),p2.hw()), - Point_3 (q2.hx(),0,q2.hy(),q2.hw()) ) ); + if (const Point_2* pi = boost::get(&*obj)) + { + return boost::make_optional(variant_type(Point_3(p2.hx(),0,p2.hy(),p2.hw()))); } - return obj; + + const Segment_2* si = boost::get(&*obj); + p2 = s2.source(); + q2 = s2.target(); + + return boost::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),0,p2.hy(),p2.hw()), + Point_3 (q2.hx(),0,q2.hy(),q2.hw())) )); } + }; template diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h index 9779a836401..2ff1f85a2c7 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h @@ -34,7 +34,10 @@ struct Exact_intersect_yz_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - CGAL::Object operator() (Segment_3 s3, Segment_3 t3) + typedef boost::variant variant_type; + + boost::optional + operator() (const Segment_3& s3, const Segment_3& t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -49,18 +52,22 @@ struct Exact_intersect_yz_2 // convert intersection from Object_2 to Object_3 // Note: there is not necessarily a spartial intersection, - // so all first components are faked! - CGAL::Object obj = intersection (s2,t2); - if ( CGAL::assign(p2, obj) ) - { obj = make_object (Point_3 (0,p2.x(),p2.y())); + // so all third components are faked! + auto obj = intersection (s2,t2); + if(! obj){ + return boost::none; } - else if ( CGAL::assign(s2, obj) ) - { p2 = s2.source(); - q2 = s2.target(); - obj = make_object( Segment_3( - Point_3(0,p2.x(),p2.y()), Point_3(0,q2.x(),q2.y()) ) ); + if (const Point_2* pi = boost::get(&*obj)) + { + return boost::make_optional(variant_type(Point_3(0,p2.x(),p2.y()))); } - return obj; + + const Segment_2* si = boost::get(&*obj); + p2 = s2.source(); + q2 = s2.target(); + + return boost::make_optional(variant_type(Segment_3(Point_3(0,p2.x(),p2.y()), + Point_3(0,q2.x(),q2.y()) ) )); } }; @@ -73,7 +80,9 @@ struct Exact_intersect_yz_2 typedef typename R::Point_3 Point_3; typedef typename R::Segment_3 Segment_3; - CGAL::Object operator() (Segment_3 s3, Segment_3 t3) + typedef boost::variant variant_type; + + boost::optional operator() (Segment_3 s3, Segment_3 t3) { Point_2 p2, q2; Point_3 p3, q3; @@ -90,19 +99,22 @@ struct Exact_intersect_yz_2 // convert intersection from Object_2 to Object_3 // Note: there is not necessarily a spartial intersection, - // so all first components are faked! - CGAL::Object obj = intersection (s2,t2); - if ( CGAL::assign(p2, obj) ) - { obj = make_object (Point_3 (0,p2.hx(),p2.hy(),p2.hw())); + // so all third components are faked! + auto obj = intersection (s2,t2); + if(! obj){ + return boost::none; } - else if ( CGAL::assign(s2, obj) ) - { p2 = s2.source(); - q2 = s2.target(); - obj = make_object( Segment_3( - Point_3 (0,p2.hx(),p2.hy(),p2.hw()), - Point_3 (0,q2.hx(),q2.hy(),q2.hw()) ) ); + if (const Point_2* pi = boost::get(&*obj)) + { + return boost::make_optional(variant_type(Point_3(0,p2.hx(),p2.hy(),p2.hw()))); } - return obj; + + const Segment_2* si = boost::get(&*obj); + p2 = s2.source(); + q2 = s2.target(); + + return boost::make_optional(variant_type(Segment_3(Point_3 (0,p2.hx(),p2.hy(),p2.hw()), + Point_3 (0,q2.hx(),q2.hy(),q2.hw())) )); } }; From 2b77481cd45d13db122da4b0291ed2068d053d50 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 7 Jan 2021 10:31:14 +0000 Subject: [PATCH 07/10] Move a typedef to where it is used --- Triangulation_2/include/CGAL/Constrained_triangulation_2.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h index 1d337cd3aaf..32317818174 100644 --- a/Triangulation_2/include/CGAL/Constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_triangulation_2.h @@ -1711,7 +1711,7 @@ compute_intersection(const Gt& gt, typename Gt::Point_2& pi) { typedef typename Gt::Point_2 Point_2; - typedef typename Gt::Segment_2 Segment_2; + typename Gt::Intersect_2 compute_intersec = gt.intersect_2_object(); typename Gt::Construct_segment_2 construct_segment = gt.construct_segment_2_object(); @@ -1721,6 +1721,7 @@ compute_intersection(const Gt& gt, #ifdef CGAL_CDT_2_DEBUG_INTERSECTIONS + typedef typename Gt::Segment_2 Segment_2; if(result){ if (const Segment_2* s = boost::get(&*result)){ std::cerr << CGAL::internal::cdt_2_indent_level From 8765c63e9cd23e0b91571932346446c4711b1c43 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 15 Jan 2021 07:55:27 +0000 Subject: [PATCH 08/10] bug fix --- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h | 4 ++-- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h | 4 ++-- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h index 4e84e3eebc7..9712a666403 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h @@ -110,8 +110,8 @@ struct Exact_intersect_xy_2 } const Segment_2* si = boost::get(&*obj); - p2 = s2.source(); - q2 = s2.target(); + p2 = si.source(); + q2 = si.target(); return boost::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),p2.hy(),0,p2.hw()), Point_3 (q2.hx(),q2.hy(),0,q2.hw())) )); diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h index 178b8b6ad2c..9b812d958b7 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h @@ -109,8 +109,8 @@ struct Exact_intersect_xz_2 } const Segment_2* si = boost::get(&*obj); - p2 = s2.source(); - q2 = s2.target(); + p2 = si.source(); + q2 = si.target(); return boost::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),0,p2.hy(),p2.hw()), Point_3 (q2.hx(),0,q2.hy(),q2.hw())) )); diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h index 2ff1f85a2c7..7180acbf1e8 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h @@ -110,8 +110,8 @@ struct Exact_intersect_yz_2 } const Segment_2* si = boost::get(&*obj); - p2 = s2.source(); - q2 = s2.target(); + p2 = si.source(); + q2 = si.target(); return boost::make_optional(variant_type(Segment_3(Point_3 (0,p2.hx(),p2.hy(),p2.hw()), Point_3 (0,q2.hx(),q2.hy(),q2.hw())) )); From 168631b069712863a8963fe69fac34fc321f2dcb Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 19 Jan 2021 09:28:57 +0000 Subject: [PATCH 09/10] fix . to -> --- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h | 4 ++-- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h | 4 ++-- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h index 9712a666403..2e37ff476c3 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h @@ -110,8 +110,8 @@ struct Exact_intersect_xy_2 } const Segment_2* si = boost::get(&*obj); - p2 = si.source(); - q2 = si.target(); + p2 = si->source(); + q2 = si->target(); return boost::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),p2.hy(),0,p2.hw()), Point_3 (q2.hx(),q2.hy(),0,q2.hw())) )); diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h index 9b812d958b7..9959db3355c 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h @@ -109,8 +109,8 @@ struct Exact_intersect_xz_2 } const Segment_2* si = boost::get(&*obj); - p2 = si.source(); - q2 = si.target(); + p2 = si->source(); + q2 = si->target(); return boost::make_optional(variant_type(Segment_3(Point_3 (p2.hx(),0,p2.hy(),p2.hw()), Point_3 (q2.hx(),0,q2.hy(),q2.hw())) )); diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h index 7180acbf1e8..13710cbebf5 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h @@ -110,8 +110,8 @@ struct Exact_intersect_yz_2 } const Segment_2* si = boost::get(&*obj); - p2 = si.source(); - q2 = si.target(); + p2 = si->source(); + q2 = si->target(); return boost::make_optional(variant_type(Segment_3(Point_3 (0,p2.hx(),p2.hy(),p2.hw()), Point_3 (0,q2.hx(),q2.hy(),q2.hw())) )); From 5ea5e93f4543dc688a3e54c43699dc208fe4ef8c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 20 Jan 2021 15:17:41 +0000 Subject: [PATCH 10/10] Fix warning --- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h | 4 ++-- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h | 4 ++-- .../CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h index 2e37ff476c3..99b71db68a1 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xy_3.h @@ -63,8 +63,8 @@ struct Exact_intersect_xy_2 } const Segment_2* si = boost::get(&*obj); - p2 = s2.source(); - q2 = s2.target(); + p2 = si->source(); + q2 = si->target(); return boost::make_optional(variant_type(Segment_3(Point_3(p2.x(),p2.y(),0), Point_3(q2.x(),q2.y(),0) ) )); diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h index 9959db3355c..7d77eaae669 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_xz_3.h @@ -62,8 +62,8 @@ struct Exact_intersect_xz_2 } const Segment_2* si = boost::get(&*obj); - p2 = s2.source(); - q2 = s2.target(); + p2 = si->source(); + q2 = si->target(); return boost::make_optional(variant_type(Segment_3(Point_3(p2.x(),0,p2.y()), Point_3(q2.x(),0,q2.y()) ) )); diff --git a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h index 13710cbebf5..a98b74fd144 100644 --- a/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h +++ b/Nef_3/include/CGAL/Nef_3/Exact_triangulation_euclidean_traits_yz_3.h @@ -63,8 +63,8 @@ struct Exact_intersect_yz_2 } const Segment_2* si = boost::get(&*obj); - p2 = s2.source(); - q2 = s2.target(); + p2 = si->source(); + q2 = si->target(); return boost::make_optional(variant_type(Segment_3(Point_3(0,p2.x(),p2.y()), Point_3(0,q2.x(),q2.y()) ) ));