We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8703b4 commit 642bf79Copy full SHA for 642bf79
UM/Math/Polygon.py
@@ -258,7 +258,13 @@ def intersectsPolygon(self, other):
258
# \return \type{Polygon} The convex hull around the points of this polygon.
259
if has_scipy:
260
def getConvexHull(self):
261
- hull = scipy.spatial.ConvexHull(self._points)
+ points = self._points
262
+
263
+ if len(points) < 1:
264
+ return Polygon(numpy.zeros((0, 2), numpy.float64))
265
+ if len(points) <= 2:
266
+ return Polygon(numpy.array(points, numpy.float64))
267
+ hull = scipy.spatial.ConvexHull(points)
268
return Polygon(numpy.flipud(self._points[hull.vertices]))
269
else:
270
0 commit comments