Skip to content

Results of intersection_line_line_xy and intersection_line_line are different #1398

Open

Description

@romanarust

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions