mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 00:55:53 +08:00
fix brim ear generation crash of small surfaces
supermerill/SuperSlicer#1513
This commit is contained in:
parent
2dc9bcc419
commit
6b6035ad00
@ -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());
|
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 PrintInstance ©_pt : object->m_instances)
|
||||||
for (const ExPolygon &poly : object_islands) {
|
for (const ExPolygon &poly : object_islands) {
|
||||||
islands.push_back(poly);
|
islands.push_back(poly);
|
||||||
islands.back().translate(copy_pt.shift.x(), copy_pt.shift.y());
|
islands.back().translate(copy_pt.shift.x(), copy_pt.shift.y());
|
||||||
Polygon decimated_polygon = poly.contour;
|
Polygon decimated_polygon = poly.contour;
|
||||||
// brim_ears_detection_length codepath
|
// brim_ears_detection_length codepath
|
||||||
if (object->config().brim_ears_detection_length.value > 0) {
|
if (ear_detection_length > 0) {
|
||||||
//decimate polygon
|
//decimate polygon
|
||||||
Points points = poly.contour.points;
|
Points points = poly.contour.points;
|
||||||
points.push_back(points.front());
|
points.push_back(points.front());
|
||||||
points = MultiPoint::_douglas_peucker(points, scale_(object->config().brim_ears_detection_length.value));
|
points = MultiPoint::_douglas_peucker(points, ear_detection_length);
|
||||||
if (points.size() > 1) {
|
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);
|
points.erase(points.end() - 1);
|
||||||
decimated_polygon.points = points;
|
decimated_polygon.points = points;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user