If we swapped the segments, we must swap them back when returning results
This commit is contained in:
parent
1795ee98b2
commit
2ef7964e90
@ -1137,16 +1137,22 @@ def segmentSegmentIntersections(seg1, seg2):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
# Arrange by degree
|
# Arrange by degree
|
||||||
|
swapped = False
|
||||||
if len(seg2) > len(seg1):
|
if len(seg2) > len(seg1):
|
||||||
seg2, seg1 = seg1, seg2
|
seg2, seg1 = seg1, seg2
|
||||||
|
swapped = True
|
||||||
if len(seg1) > 2:
|
if len(seg1) > 2:
|
||||||
if len(seg2) > 2:
|
if len(seg2) > 2:
|
||||||
return curveCurveIntersections(seg1, seg2)
|
intersections = curveCurveIntersections(seg1, seg2)
|
||||||
else:
|
else:
|
||||||
return curveLineIntersections(seg1, seg2)
|
intersections = curveLineIntersections(seg1, seg2)
|
||||||
elif len(seg1) == 2 and len(seg2) == 2:
|
elif len(seg1) == 2 and len(seg2) == 2:
|
||||||
return lineLineIntersections(*seg1, *seg2)
|
intersections = lineLineIntersections(*seg1, *seg2)
|
||||||
|
else:
|
||||||
raise ValueError("Couldn't work out which intersection function to use")
|
raise ValueError("Couldn't work out which intersection function to use")
|
||||||
|
if not swapped:
|
||||||
|
return intersections
|
||||||
|
return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections]
|
||||||
|
|
||||||
|
|
||||||
def _segmentrepr(obj):
|
def _segmentrepr(obj):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user