[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Results of intersection_line_line_xy and intersection_line_line are different #1398

Open
romanarust opened this issue Oct 13, 2024 · 0 comments
Assignees
Labels

Comments

@romanarust
Copy link
Member

I'm not sure if this is related to issue #1320, but it also involves high coordinate values.

intersection_line_line_xy and intersection_line_line are producing different intersection points. The result from intersection_line_line is correct, while the one from intersection_line_line_xy is not. This discrepancy is clearly related to the high coordinate values, as both functions return identical results when the lines are transformed closer to the origin.

To Reproduce

>>> from compas.geometry import Line
>>> from compas.geometry import Point
>>> from compas.geometry import Translation
>>> from compas.geometry import Vector
>>> from compas.geometry import distance_point_point
>>> from compas.geometry import intersection_line_line
>>> from compas.geometry import intersection_line_line_xy
>>> line_a = Line(Point(x=2687071.524742563, y=1221749.0753872169, z=0.0), Point(x=2687069.1419153824, y=1221750.3200979184, z=0.0))
>>> line_b = Line(Point(x=2687069.1328718644, y=1221750.3261498366, z=0.0), Point(x=2687069.006655604, y=1221750.4317925072, z=0.0))
>>> tol = 1e-7
>>> i2d = intersection_line_line_xy(line_a, line_b, tol=tol)
>>> i3d = intersection_line_line(line_a, line_b, tol=tol)[0]
>>> distance_point_point(i2d, i3d)
0.005755306379571995
>>> T = Translation.from_vector(Vector.from_start_end(line_a[0], (0, 0, 0)))
>>> line_a.transform(T)
>>> line_b.transform(T)
>>> i2d = intersection_line_line_xy(line_a, line_b, tol=tol)
>>> i3d = intersection_line_line(line_a, line_b, tol=tol)[0]
>>> distance_point_point(i2d, i3d)
4.965068306494546e-16
@tomvanmele tomvanmele self-assigned this Oct 15, 2024
@tomvanmele tomvanmele added the bug label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants