From 8e59f3fc9d26b114ec6316daeb30f3cddbbf0b65 Mon Sep 17 00:00:00 2001 From: Garbage123King <70872685+Garbage123King@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:32:43 +0800 Subject: [PATCH 1/2] Update Minkowski_sum_conv_2.h fix issue #8551 --- .../CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h index 7b1bd67d5d0..b3e1a394469 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h @@ -533,7 +533,7 @@ private: // list for subsequences sharing a common move_on indicator. When we // encounter such a subsequence that equals the size of the corresponding // polygon, we can safely remove it from the convolution cycle. - typename std::list::iterator first, curr; + typename std::list::iterator first, curr, newins; bool move_on; unsigned int count = 1; bool reduced_cycle = false; @@ -611,7 +611,7 @@ private: res = f_compare_xy(curr_pt, next_pt); if (res != EQUAL) { - cycle.insert(curr, + newins = cycle.insert(curr, Labeled_segment_2(Segment_2(curr_pt, next_pt), X_curve_label((res == SMALLER), cycle_id, @@ -621,7 +621,13 @@ private: cycle.erase(curr); cycle.erase(next); - curr = after_next; + if (res != EQUAL) { + //continue comparing the new combined line with the next line + curr = newins; + } + else { + curr = after_next; + } if (after_next != cycle.end()) { next = curr; From 78c08101815077cc289cc84b7067fde3566ac2d8 Mon Sep 17 00:00:00 2001 From: Sebastien Loriot Date: Wed, 6 Nov 2024 15:33:25 +0100 Subject: [PATCH 2/2] Apply suggestions from Efi --- .../CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h index b3e1a394469..c94a8f622af 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h @@ -533,7 +533,7 @@ private: // list for subsequences sharing a common move_on indicator. When we // encounter such a subsequence that equals the size of the corresponding // polygon, we can safely remove it from the convolution cycle. - typename std::list::iterator first, curr, newins; + typename std::list::iterator first, curr; bool move_on; unsigned int count = 1; bool reduced_cycle = false; @@ -611,7 +611,7 @@ private: res = f_compare_xy(curr_pt, next_pt); if (res != EQUAL) { - newins = cycle.insert(curr, + after_next = cycle.insert(curr, Labeled_segment_2(Segment_2(curr_pt, next_pt), X_curve_label((res == SMALLER), cycle_id, @@ -621,13 +621,7 @@ private: cycle.erase(curr); cycle.erase(next); - if (res != EQUAL) { - //continue comparing the new combined line with the next line - curr = newins; - } - else { - curr = after_next; - } + curr = after_next; if (after_next != cycle.end()) { next = curr;