diff --git a/UM/Math/Polygon.py b/UM/Math/Polygon.py index 00c4553160..ead5b37129 100644 --- a/UM/Math/Polygon.py +++ b/UM/Math/Polygon.py @@ -258,7 +258,13 @@ def intersectsPolygon(self, other): # \return \type{Polygon} The convex hull around the points of this polygon. if has_scipy: def getConvexHull(self): - hull = scipy.spatial.ConvexHull(self._points) + points = self._points + + if len(points) < 1: + return Polygon(numpy.zeros((0, 2), numpy.float64)) + if len(points) <= 2: + return Polygon(numpy.array(points, numpy.float64)) + hull = scipy.spatial.ConvexHull(points) return Polygon(numpy.flipud(self._points[hull.vertices])) else: def getConvexHull(self):