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 @@ class Minkowski_sum_by_convolution_2 { // 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 @@ class Minkowski_sum_by_convolution_2 { 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 @@ class Minkowski_sum_by_convolution_2 { 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;