From ff084a196c95b483d99aa9ce193268df56868b37 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 2 Nov 2021 17:43:02 +0100 Subject: [PATCH] Fixing bugs in the new polygon filtering routine by polygon diameter. --- src/libslic3r/Polygon.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/Polygon.cpp b/src/libslic3r/Polygon.cpp index 87bc05b852..0d4f3ec128 100644 --- a/src/libslic3r/Polygon.cpp +++ b/src/libslic3r/Polygon.cpp @@ -471,10 +471,8 @@ void remove_with_small_diameter(Polygons &polygons, double min_diameter) size_t end = 0; for (size_t i = 0; i < polygons.size(); ++ i) { Polygon &poly = polygons[i]; - bool keep = true; - if (poly.size() < 2) { - keep = false; - } else { + bool keep = false; + if (poly.size() >= 2) { Point pmin = poly.front(); Point pmax = poly.points[1]; for (size_t k = 2; k < poly.size(); ++k) { @@ -519,8 +517,8 @@ void remove_with_small_diameter(Polygons &polygons, double min_diameter) ++ end; } #endif - polygons.erase(polygons.begin() + end, polygons.end()); } + polygons.erase(polygons.begin() + end, polygons.end()); } void remove_collinear(Polygon &poly)