chiark / gitweb /
Possible fix for #655
authordaid <daid303@gmail.com>
Tue, 10 Dec 2013 13:33:16 +0000 (14:33 +0100)
committerdaid <daid303@gmail.com>
Tue, 10 Dec 2013 13:33:16 +0000 (14:33 +0100)
Cura/util/polygon.py

index 9b7a987bff89cbf5d2401202a676cf3131a46ab2..1eba59e951381da473a3e29b068e8386f3e8b758 100644 (file)
@@ -18,6 +18,8 @@ def convexHull(pointList):
 
        points = unique.keys()
        points.sort()
 
        points = unique.keys()
        points.sort()
+       if len(points) < 2:
+               return numpy.array([], numpy.float32)
 
        # Build upper half of the hull.
        upper = [points[0], points[1]]
 
        # Build upper half of the hull.
        upper = [points[0], points[1]]
@@ -38,7 +40,7 @@ def convexHull(pointList):
        del lower[0]
        del lower[-1]
 
        del lower[0]
        del lower[-1]
 
-       return numpy.array(upper + lower, numpy.float32) - numpy.array([0.0,0.0], numpy.float32)
+       return numpy.array(upper + lower, numpy.float32)
 
 def minkowskiHull(a, b):
        points = numpy.zeros((len(a) * len(b), 2))
 
 def minkowskiHull(a, b):
        points = numpy.zeros((len(a) * len(b), 2))