The below code outputs a path containing the coordinates [(4., 4.), (2., 4.), (2., 2.), (4., 2)]. Not sure if I'm overlooking something obvious, but if Clipper.addPath() assumes the added path is closed by default, shouldn't the output be [(4., 4.), (2., 4.), (2., 2.), (4., 2), (4., 4.)]? Or does pyclipr just assume a line segment between the first and last coordinates of a contour? I'm puzzled because Clipper's documentation ("Paths are closed when their ends do join (with an implicit line segment between the first and last vertices)") seems to imply the latter, while the example in the pyclipr readme uses paths whose first and last coordinates are the same. I'm using pyclipr 0.1.7 on MacOS 14.6.1.
import numpy as np
import pyclr
a_contour = np.array([(0.0, 0.0), (4.0, 0.0), (4.0, 4.0), (0.0, 4.0), (0.0, 0.0)])
b_contour = np.array([(2.0, 2.0), (6.0, 2.0), (6.0, 6.0), (2.0, 6.0), (2.0, 2.0)])
pc = pyclipr.Clipper()
pc.addPath(a_contour, pyclipr.Subject)
pc.addPath(b_contour, pyclipr.Clip)
out = pc.execute(pyclipr.Intersection, pyclipr.FillRule.EvenOdd)
print(out)
The below code outputs a path containing the coordinates [(4., 4.), (2., 4.), (2., 2.), (4., 2)]. Not sure if I'm overlooking something obvious, but if Clipper.addPath() assumes the added path is closed by default, shouldn't the output be [(4., 4.), (2., 4.), (2., 2.), (4., 2), (4., 4.)]? Or does pyclipr just assume a line segment between the first and last coordinates of a contour? I'm puzzled because Clipper's documentation ("Paths are closed when their ends do join (with an implicit line segment between the first and last vertices)") seems to imply the latter, while the example in the pyclipr readme uses paths whose first and last coordinates are the same. I'm using pyclipr 0.1.7 on MacOS 14.6.1.