Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/compas/geometry/intersections.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def intersection_line_line(l1, l2, tol=None):
plane_1 = (a, n1)
plane_2 = (c, n2)

i1 = intersection_line_plane(l1, plane_2, tol=tol)
i2 = intersection_line_plane(l2, plane_1, tol=tol)
i1 = intersection_line_plane(l1, plane_2)
i2 = intersection_line_plane(l2, plane_1)

if not i1 or not i2:
return None, None
Expand Down
13 changes: 13 additions & 0 deletions tests/compas/geometry/test_intersections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from compas.tolerance import TOL
from compas.geometry import intersection_segment_segment
from compas.geometry import intersection_sphere_line
from compas.geometry import intersection_plane_circle
from compas.geometry import intersection_circle_circle_xy
Expand Down Expand Up @@ -26,3 +27,15 @@ def test_intersection_circle_circle_xy():
ipt1, ipt2 = intersection_circle_circle_xy(circle1, circle2)
assert TOL.is_allclose(ipt1, (9.999, -0.142, 0.000), atol=1e-3)
assert TOL.is_allclose(ipt2, (-6.999, 7.142, 0.000), atol=1e-3)


def test_intersection_segment_segment_large_coordinates_small_tolerance():
s1 = (2687403.6546, 1169130.8538, 0.0), (2687403.6428, 1169130.8540, 0.0)
s2 = (2687403.6408, 1169130.8538, 0.0), (2687403.6509, 1169130.8544, 0.0)

x1, x2 = intersection_segment_segment(s1, s2, tol=1e-3)

assert x1 is not None
assert x2 is not None
assert TOL.is_allclose(x1, (2687403.64386, 1169130.85398, 0.0), atol=1e-5)
assert TOL.is_allclose(x2, (2687403.64386, 1169130.85398, 0.0), atol=1e-5)