Repository navigation
Commit 5bd2e34
authored
Keep twist poles invariant under angular speed scaling (#249)
`Twist2.pole` and `Twist3.pole` divide the cross product by the angular
magnitude. The closest point on the screw axis requires its square: the
cross product already contains one factor of angular speed.
Consequently, scaling a twist currently moves its reported axis.
```python
from spatialmath import Twist2, Twist3
print(Twist2([1, -2, 0.5]).pole) # expected [4, 2]; currently [2, 1]
print(Twist3([1, -2, 0, 0, 0, 0.5]).pole) # expected [4, 2, 0]
```
Use `w**2` in 2D and `dot(w, w)` in 3D. The zero-angular case keeps its
existing undefined behavior.
The regression checks cover signed speeds, off-origin axes and nonzero
screw pitch. They verify that finite motion leaves an axis point fixed
except for translation along the axis. Twelve of the 15 cases fail
before the fix. On a camera-reconstruction fixture, 680 incorrect axis
estimates become zero across 768 scaled 2D/3D increments; independent
least-squares axis references agree within `1.5e-14`. Ordinary transform
outputs remain identical. Full suite: 362 passed, 3 existing skips;
project pre-commit hooks pass. Linux/Python 3.12.1 parent 7be780b commit 5bd2e34
2 files changed
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
989 | | - | |
| 989 | + | |
990 | 990 | | |
991 | 991 | | |
992 | 992 | | |
| |||
1502 | 1502 | | |
1503 | 1503 | | |
1504 | 1504 | | |
1505 | | - | |
| 1505 | + | |
1506 | 1506 | | |
1507 | 1507 | | |
1508 | 1508 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments