Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Attempt to fix issue with segments disappearing #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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