Skip to content

Commit 8dc6c6a

Browse files
committed
ignore path with no area
they just fail in pyclipper
1 parent 0a9cc5c commit 8dc6c6a

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

Lib/booleanOperations/booleanGlyph.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def _flushContour(self):
5151

5252
contour = self._glyph.contourClass()
5353
contour._points = points
54-
self._glyph.contours.append(contour)
54+
if contour.area != 0:
55+
# ignore paths with no area
56+
self._glyph.contours.append(contour)
5557

5658
def beginPath(self):
5759
self._points = []
@@ -74,7 +76,7 @@ class BooleanContour(object):
7476

7577
def __init__(self):
7678
self._points = []
77-
self._clockwise = None
79+
self._area = None
7880
self._bounds = None
7981

8082
def __len__(self):
@@ -93,14 +95,19 @@ def drawPoints(self, pointPen):
9395
pointPen.endPath()
9496

9597
def _get_clockwise(self):
96-
if self._clockwise is None:
98+
return self.area < 0
99+
100+
clockwise = property(_get_clockwise)
101+
102+
def _get_area(self):
103+
if self._area is None:
97104
pen = AreaPen()
98105
pen.endPath = pen.closePath
99106
self.draw(pen)
100-
self._clockwise = pen.value < 0
101-
return self._clockwise
107+
self._area = pen.value
108+
return self._area
102109

103-
clockwise = property(_get_clockwise)
110+
area = property(_get_area)
104111

105112
def _get_bounds(self):
106113
if self._bounds is None:

0 commit comments

Comments
 (0)