Closed StanLivitski closed 3 years ago
Confirmed. By definition the intersections are the same going either direction.
def test_issue_94(self):
# clipping rectangle
p1 = Path('M0.0 0.0 L27.84765625 0.0 L27.84765625 242.6669922 L0.0 242.6669922 z')
# clipping rectangle
p2 = Path('M166.8359375,235.5478516c0,3.7773438-3.0859375,6.8691406-6.8701172,6.8691406H7.1108398c-3.7749023,0-6.8608398-3.0917969-6.8608398-6.8691406V7.1201172C0.25,3.3427734,3.3359375,0.25,7.1108398,0.25h152.8549805c3.7841797,0,6.8701172,3.0927734,6.8701172,6.8701172v228.4277344z')
self.assertEqual(len(p1.intersect(p2)), len(p2.intersect(p1)))
Ran 1 test in 0.062s
FAILED (failures=1)
1 != 2
Expected :2 Actual :1
With the following shapes intersecting in 2 places:
I see this REPL output:
This seems to be caused by Path.intersect() removing some intersections from the result due to a typo. If I patch svgpathtools/path.py version 1.3.3 at line 2196 as follows:
I get the expected result:
BTW, it would be nice to make a new release of svgpathtools and pick up all bug fixes accumulated since last summer, including a fix for this issue :)