From 5b6df813f54acd4c01c13ed50259ee43267236ca Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sat, 6 Sep 2025 20:41:49 +0300 Subject: [PATCH] Fixed do_intersect() and cleaned up --- .../Arr_do_intersect_overlay_ss_visitor.h | 10 +- ...Arr_no_intersection_insertion_ss_visitor.h | 85 ++++------ .../Surface_sweep_2/Arr_overlay_ss_visitor.h | 4 +- .../Gps_do_intersect_agg_op_visitor.h | 15 +- .../Gps_on_surface_base_2.h | 18 +- .../test_do_intersect_circles.cpp | 95 +++++++++++ .../Surface_sweep_2/Default_visitor_base.h | 36 ++-- .../Do_interior_intersect_visitor.h | 44 +++-- .../Surface_sweep_2/Surface_sweep_2_impl.h | 158 ++++++------------ 9 files changed, 250 insertions(+), 215 deletions(-) create mode 100644 Boolean_set_operations_2/test/Boolean_set_operations_2/test_do_intersect_circles.cpp diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_do_intersect_overlay_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_do_intersect_overlay_ss_visitor.h index 8ef971ec5c7..105e42ea513 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_do_intersect_overlay_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_do_intersect_overlay_ss_visitor.h @@ -40,7 +40,6 @@ class Arr_do_intersect_overlay_ss_visitor : OverlayHelper, OverlayTraits, typename Default::Get >::type> { - private: using Overlay_helper = OverlayHelper; using Overlay_traits = OverlayTraits; @@ -61,6 +60,7 @@ public: using Status_line_iterator = typename Base::Status_line_iterator; using X_monotone_curve_2 = typename Base::X_monotone_curve_2; using Point_2 = typename Base::Point_2; + using Multiplicity = typename Base::Multiplicity; /*! Constructor */ Arr_do_intersect_overlay_ss_visitor(const Arrangement_red_2* red_arr, @@ -90,11 +90,15 @@ public: void update_event(Event* e, Subcurve* sc) { return Base::update_event(e, sc); } /*! Update an event that corresponds to an intersection between curves */ - void update_event(Event*, Subcurve*, Subcurve*, bool is_new) { m_found_x = true; } + void update_event(Event* e, Subcurve* sc1, Subcurve* sc2, bool is_new, Multiplicity multiplicity) { + if ((multiplicity % 2) == 1) m_found_x = true; + Base::update_event(e, sc1, sc2, is_new, multiplicity); + } bool after_handle_event(Event* e, Status_line_iterator iter, bool flag) { + auto res = Base::after_handle_event(e, iter, flag); if (m_found_x) this->surface_sweep()->stop_sweep(); - return Base::after_handle_event(e, iter, flag); + return res; } /*! Getter */ diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h index e82e28b3164..8e2ed4ef9b5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h @@ -8,9 +8,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s): Baruch Zukerman -// Ron Wein -// Efi Fogel +// Author(s) : Baruch Zukerman +// Ron Wein +// Efi Fogel #ifndef CGAL_ARR_NO_INTERSECTION_INSERTION_SS_VISITOR_H #define CGAL_ARR_NO_INTERSECTION_INSERTION_SS_VISITOR_H @@ -42,35 +42,33 @@ class Arr_no_intersection_insertion_ss_visitor : public Arr_construction_ss_visitor< Helper_, typename Default::Get >::type> -{ + Helper_, Visitor_> >::type> { public: - typedef Helper_ Helper; + using Helper = Helper_; - typedef typename Helper::Geometry_traits_2 Geometry_traits_2; - typedef typename Helper::Event Event; - typedef typename Helper::Subcurve Subcurve; + using Geometry_traits_2 = typename Helper::Geometry_traits_2; + using Event = typename Helper::Event; + using Subcurve = typename Helper::Subcurve; private: - typedef Geometry_traits_2 Gt2; - typedef Arr_no_intersection_insertion_ss_visitor - Self; - typedef typename Default::Get::type Visitor; - typedef Arr_construction_ss_visitor Base; + using Gt2 = Geometry_traits_2; + using Self = Arr_no_intersection_insertion_ss_visitor; + using Visitor = typename Default::Get::type; + using Base = Arr_construction_ss_visitor; public: - typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Gt2::Point_2 Point_2; + using X_monotone_curve_2 = typename Gt2::X_monotone_curve_2; + using Point_2 = typename Gt2::Point_2; + using Multiplicity = typename Gt2::Multiplicity; protected: - typedef typename Subcurve::Status_line_iterator Status_line_iterator; - typedef typename Base::Event_subcurve_reverse_iterator - Event_subcurve_reverse_iterator; + using Status_line_iterator = typename Subcurve::Status_line_iterator; + using Event_subcurve_reverse_iterator = typename Base::Event_subcurve_reverse_iterator; - typedef typename Helper::Arrangement_2 Arrangement_2; - typedef typename Arrangement_2::Vertex_handle Vertex_handle; - typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; - typedef typename Arrangement_2::Face_handle Face_handle; + using Arrangement_2 = typename Helper::Arrangement_2; + using Vertex_handle = typename Arrangement_2::Vertex_handle; + using Halfedge_handle = typename Arrangement_2::Halfedge_handle; + using Face_handle = typename Arrangement_2::Face_handle; public: /*! Constructor. */ @@ -103,13 +101,12 @@ public: {} void update_event(Event* /* e */, Subcurve* /* sc1 */, Subcurve* /* sc2 */, - bool /* is_new */) + bool /* is_new */, Multiplicity /* multiplicity */) {} void update_event(Event* /* e */, Subcurve* /* sc1 */) {} - void update_event(Event* e, const Point_2& pt, bool /* is_new */) - { + void update_event(Event* e, const Point_2& pt, bool /* is_new */) { Vertex_handle invalid_v; if (e->point().vertex_handle() == invalid_v) e->point().set_vertex_handle(pt.vertex_handle()); @@ -241,8 +238,7 @@ void Arr_no_intersection_insertion_ss_visitor::before_sweep() // template void Arr_no_intersection_insertion_ss_visitor:: -before_handle_event(Event* event) -{ +before_handle_event(Event* event) { // First we notify the helper class on the event. this->m_helper.before_handle_event(event); @@ -330,8 +326,7 @@ before_handle_event(Event* event) // template bool Arr_no_intersection_insertion_ss_visitor:: -add_subcurve_(const X_monotone_curve_2& cv, Subcurve* sc) -{ +add_subcurve_(const X_monotone_curve_2& cv, Subcurve* sc) { const Halfedge_handle invalid_he; if (cv.halfedge_handle() != invalid_he) return false; // Insert the curve into the arrangement @@ -344,8 +339,7 @@ add_subcurve_(const X_monotone_curve_2& cv, Subcurve* sc) // template void Arr_no_intersection_insertion_ss_visitor:: -add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) -{ +add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) { if (add_subcurve_(cv, sc)) return; Halfedge_handle next_ccw_he = @@ -359,8 +353,7 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc) template typename Arr_no_intersection_insertion_ss_visitor::Halfedge_handle Arr_no_intersection_insertion_ss_visitor:: -insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) -{ +insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) { Event* last_event = this->last_event_on_subcurve(sc); Vertex_handle last_v = last_event->point().vertex_handle(); Vertex_handle curr_v = this->current_event()->point().vertex_handle(); @@ -385,8 +378,7 @@ template typename Arr_no_intersection_insertion_ss_visitor::Halfedge_handle Arr_no_intersection_insertion_ss_visitor:: insert_from_left_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, - Subcurve* sc) -{ + Subcurve* sc) { Vertex_handle curr_v = this->current_event()->point().vertex_handle(); if (curr_v != Vertex_handle()) return (this->m_arr->insert_at_vertices(cv.base(), he, curr_v)); @@ -400,8 +392,7 @@ template typename Arr_no_intersection_insertion_ss_visitor::Halfedge_handle Arr_no_intersection_insertion_ss_visitor:: insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle he, - Subcurve* sc) -{ + Subcurve* sc) { Event* last_event = this->last_event_on_subcurve(sc); Vertex_handle last_v = last_event->point().vertex_handle(); if (last_v != Vertex_handle()) @@ -426,8 +417,7 @@ insert_at_vertices(const X_monotone_curve_2& cv, template typename Arr_no_intersection_insertion_ss_visitor::Vertex_handle Arr_no_intersection_insertion_ss_visitor:: -insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter) -{ +insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter) { // If the isolated vertex is already at the arrangement, return: if (pt.vertex_handle() != Vertex_handle()) return Vertex_handle(); @@ -443,8 +433,7 @@ insert_isolated_vertex(const Point_2& pt, Status_line_iterator iter) template typename Arr_no_intersection_insertion_ss_visitor::Halfedge_handle Arr_no_intersection_insertion_ss_visitor:: -_insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) -{ +_insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc) { // Check if the vertex to be associated with the left end of the curve has // already been created. Event* last_event = this->last_event_on_subcurve(sc); @@ -514,8 +503,7 @@ template typename Arr_no_intersection_insertion_ss_visitor::Halfedge_handle Arr_no_intersection_insertion_ss_visitor:: _insert_from_left_vertex(const X_monotone_curve_2& cv, - Halfedge_handle prev, Subcurve* sc) -{ + Halfedge_handle prev, Subcurve* sc) { // Check if the vertex to be associated with the right end of the curve has // already been created. Event* curr_event = this->current_event(); @@ -551,8 +539,7 @@ template typename Arr_no_intersection_insertion_ss_visitor::Halfedge_handle Arr_no_intersection_insertion_ss_visitor:: _insert_from_right_vertex(const X_monotone_curve_2& cv, Halfedge_handle prev, - Subcurve* sc) -{ + Subcurve* sc) { // Check if the vertex to be associated with the left end of the curve has // already been created. Event* last_event = this->last_event_on_subcurve(sc); @@ -589,8 +576,7 @@ typename Arr_no_intersection_insertion_ss_visitor::Halfedge_handle Arr_no_intersection_insertion_ss_visitor:: _insert_at_vertices(const X_monotone_curve_2& cv, Halfedge_handle prev1, Halfedge_handle prev2, - Subcurve* sc, bool& new_face_created) -{ + Subcurve* sc, bool& new_face_created) { // Perform the insertion. new_face_created = false; bool swapped_predecessors = false; @@ -632,8 +618,7 @@ _insert_at_vertices(const X_monotone_curve_2& cv, template typename Arr_no_intersection_insertion_ss_visitor::Face_handle Arr_no_intersection_insertion_ss_visitor:: -_ray_shoot_up(Status_line_iterator iter) -{ +_ray_shoot_up(Status_line_iterator iter) { // Go up the status line and try to locate a curve which is associated // with a valid arrangement halfedge. const Halfedge_handle invalid_he; diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h index 2d10d616f74..6c3cea30646 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_overlay_ss_visitor.h @@ -71,6 +71,7 @@ private: public: using X_monotone_curve_2 = typename Gt2::X_monotone_curve_2; using Point_2 = typename Gt2::Point_2; + using Multiplicity = typename Gt2::Multiplicity; // The input arrangements (the "red" and the "blue" one): using Halfedge_handle_red = typename Ar2::Halfedge_const_handle; @@ -182,7 +183,8 @@ public: void update_event(Event* /* e */, Subcurve* /* c1 */, Subcurve* /* c2 */, - bool CGAL_assertion_code(is_new)) + bool CGAL_assertion_code(is_new), + Multiplicity /* multiplicity */) { CGAL_assertion(is_new == true); } /*! Update an event. */ diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_do_intersect_agg_op_visitor.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_do_intersect_agg_op_visitor.h index 0e11afafa7e..b81334bf978 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_do_intersect_agg_op_visitor.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_do_intersect_agg_op_visitor.h @@ -48,6 +48,7 @@ public: using Status_line_iterator = typename Base::Status_line_iterator; using X_monotone_curve_2 = typename Base::X_monotone_curve_2; using Point_2 = typename Base::Point_2; + using Multiplicity = typename Base::Multiplicity; Gps_do_intersect_agg_op_visitor(Arr* arr, Edges_hash* hash, std::vector* vertices_vec) : @@ -57,22 +58,26 @@ public: /*! Update an event that corresponds to a curve endpoint. */ void update_event(Event* e, const Point_2& end_point, const X_monotone_curve_2& cv, Arr_curve_end cv_end, bool is_new) - { return Base::update_event(e, end_point, cv, cv_end, is_new); } + { Base::update_event(e, end_point, cv, cv_end, is_new); } /*! Update an event that corresponds to a curve endpoint */ void update_event(Event* e, const X_monotone_curve_2& cv, Arr_curve_end cv_end, bool is_new ) - { return Base::update_event(e, cv, cv_end, is_new); } + { Base::update_event(e, cv, cv_end, is_new); } /*! Update an event that corresponds to a curve endpoint */ void update_event(Event* e, const Point_2& p, bool is_new) - { return Base::update_event(e, p, is_new); } + { Base::update_event(e, p, is_new); } /*! Update an event that corresponds to an intersection */ - void update_event(Event* e, Subcurve* sc) { return Base::update_event(e, sc); } + void update_event(Event* e, Subcurve* sc) { Base::update_event(e, sc); } /*! Update an event that corresponds to an intersection between curves */ - void update_event(Event*, Subcurve*, Subcurve*, bool is_new) { m_found_x = true; } + void update_event(Event* e, Subcurve* sc1, Subcurve* sc2, bool is_new, Multiplicity multiplicity) { + if ((multiplicity % 2) == 1) m_found_x = true; + Base::update_event(e, sc1, sc2, is_new, multiplicity); + } + //! bool after_handle_event(Event* e, Status_line_iterator iter, bool flag) { auto res = Base::after_handle_event(e, iter, flag); if (m_found_x) this->surface_sweep()->stop_sweep(); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h index 1571480afe2..664ef383702 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h @@ -539,9 +539,10 @@ public: _remove_redundant_edges(arr_vec[0].first); _reset_faces(arr_vec[0].first); - return (_is_empty(arr_vec[0].first)); + return ! _is_empty(arr_vec[0].first); } + //! template bool do_intersect(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, @@ -550,6 +551,7 @@ public: return other._do_intersect(begin1, end1, begin2, end2, k); } + //! template bool _do_intersect(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, InputIterator2 end2, @@ -558,13 +560,13 @@ public: arr_vec[0].first = this->m_arr; std::size_t i = 1; - for (InputIterator1 itr1 = begin1; itr1 != end1; ++itr1, ++i) { + for (auto itr1 = begin1; itr1 != end1; ++itr1, ++i) { ValidationPolicy::is_valid(*itr1, *m_traits); arr_vec[i].first = new Aos_2(m_traits); _insert(*itr1, *(arr_vec[i].first)); } - for (InputIterator2 itr2 = begin2; itr2 != end2; ++itr2, ++i) { + for (auto itr2 = begin2; itr2 != end2; ++itr2, ++i) { ValidationPolicy::is_valid(*itr2,*m_traits); arr_vec[i].first = new Aos_2(m_traits); _insert(*itr2, *(arr_vec[i].first)); @@ -586,7 +588,7 @@ public: _remove_redundant_edges(arr_vec[0].first); _reset_faces(arr_vec[0].first); - return (_is_empty(arr_vec[0].first)); + return ! _is_empty(arr_vec[0].first); } // joins a range of polygons @@ -705,7 +707,6 @@ public: // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; - std::cout << "XXXX 1 no. faces: " << m_arr->number_of_faces() << "\n"; } // intersects a range of polygons with holes @@ -728,7 +729,6 @@ public: // the result arrangement is at index 0 this->m_arr = arr_vec[0].first; delete arr_vec[0].second; - std::cout << "XXXX 2 no. edges: " << m_arr->number_of_edges() << "\n"; } template @@ -1267,9 +1267,9 @@ protected: std::vector& arr_vec, std::size_t k, Merge merge_func) { static int indent = 0; - std::cout << std::setw(indent) << "" << "D&C [" << lower << "," << upper << "," << k << "]\n"; + // std::cout << std::setw(indent) << "" << "D&C [" << lower << "," << upper << "," << k << "]\n"; if ((upper - lower) < k) { - std::cout << std::setw(indent) << "" << "Merging [" << lower << "," << upper << "," << 1 << "]\n"; + // std::cout << std::setw(indent) << "" << "Merging [" << lower << "," << upper << "," << 1 << "]\n"; _build_sorted_vertices_vectors(lower, upper, arr_vec); merge_func(lower, upper, 1, arr_vec); return; @@ -1286,7 +1286,7 @@ protected: indent += 2; _divide_and_conquer(curr_lower, upper, arr_vec, k, merge_func); indent -= 2; - std::cout << std::setw(indent) << "" << "Merging [" << lower << "," << curr_lower << "," << sub_size << "]\n"; + // std::cout << std::setw(indent) << "" << "Merging [" << lower << "," << curr_lower << "," << sub_size << "]\n"; merge_func(lower, curr_lower, sub_size, arr_vec); } diff --git a/Boolean_set_operations_2/test/Boolean_set_operations_2/test_do_intersect_circles.cpp b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_do_intersect_circles.cpp new file mode 100644 index 00000000000..2664840edd8 --- /dev/null +++ b/Boolean_set_operations_2/test/Boolean_set_operations_2/test_do_intersect_circles.cpp @@ -0,0 +1,95 @@ +#include + +#include +#include +#include +#include +#include +// #include + +using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; +using Point_2 = Kernel::Point_2; +using Polygon_2 = CGAL::Polygon_2; +using Circle_2 = Kernel::Circle_2; + +int main(int argc, char* argv[]) { + Kernel kernel; + auto ctr_circle = kernel.construct_circle_2_object(); + auto circle1 = ctr_circle(Point_2(0, 1), 1); + auto circle2 = ctr_circle(Point_2(0, -1), 1); + auto circle3 = ctr_circle(Point_2(0, 2), 4); + + // 1. Circular arcs and linear segments + using Circle_segment_arr_traits_2 = CGAL::Arr_circle_segment_traits_2; + using Circle_segment_xcv_2 = Circle_segment_arr_traits_2::X_monotone_curve_2; + using Circle_segment_pnt_2 = Circle_segment_arr_traits_2::Point_2; + using Circle_segment_gps_traits_2 = CGAL::Gps_traits_2; + using Circle_segment_polygon = Circle_segment_gps_traits_2::General_polygon_2; + using Circle_segment_polygon_with_holes = Circle_segment_gps_traits_2::General_polygon_with_holes_2; + + Circle_segment_arr_traits_2 circle_segment_traits; + + Circle_segment_pnt_2 cs_pnt11(1, 1); + Circle_segment_pnt_2 cs_pnt12(-1, 1); + Circle_segment_xcv_2 xcv11(circle1, cs_pnt11, cs_pnt12, CGAL::COUNTERCLOCKWISE); + Circle_segment_xcv_2 xcv12(circle1, cs_pnt12, cs_pnt11, CGAL::COUNTERCLOCKWISE); + Circle_segment_polygon pgn1; + pgn1.push_back(xcv11); + pgn1.push_back(xcv12); + + Circle_segment_pnt_2 cs_pnt21(1, -1); + Circle_segment_pnt_2 cs_pnt22(-1, -1); + Circle_segment_xcv_2 xcv21(circle2, cs_pnt21, cs_pnt22, CGAL::COUNTERCLOCKWISE); + Circle_segment_xcv_2 xcv22(circle2, cs_pnt22, cs_pnt21, CGAL::COUNTERCLOCKWISE); + Circle_segment_polygon pgn2; + pgn2.push_back(xcv21); + pgn2.push_back(xcv22); + + Circle_segment_pnt_2 cs_pnt31(2, 2); + Circle_segment_pnt_2 cs_pnt32(-2, 2); + Circle_segment_xcv_2 xcv31(circle3, cs_pnt31, cs_pnt32, CGAL::COUNTERCLOCKWISE); + Circle_segment_xcv_2 xcv32(circle3, cs_pnt32, cs_pnt31, CGAL::COUNTERCLOCKWISE); + Circle_segment_polygon pgn3; + pgn3.push_back(xcv31); + pgn3.push_back(xcv32); + + // 1.1. + auto do_intersect = CGAL::do_intersect(pgn1, pgn2); + if (do_intersect) { + std::cerr << "The circles intersect (case 1)\n" << std::endl; + return 1; + } + + // 1.2. + std::vector pgns1 = { pgn1, pgn2 }; + do_intersect = CGAL::do_intersect(pgns1.begin(), pgns1.end()); + if (do_intersect) { + std::cerr << "The circles intersect (case 2)\n" << std::endl; + return 1; + } + + // 2.1. + do_intersect = CGAL::do_intersect(pgn1, pgn3); + if (! do_intersect) { + std::cerr << "The circles do not intersect (case 1)\n" << std::endl; + return 1; + } + + // 2.2. + std::vector pgns2 = { pgn1, pgn3 }; + do_intersect = CGAL::do_intersect(pgns2.begin(), pgns2.end()); + if (! do_intersect) { + std::cerr << "The circles do not intersect (case 2)\n" << std::endl; + return 1; + } + + // using Circle_segment_arr = CGAL::Arrangement_2; + // Circle_segment_arr arr; + // CGAL::insert_non_intersecting_curve(arr, xcv11); + // CGAL::insert_non_intersecting_curve(arr, xcv12); + // CGAL::insert_non_intersecting_curve(arr, xcv21); + // CGAL::insert_non_intersecting_curve(arr, xcv22); + // CGAL::draw(arr); + + return 0; +} diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_visitor_base.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_visitor_base.h index 441e9682488..c3930e490a5 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_visitor_base.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Default_visitor_base.h @@ -7,8 +7,8 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Baruch Zukerman -// Efi Fogel +// Author(s) : Baruch Zukerman +// Efi Fogel #ifndef CGAL_SURFACE_SWEEP_2_DEFAULT_VISITOR_BASE_H #define CGAL_SURFACE_SWEEP_2_DEFAULT_VISITOR_BASE_H @@ -50,28 +50,27 @@ template class Default_visitor_base { public: - typedef GeometryTraits_2 Geometry_traits_2; - typedef Event_ Event; - typedef Subcurve_ Subcurve; - typedef Allocator_ Allocator; - typedef Visitor_ Visitor; + using Geometry_traits_2 = GeometryTraits_2; + using Event = Event_; + using Subcurve = Subcurve_; + using Allocator = Allocator_; + using Visitor = Visitor_; private: - typedef Geometry_traits_2 Gt2; - typedef Default_visitor_base - Self; + using Gt2 = Geometry_traits_2; + using Self = Default_visitor_base; public: - typedef typename Subcurve::Status_line_iterator Status_line_iterator; + using Status_line_iterator = typename Subcurve::Status_line_iterator; - typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Gt2::Point_2 Point_2; + using X_monotone_curve_2 = typename Gt2::X_monotone_curve_2; + using Point_2 = typename Gt2::Point_2; + using Multiplicity = typename Gt2::Multiplicity; - typedef typename Event::Subcurve_iterator Event_subcurve_iterator; - typedef typename Event::Subcurve_reverse_iterator - Event_subcurve_reverse_iterator; + using Event_subcurve_iterator = typename Event::Subcurve_iterator; + using Event_subcurve_reverse_iterator = typename Event::Subcurve_reverse_iterator; - typedef No_intersection_surface_sweep_2 Surface_sweep_2; + using Surface_sweep_2 = No_intersection_surface_sweep_2; protected: // Data members: @@ -134,7 +133,8 @@ public: void update_event(Event* /* e */, Subcurve* /* sc1 */, Subcurve* /* sc2 */, - bool /* is_new */) + bool /* is_new */, + Multiplicity /* multiplicity */) {} /*! Update the event. */ diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Do_interior_intersect_visitor.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Do_interior_intersect_visitor.h index ebdd0331c8e..b522b768c9d 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Do_interior_intersect_visitor.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Do_interior_intersect_visitor.h @@ -7,9 +7,9 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Baruch Zukerman -// Ron Wein -// Efi Fogel +// Author(s) : Baruch Zukerman +// Ron Wein +// Efi Fogel #ifndef CGAL_SURFACE_SWEEP_2_DO_INTERIOR_INTERSECT_VISITORS_H #define CGAL_SURFACE_SWEEP_2_DO_INTERIOR_INTERSECT_VISITORS_H @@ -39,27 +39,27 @@ template , - GeometryTraits_2, Allocator_> -{ + GeometryTraits_2, Allocator_> { public: - typedef GeometryTraits_2 Geometry_traits_2; - typedef Allocator_ Allocator; + using Geometry_traits_2 = GeometryTraits_2; + using Allocator = Allocator_; private: - typedef Geometry_traits_2 Gt2; - typedef Do_interior_intersect_visitor Self; - typedef Default_visitor Base; + using Gt2 = Geometry_traits_2; + using Self = Do_interior_intersect_visitor; + using Base = Default_visitor; public: - typedef typename Base::Event Event; - typedef typename Base::Subcurve Subcurve; + using Event = typename Base::Event; + using Subcurve = typename Base::Subcurve; - typedef typename Subcurve::Status_line_iterator Status_line_iterator; + using Status_line_iterator = typename Subcurve::Status_line_iterator; - typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Gt2::Point_2 Point_2; + using X_monotone_curve_2 = typename Gt2::X_monotone_curve_2; + using Point_2 = typename Gt2::Point_2; + using Multiplicity = typename Gt2::Multiplicity; - typedef typename Base::Surface_sweep_2 Surface_sweep_2; + using Surface_sweep_2 = typename Base::Surface_sweep_2; protected: // Data members: @@ -69,8 +69,7 @@ public: Do_interior_intersect_visitor() : m_found_x(false) {} template - void sweep(CurveIterator begin, CurveIterator end) - { + void sweep(CurveIterator begin, CurveIterator end) { std::vector curves_vec; std::vector points_vec; @@ -89,7 +88,8 @@ public: void update_event(Event* /* e */, Subcurve* /* sc1 */, Subcurve* /* sc2 */, - bool /* is_new */) + bool /* is_new */, + Multiplicity multiplicity = 0) { m_found_x = true; } void update_event(Event* /* e */, @@ -115,8 +115,7 @@ public: {} template - void sweep_xcurves(XCurveIterator begin, XCurveIterator end) - { + void sweep_xcurves(XCurveIterator begin, XCurveIterator end) { // Perform the sweep. Surface_sweep_2* sl = this->surface_sweep(); sl->sweep(begin, end); @@ -129,8 +128,7 @@ public: bool after_handle_event(Event* /* event */, Status_line_iterator /* iter */, - bool /* flag */) - { + bool /* flag */) { if (m_found_x) { Surface_sweep_2* sl = this->surface_sweep(); sl->stop_sweep(); diff --git a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h index df7bd3a5510..3193f48e75b 100644 --- a/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h +++ b/Surface_sweep_2/include/CGAL/Surface_sweep_2/Surface_sweep_2_impl.h @@ -7,9 +7,9 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Baruch Zukerman -// Efi Fogel -// (based on old version by Tali Zvi) +// Author(s) : Baruch Zukerman +// Efi Fogel +// (based on a previous version developed by Tali Zvi) #ifndef CGAL_SURFACE_SWEEP_2_IMPL_H #define CGAL_SURFACE_SWEEP_2_IMPL_H @@ -33,8 +33,7 @@ namespace Surface_sweep_2 { // Initialize the data structures for the sweep-line algorithm. // template -void Surface_sweep_2::_init_structures() -{ +void Surface_sweep_2::_init_structures() { // Initialize the structures maintained by the base sweep-line class. Base::_init_structures(); } @@ -43,8 +42,7 @@ void Surface_sweep_2::_init_structures() // Complete the sweep (complete the data structures). // template -void Surface_sweep_2::_complete_sweep() -{ +void Surface_sweep_2::_complete_sweep() { CGAL_SS_PRINT_START_EOL("completing the sweep"); // Complete the sweep process using base sweep-line class. @@ -68,8 +66,7 @@ void Surface_sweep_2::_complete_sweep() // Handle the subcurves to the left of the current event point. // template -void Surface_sweep_2::_handle_left_curves() -{ +void Surface_sweep_2::_handle_left_curves() { CGAL_SS_PRINT_START("handling left curves at ("); CGAL_SS_DEBUG(this->PrintEvent(this->m_currentEvent)); CGAL_SS_PRINT_TEXT(")"); @@ -189,14 +186,12 @@ void Surface_sweep_2::_handle_left_curves() // and with a left end not being the current event // template -void Surface_sweep_2::_clip_non_active_curve_at_current_event(Subcurve* subcurve) -{ +void Surface_sweep_2::_clip_non_active_curve_at_current_event(Subcurve* subcurve) { // ignore active curve (will be split at intersection point) if (subcurve->hint() != this->m_statusLine.end() && subcurve->hint() != Status_line_iterator() ) return; - if (!subcurve->is_start_point(this->m_currentEvent)) - { + if (! subcurve->is_start_point(this->m_currentEvent)) { CGAL_SS_PRINT_TEXT("Splitting "); CGAL_SS_PRINT_CURVE(subcurve); CGAL_SS_PRINT_EOL(); @@ -215,13 +210,11 @@ void Surface_sweep_2::_clip_non_active_curve_at_current_event(Subcurve* sub // Handle the overlaps between subcurves to the right of the current event point. // template -void Surface_sweep_2::_handle_overlaps_in_right_curves() -{ - const std::vector< std::pair >& subcurve_pairs - = this->m_currentEvent->overlaps_on_right; +void Surface_sweep_2::_handle_overlaps_in_right_curves() { + const std::vector< std::pair >& subcurve_pairs = + this->m_currentEvent->overlaps_on_right; - if (!subcurve_pairs.empty()) - { + if (!subcurve_pairs.empty()) { // handling overlaps on the right of the current event. // Only one curve from the overlapping curve is currently // in the right curves of the event. Other curve overlapping @@ -240,11 +233,10 @@ void Surface_sweep_2::_handle_overlaps_in_right_curves() // in the following map having a curve on the right of the event // as key, we get all the curves that overlap with that curve // on the right of the event - typedef std::map > Subcurve_map; + typedef std::map> Subcurve_map; Subcurve_map tests_per_subcurve_on_right; - for (std::size_t i=0; i::_handle_overlaps_in_right_curves() tests_per_subcurve_on_right[subcurve_pairs[i].first].push_back(subcurve_pairs[i].second); } - for(typename Subcurve_map::iterator it = tests_per_subcurve_on_right.begin(), - end = tests_per_subcurve_on_right.end(); it!=end; ++it) - { + for (auto it = tests_per_subcurve_on_right.begin(), end = tests_per_subcurve_on_right.end(); it != end; ++it) { std::size_t nbc = it->second.size(); // remove possible duplicates - if (nbc>1) - { + if (nbc > 1) { std::sort(it->second.begin(), it->second.end()); typename std::vector::iterator last = std::unique(it->second.begin(), it->second.end()); @@ -277,8 +266,7 @@ void Surface_sweep_2::_handle_overlaps_in_right_curves() else{ // get the curve just after the key in the sorted set of curves on the right as it might be replaced Subcurve_iterator next_after = this->m_currentEvent->get_curve_after_on_right(it->first); - for (std::size_t i=0; isecond[i], *std::prev(next_after), this->m_currentEvent); CGAL_assertion(it->second.size()==nbc); // make sure the container was not updated } @@ -289,27 +277,19 @@ void Surface_sweep_2::_handle_overlaps_in_right_curves() } // split curves not already split. TODO: this should be done above? - for (Event_subcurve_iterator subcurve_it = this->m_currentEvent->right_curves_begin(); - subcurve_it != this->m_currentEvent->right_curves_end(); - ++subcurve_it) - { + for (auto subcurve_it = this->m_currentEvent->right_curves_begin(); + subcurve_it != this->m_currentEvent->right_curves_end(); ++subcurve_it) _clip_non_active_curve_at_current_event(*subcurve_it); - } } //----------------------------------------------------------------------------- // Handle the subcurves to the right of the current event point. // template -void Surface_sweep_2::_handle_right_curves() -{ - - for(Event_subcurve_iterator sc_it = this->m_currentEvent->right_curves_begin(), - sc_it_end = this->m_currentEvent->right_curves_end(); - sc_it!=sc_it_end; ++sc_it) - { +void Surface_sweep_2::_handle_right_curves() { + for (auto sc_it = this->m_currentEvent->right_curves_begin(), sc_it_end = this->m_currentEvent->right_curves_end(); + sc_it != sc_it_end; ++sc_it) (*sc_it)->reset_left_event(); - } CGAL_SS_PRINT_START("handling right curves at ("); CGAL_SS_DEBUG(this->PrintEvent(this->m_currentEvent)); @@ -329,15 +309,11 @@ void Surface_sweep_2::_handle_right_curves() // - We also check to see if the two intersect again to the right of the // point. - Event_subcurve_iterator currentOne = - this->m_currentEvent->right_curves_begin(); - Event_subcurve_iterator rightCurveEnd = - this->m_currentEvent->right_curves_end(); + Event_subcurve_iterator currentOne = this->m_currentEvent->right_curves_begin(); + Event_subcurve_iterator rightCurveEnd = this->m_currentEvent->right_curves_end(); CGAL_SS_PRINT_INSERT(*currentOne); - Status_line_iterator slIter = - this->m_statusLine.insert_before(this->m_status_line_insert_hint, - *currentOne); + Status_line_iterator slIter = this->m_statusLine.insert_before(this->m_status_line_insert_hint, *currentOne); Subcurve* sc = *currentOne; sc->set_hint(slIter); @@ -352,8 +328,7 @@ void Surface_sweep_2::_handle_right_curves() ++currentOne; while (currentOne != rightCurveEnd) { CGAL_SS_PRINT_INSERT(*currentOne); - slIter = this->m_statusLine.insert_before(this->m_status_line_insert_hint, - *currentOne); + slIter = this->m_statusLine.insert_before(this->m_status_line_insert_hint, *currentOne); Subcurve* sc = *currentOne; sc->set_hint(slIter); @@ -390,12 +365,8 @@ bool Surface_sweep_2::_add_curve_to_right(Event* event, Subcurve* curve) CGAL_SS_PRINT_CURVE(curve); CGAL_SS_PRINT_EOL(); - Event_subcurve_iterator iter; - for (iter = event->right_curves_begin(); iter != event->right_curves_end(); - ++iter) - { - if (*iter == curve) - { + for (auto iter = event->right_curves_begin(); iter != event->right_curves_end(); ++iter) { + if (*iter == curve) { CGAL_SS_PRINT_END_EOL("adding a Curve to the right (curve exists)"); return false; } @@ -405,8 +376,7 @@ bool Surface_sweep_2::_add_curve_to_right(Event* event, Subcurve* curve) if ((*iter)->are_all_leaves_contained(curve)) { CGAL_SS_PRINT_END_EOL("adding a Curve to the right (containing curve exists)"); - if ( (*iter)->right_event() != curve->right_event() ) - { + if ((*iter)->right_event() != curve->right_event()) { CGAL_assertion( this->m_queueEventLess((*iter)->right_event(), curve->right_event()) == SMALLER ); // subcurve has to end before _add_curve_to_right( (*iter)->right_event(), curve); // WARNING recursive } @@ -417,8 +387,7 @@ bool Surface_sweep_2::_add_curve_to_right(Event* event, Subcurve* curve) } if (curve->are_all_leaves_contained(*iter)) { - if ( (*iter)->right_event() != curve->right_event() ) - { + if ( (*iter)->right_event() != curve->right_event()) { CGAL_assertion(this->m_queueEventLess(curve->right_event(), (*iter)->right_event()) == SMALLER); // subcurve has to end before _add_curve_to_right( curve->right_event(), *iter); // WARNING recursive } @@ -426,8 +395,7 @@ bool Surface_sweep_2::_add_curve_to_right(Event* event, Subcurve* curve) (*iter)->right_event()->remove_curve_from_left(*iter); *iter = curve; // replace the current curve with the new one. - CGAL_SS_PRINT_END_EOL - ("replacing a Curve to the right (curve partially overlaps)"); + CGAL_SS_PRINT_END_EOL("replacing a Curve to the right (curve partially overlaps)"); return false; } @@ -443,11 +411,10 @@ bool Surface_sweep_2::_add_curve_to_right(Event* event, Subcurve* curve) } // a new overlap needs to be computed - if (event!=this->m_currentEvent) + if (event != this->m_currentEvent) event->overlaps_on_right.push_back( std::make_pair(static_cast(*(pair_res.second)), - static_cast(curve)) - ); + static_cast(curve))); else _intersect(static_cast(curve), static_cast(*(pair_res.second)), @@ -467,8 +434,7 @@ bool Surface_sweep_2::_add_curve_to_right(Event* event, Subcurve* curve) // template void Surface_sweep_2::_remove_curve_from_status_line(Subcurve* leftCurve, - bool remove_for_good) -{ + bool remove_for_good) { CGAL_SS_PRINT_START("removing a curve from the status line, "); CGAL_SS_PRINT_CURVE(leftCurve); CGAL_SS_PRINT_EOL(); @@ -513,8 +479,7 @@ void Surface_sweep_2::_remove_curve_from_status_line(Subcurve* leftCurve, // template void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, - Event* event_for_overlap) -{ + Event* event_for_overlap) { CGAL_SS_PRINT_START("computing intersection of "); CGAL_SS_PRINT_CURVE(c1); CGAL_SS_PRINT_TEXT(" and "); @@ -538,8 +503,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, Subcurve_vector all_leaves_diff; Subcurve* first_parent = nullptr; if ((c1->originating_subcurve1() != nullptr) || - (c2->originating_subcurve2() != nullptr)) - { + (c2->originating_subcurve2() != nullptr)) { // get the subcurve leaves of c1 and of c2. Then extract from the smallest // set the subcurves leaves that are not in the other one. If empty, it // means that a subcurves is completely contained in another one. @@ -628,9 +592,7 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, CGAL_SS_PRINT_CURVE(first_parent); CGAL_SS_PRINT_EOL(); X_monotone_curve_2 xc = first_parent->last_curve(); - for (auto sc_it = all_leaves_diff.begin(); - sc_it != all_leaves_diff.end(); ++sc_it) - { + for (auto sc_it = all_leaves_diff.begin(); sc_it != all_leaves_diff.end(); ++sc_it) { CGAL_SS_PRINT_TEXT("Inter with curve: "); CGAL_SS_PRINT_CURVE((*sc_it)); CGAL_SS_PRINT_EOL(); @@ -681,12 +643,10 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, if ((ps_x1 == ps_x2) && (ps_y1 == ps_y2) && ((ps_x1 != ARR_INTERIOR) || (ps_y1 != ARR_INTERIOR)) && this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MIN_END) && - this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END)) - { + this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END)) { if ((std::get_if(&(*vi)) != nullptr) && this->m_traits->equal_2_object()(ctr_min(c1->last_curve()), - ctr_min(c2->last_curve()))) - { + ctr_min(c2->last_curve()))) { CGAL_SS_PRINT_TEXT("Skipping common left endpoint on boundary ..."); CGAL_SS_PRINT_EOL(); ++vi; @@ -719,12 +679,10 @@ void Surface_sweep_2::_intersect(Subcurve* c1, Subcurve* c2, if ((ps_x1 == ps_x2) && (ps_y1 == ps_y2) && ((ps_x1 != ARR_INTERIOR) || (ps_y2 != ARR_INTERIOR)) && this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MAX_END) && - this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MAX_END)) - { + this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MAX_END)) { if (this->m_traits->equal_2_object() (this->m_traits->construct_max_vertex_2_object()(c1->last_curve()), - this->m_traits->construct_max_vertex_2_object()(c2->last_curve()))) - { + this->m_traits->construct_max_vertex_2_object()(c2->last_curve()))) { vector_inserter vi_last = vi_end; --vi_last; @@ -791,8 +749,7 @@ template void Surface_sweep_2::_create_intersection_point(const Point_2& xp, Multiplicity multiplicity, Subcurve*& c1, - Subcurve*& c2) -{ + Subcurve*& c2) { CGAL_SS_PRINT_START_EOL("creating an intersection point between"); CGAL_SS_PRINT_CURVE(c1); CGAL_SS_PRINT_EOL(); @@ -814,7 +771,7 @@ void Surface_sweep_2::_create_intersection_point(const Point_2& xp, e->set_intersection(); - this->m_visitor->update_event(e, c1, c2, true); + this->m_visitor->update_event(e, c1, c2, true, multiplicity); e->push_back_curve_to_left(c1); e->push_back_curve_to_left(c2); @@ -858,7 +815,7 @@ void Surface_sweep_2::_create_intersection_point(const Point_2& xp, _add_curve_to_right(e, c1); _add_curve_to_right(e, c2); e->set_intersection(); - this->m_visitor->update_event(e, c1, c2, false); + this->m_visitor->update_event(e, c1, c2, false, multiplicity); if (multiplicity == 0) { if (e->is_right_curve_bigger(c1, c2, this->m_traits)) std::swap(c1, c2); @@ -895,8 +852,7 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, Subcurve*& c1 , Subcurve*& c2, const Subcurve_vector& all_leaves_diff, Subcurve* first_parent, - Event* event_on_overlap) -{ + Event* event_on_overlap) { // An overlap occurs: CGAL_SS_PRINT_START_EOL("creating an overlapping curve"); @@ -935,14 +891,12 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, if ((ps_x_r != ARR_INTERIOR) || (ps_y_r != ARR_INTERIOR)) { // CGAL_assertion(c1->right_event() == c2->right_event()); // right_event = c1->right_event(); - right_event = this->_push_event(overlap_cv, ARR_MAX_END, Event::DEFAULT, - ps_x_r, ps_y_r).first; + right_event = this->_push_event(overlap_cv, ARR_MAX_END, Event::DEFAULT, ps_x_r, ps_y_r).first; } else { auto max_vertex = this->m_traits->construct_max_vertex_2_object(); auto right_end = max_vertex(overlap_cv); - right_event = this->_push_event(right_end, Event::DEFAULT, ARR_INTERIOR, - ARR_INTERIOR).first; + right_event = this->_push_event(right_end, Event::DEFAULT, ARR_INTERIOR, ARR_INTERIOR).first; } if (!c1->is_start_point(left_event)) { @@ -968,12 +922,9 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, // Allocate the new Subcurve for the overlap Subcurve* overlap_sc=nullptr; - if (all_leaves_diff.empty()) - { + if (all_leaves_diff.empty()) { // first check that an equivalent curve is not already in left_event - for (Subcurve_iterator iter = left_event->right_curves_begin(); - iter != left_event->right_curves_end(); ++iter) - { + for (auto iter = left_event->right_curves_begin(); iter != left_event->right_curves_end(); ++iter) { if ((*iter)->has_same_leaves(c1, c2)) { CGAL_SS_PRINT_TEXT("Reuse overlapping curve "); CGAL_SS_PRINT_CURVE(*iter); @@ -983,8 +934,7 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, } } - if (overlap_sc==nullptr) - { + if (overlap_sc == nullptr) { CGAL_SS_PRINT_TEXT("Allocate a new subcurve for the overlap (no common subcurves)"); CGAL_SS_PRINT_EOL(); // no duplicate only one curve is needed @@ -1005,10 +955,7 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, CGAL_SS_PRINT_EOL(); // create an overlapping curve per subcurve in second_parent that is not in first_parent - for (typename std::vector::const_iterator sc_it = all_leaves_diff.begin(); - sc_it != all_leaves_diff.end(); - ++sc_it) - { + for (auto sc_it = all_leaves_diff.begin(); sc_it != all_leaves_diff.end(); ++sc_it) { overlap_sc = this->m_subCurveAlloc.allocate(1); std::allocator_traits::construct(this->m_subCurveAlloc,overlap_sc, this->m_masterSubcurve); overlap_sc->set_hint(this->m_statusLine.end()); @@ -1063,8 +1010,7 @@ _create_overlapping_curve(const X_monotone_curve_2& overlap_cv, // or updated. // template -void Surface_sweep_2::_add_curve(Event* e, Subcurve* sc, Attribute type) -{ +void Surface_sweep_2::_add_curve(Event* e, Subcurve* sc, Attribute type) { if (sc == nullptr) return; if (type == Event::LEFT_END) {