CURA-4672 now unbreak arrange for large objects as well :-)

This commit is contained in:
Jack Ha 2018-01-04 14:59:40 +01:00
parent 0d7f139cd5
commit 5e26ecb458

View file

@ -29,12 +29,10 @@ class ShapeArray:
offset_x = int(numpy.amin(flip_vertices[:, 1])) offset_x = int(numpy.amin(flip_vertices[:, 1]))
flip_vertices[:, 0] = numpy.add(flip_vertices[:, 0], -offset_y) flip_vertices[:, 0] = numpy.add(flip_vertices[:, 0], -offset_y)
flip_vertices[:, 1] = numpy.add(flip_vertices[:, 1], -offset_x) flip_vertices[:, 1] = numpy.add(flip_vertices[:, 1], -offset_x)
flip_vertices = numpy.ceil(flip_vertices) shape = numpy.array([int(numpy.amax(flip_vertices[:, 0])), int(numpy.amax(flip_vertices[:, 1]))])
shape = [int(numpy.amax(flip_vertices[:, 0])), int(numpy.amax(flip_vertices[:, 1]))] shape[numpy.where(shape == 0)] = 1
if shape == [0, 0]:
shape = [1, 1]
arr = cls.arrayFromPolygon(shape, flip_vertices) arr = cls.arrayFromPolygon(shape, flip_vertices)
if not numpy.any(arr): if not numpy.ndarray.any(arr):
# set at least 1 pixel # set at least 1 pixel
arr[0][0] = 1 arr[0][0] = 1
return cls(arr, offset_x, offset_y) return cls(arr, offset_x, offset_y)