From 6b6035ad006d8795da59e094c4dbf0b977f724a4 Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 30 Aug 2021 16:07:08 +0200 Subject: [PATCH] fix brim ear generation crash of small surfaces supermerill/SuperSlicer#1513 --- src/libslic3r/Print.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 38565675e..88d36d08a 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -2370,18 +2370,19 @@ void Print::_make_brim_ears(const Flow &flow, const PrintObjectPtrs &objects, Ex } } islands.reserve(islands.size() + object_islands.size() * object->m_instances.size()); + coord_t ear_detection_length = scale_t(object->config().brim_ears_detection_length.value); for (const PrintInstance ©_pt : object->m_instances) for (const ExPolygon &poly : object_islands) { islands.push_back(poly); islands.back().translate(copy_pt.shift.x(), copy_pt.shift.y()); Polygon decimated_polygon = poly.contour; // brim_ears_detection_length codepath - if (object->config().brim_ears_detection_length.value > 0) { + if (ear_detection_length > 0) { //decimate polygon Points points = poly.contour.points; points.push_back(points.front()); - points = MultiPoint::_douglas_peucker(points, scale_(object->config().brim_ears_detection_length.value)); - if (points.size() > 1) { + points = MultiPoint::_douglas_peucker(points, ear_detection_length); + if (points.size() > 4) { //don't decimate if it's going to be below 4 points, as it's surely enough to fill everything anyway points.erase(points.end() - 1); decimated_polygon.points = points; }