Skip to content

Fix intersection of three planes - #279

Merged
taughz merged 2 commits into
rai-opensource:masterfrom
xixihaha-ha:fix/three-plane-intersection
Nov 5, 2026
Merged

taughz merged 2 commits into
rai-opensource:masterfrom
xixihaha-ha:fix/three-plane-intersection

Conversation

@xixihaha-ha

Copy link
Copy Markdown
Contributor

Plane3.intersection raises a matrix multiplication error even for three planes with a unique intersection: np.linalg.det(A) is a scalar. Solve A @ point = -b instead, following the documented plane equation n @ point + d = 0.

Reproduction on the base revision:

import numpy as np
from spatialmath import Plane3

planes = [Plane3([1, 0, 0, -1]), Plane3([0, 1, 0, -2]), Plane3([0, 0, 1, -3])]
np.testing.assert_allclose(Plane3.intersection(*planes), [1, 2, 3])

Validation on Windows / Python 3.11:

  • All 14 added regression cases fail on the original implementation.
  • pytest tests/test_geom3d.py -q: 56 passed.
  • pytest -q: 487 passed, 3 skipped; 63 subtests passed.
  • Black 23.10.0 checks for both changed files and git diff --check passed.

Tests cover known intersections, oblique normals, signed coefficient scaling, plane order, equation residuals, and singular systems. No dependencies or public signatures change.

The human requested a robotics-related bug fix and authorized submission. Codex diagnosed the problem, implemented the one-line fix, and wrote and ran the tests.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Avoids a textual conflict with other PRs that add tests after the line
distance tests, and restores the executable bit on the test file, which
runs as a script.
@taughz taughz mentioned this pull request Nov 5, 2026
17 tasks done
taughz added a commit that referenced this pull request Nov 5, 2026
@taughz
taughz merged commit 9d64824 into rai-opensource:master Nov 5, 2026
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.

4 participants