Skip to content

Fix XY line intersections far from the origin - #1535

Open
ArianMoeini wants to merge 2 commits into
compas-dev:mainfrom
ArianMoeini:fix/xy-line-intersection-large-coordinates
Open

ArianMoeini wants to merge 2 commits into
compas-dev:mainfrom
ArianMoeini:fix/xy-line-intersection-large-coordinates

Conversation

@ArianMoeini

@ArianMoeini ArianMoeini commented Oct 5, 2026 •

Copy link
Copy Markdown

Closes #1398.

intersection_line_line_xy used determinants of absolute point coordinates. For points far from the origin, it subtracted large, nearly equal products and lost precision. This change computes the intersection parameter from coordinate differences relative to the first point, then evaluates the point on the first line.

The regression test uses the coordinates from #1398. Before the fix, the 2D result differed from the expected intersection by about 0.00576; after the fix, it matches within 1e-7.

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change.
  • Other.

Checklist

  • Added an Unreleased changelog entry.
  • Ran the full test suite locally: 1,012 passed, 12 skipped.
  • Whole-repository lint is clean. ruff check passes for both changed Python files; a repository-wide run reports 12 existing errors in unrelated files.
  • Added new functions or classes (not applicable).
  • Added a regression test that fails before the fix.
  • Added API documentation (no API change; changelog entry included).

Ruff format checks and git diff --check pass. I also added myself to AUTHORS.md as requested by CONTRIBUTING.md.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Results of intersection_line_line_xy and intersection_line_line are different

1 participant