Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Lib/booleanOperations/flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def __init__(self, points=None, previousOnCurve=None, willBeReversed=False):
self.scaledPreviousOnCurve = _scaleSinglePoint(previousOnCurve, scale=clipperScale)
self.used = False
self.flat = []
# if the bcps are equal to the oncurves convert the segment to a line segment.
# if the bcps are equal to the oncurves, or are aligned with them, convert the segment to a line segment.
# otherwise this causes an error when flattening.
if self.segmentType == "curve":
if previousOnCurve == points[0].coordinates and points[1].coordinates == points[-1].coordinates:
Expand All @@ -162,6 +162,11 @@ def __init__(self, points=None, previousOnCurve=None, willBeReversed=False):
oncurve = points[-1]
oncurve.segmentType = "line"
self.points = points = [oncurve]
elif (_pointOnLine(previousOnCurve, points[-1].coordinates, points[0].coordinates) and
_pointOnLine(previousOnCurve, points[-1].coordinates, points[1].coordinates)):
oncurve = points[-1]
oncurve.segmentType = "line"
self.points = points = [oncurve]
# its a reversed segment the flat points will be set later on in the InputContour
if willBeReversed:
return
Expand Down