Repository navigation
Commit 6a8743b
authored
fix(geom3d): return the intersection point of two lines (#273)
`Line3.intersects()` returns a `(3, 3)` array for intersecting lines
instead of the documented `(3,)` intersection point:
```python
from spatialmath import Line3
a = Line3.PointDir([1, 2, 3], [1, 0, 0])
b = Line3.PointDir([1, 2, 3], [0, 1, 0])
a.intersects(b) # expected array([1., 2., 3.])
```
The final multiplication in the old expression broadcasts a matrix.
Normalizing the cross product also rejects some valid lines represented
with small Plücker coordinates.
After the existing intersection predicate succeeds, reuse
`closest_to_line()` to obtain the intersection point. Keep the
predicate, tolerance and `None` result for parallel, coincident and skew
lines unchanged. Correct the method's malformed related-method links.
Add 18 regression cases covering the origin and translated
intersections, nonorthogonal and spatial directions, either operand
order, positive/negative and unequal Plücker scales, and nonintersecting
controls.
Validation with current upstream `41e0a4d`:
- New regressions before the fix: **15 failed, 3 passed**; geometry
tests after the fix: **60 passed**.
- Full suite on Python 3.12.14: **428 passed, 3 skipped**, with 55
subtests passed and 22 warnings.
- Geometry tests on Python 3.10.12: **60 passed**, with 2 warnings.
- Repository pre-commit hooks (including Black 23.10.0) and `git diff
--check` pass.
Signed-off-by: 李永祺 <doribelove@gmail.com>1 parent 3a32a4b commit 6a8743b
2 files changed
Lines changed: 41 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
830 | 830 | | |
831 | 831 | | |
832 | 832 | | |
833 | | - | |
| 833 | + | |
834 | 834 | | |
835 | 835 | | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
842 | 839 | | |
843 | 840 | | |
844 | 841 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
50 | 87 | | |
51 | 88 | | |
52 | 89 | | |
| |||
0 commit comments