From 0265e74129ab4c2afd596d44fc740d699654f6fe Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 11 Jan 2024 12:56:24 +0100 Subject: [PATCH] Don't include holes in convex hull CURA-11395 --- src/utils/polygon.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/polygon.cpp b/src/utils/polygon.cpp index fbeedc0199..1c698598db 100644 --- a/src/utils/polygon.cpp +++ b/src/utils/polygon.cpp @@ -105,6 +105,15 @@ Polygons Polygons::approxConvexHull(int extra_outset) void Polygons::makeConvex() { + // early out if there is nothing to do + if (empty()) + { + return; + } + + // convex hulls cannot have holes, so remove all paths except the outerpath + this->paths.resize(1); + // Andrew’s Monotone Chain Convex Hull Algorithm for (PolygonRef poly : *this) {