diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index 6e3886d6dbb..4d8f6a5eda3 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -290,7 +290,8 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n [](const Line &s) { return s.a == s.b; }), polygon_sections[section_idx].end()); std::sort(polygon_sections[section_idx].begin(), polygon_sections[section_idx].end(), - [](const Line &a, const Line &b) { return a.a.y() < b.b.y(); }); + [](const Line &a, const Line &b) { if (a == b) return false; // Ensure irreflexivity + return a.a.y() < b.b.y(); }); } Polygons reconstructed_area{}; diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 50d86a3d068..624a710902b 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -3179,7 +3179,7 @@ void PerimeterGenerator::process_arachne() // printf("Layer ID %d, Outer index %d, inner index %d, second inner index %d, maximum internal perimeter %d \n",layer_id,outer,first_internal,second_internal, max_internal); if (outer > -1 && first_internal > -1 && second_internal > -1) { // found all three perimeters to re-order? If not the perimeters will be processed outside in. std::vector inner_outer_extrusions; // temporary array to hold extrusions for reordering - inner_outer_extrusions.reserve(max_internal - position + 1); // reserve array containing the number of perimeters before a new island. Variables are array indexes hence need to add +1 to convert to position allocations + inner_outer_extrusions.resize(max_internal - position + 1); // reserve array containing the number of perimeters before a new island. Variables are array indexes hence need to add +1 to convert to position allocations // printf("Allocated array size %d, max_internal index %d, start position index %d \n",max_internal-position+1,max_internal,position); for (arr_j = max_internal; arr_j >=position; --arr_j){ // go inside out towards the external perimeter (perimeters in reverse order) and store all internal perimeters until the first one identified with inset index 2 diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 1530fe655c6..01d7e242c97 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -2513,7 +2513,10 @@ void PrintObject::bridge_over_infill() [](const Line &s) { return s.a == s.b; }), polygon_sections[i].end()); std::sort(polygon_sections[i].begin(), polygon_sections[i].end(), - [](const Line &a, const Line &b) { return a.a.y() < b.b.y(); }); + [](const Line &a, const Line &b) { + if (a == b) return false; // Ensure irreflexivity + return a.a.y() < b.b.y(); + }); } // reconstruct polygon from polygon sections