From fcbbea5e0de6ea4b59a9dcb44b176460e6e2f6d3 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Mon, 19 Oct 2020 11:47:14 +0200 Subject: [PATCH] Better handling of invertions --- .../include/CGAL/Arr_polycurve_traits_2.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h index 542983d0de0..ff3fc1a80b6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h @@ -719,15 +719,15 @@ public: Comparison_result dir1 = cmp_seg_endpts(cv1[0]); Comparison_result dir2 = cmp_seg_endpts(cv2[0]); + std::vector ocv; // Used to represent overlaps. + const bool invert_ocv = (dir1 == LARGER && dir2 == LARGER); + const std::size_t n1 = cv1.number_of_subcurves(); const std::size_t n2 = cv2.number_of_subcurves(); std::size_t i1 = (dir1 == SMALLER) ? 0 : n1-1; std::size_t i2 = (dir2 == SMALLER) ? 0 : n2-1; - std::vector ocv; // Used to represent overlaps. - bool invert_ocv = false; - auto compare_xy = m_poly_traits.compare_xy_2_object(); Comparison_result left_res = compare_xy(cv1[i1], ARR_MIN_END, cv2[i2], ARR_MIN_END); @@ -851,12 +851,6 @@ public: boost::get(&item); if (x_seg != nullptr) { X_monotone_subcurve_2 seg = *x_seg; - - // If for some reason the subcurve intersection - // results in left oriented curve. - if (cmp_seg_endpts(seg) == LARGER) - invert_ocv = true; - ocv.push_back(seg); } @@ -985,7 +979,7 @@ public: template inline OutputIterator output_ocv - (std::vector& ocv, bool& invert_ocv, OutputIterator oi) const + (std::vector& ocv, bool invert_ocv, OutputIterator oi) const { typedef std::pair Intersection_point; typedef boost::variant @@ -998,7 +992,6 @@ public: *(oi ++) = Intersection_result(curve); ocv.clear(); - invert_ocv = false; return oi; }