Repository navigation
Commit 9d64824
Fix intersection of three planes (#279)
`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:
```python
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.
---------
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>1 parent 6a8743b commit 9d64824
2 files changed
Lines changed: 29 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
445 | 473 | | |
446 | 474 | | |
0 commit comments