typemytype / booleanOperations

Boolean operations on paths
MIT License
38 stars 18 forks source link

fails with pyclipper 1.1.0.post #50

Closed typemytype closed 5 years ago

typemytype commented 5 years ago

seems like it fails with the current version of pyclipper

"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/booleanOperations/booleanOperationManager.py", line 70, in _performOperation
    operation, subjectFillType="nonZero", clipFillType="nonZero")
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/booleanOperations/booleanOperationManager.py", line 57, in clipExecute
    raise ExecutionError(exc)
booleanOperations.exceptions.ExecutionError: Execution of clipper did not succeed!
anthrotype commented 5 years ago

There haven’t been new releases of pyclipper lately. What’s the input that triggers that?

anthrotype commented 5 years ago

I suppose this has to do with the zero-area paths, following https://github.com/typemytype/booleanOperations/pull/49

typemytype commented 5 years ago

had some time to look at it: this traceback is raised when there are no contours given... like in a space or a glyph with only components.

typemytype commented 5 years ago

we urgently needs test cases:

from booleanOperations.booleanOperationManager import clipExecute

testSubjectContours = [
    [[(100, 100), (200, 200), (200, 100)]],
    [[(100, 100), (200, 200)]],
    [[], []],
    [[]],
    []
]

for testContour in testSubjectContours:
    try:
        r = clipExecute(testContour, [], "union")
        print("succes:", testContour)
    except Exception as e:
        print("failed:", testContour)
        print(e)
typemytype commented 5 years ago

it should not run clipExecute whenever the subjectContour is and empty list, even if its a a empty list of empty segments

typemytype commented 5 years ago

with pyclipper 1.0.6 the last test with an empty subjectContour works fine... Im not sure if this is an issue of pyclipper of the clipper library

anthrotype commented 5 years ago

Fixed by #51