You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix rotation matrix construction from Rot2 (#20522)
# Objective
Our `From<Rot2>` implementation for `Mat2` looks like this:
```rust
impl From<Rot2> for Mat2 {
/// Creates a [`Mat2`] rotation matrix from a [`Rot2`].
fn from(rot: Rot2) -> Self {
Mat2::from_cols_array(&[rot.cos, -rot.sin, rot.sin, rot.cos])
}
}
```
The resulting matrix looks like this:
```text
[ cos, sin ]
[ -sin, cos ]
```
Cool! Oh wait -- *checks
[notes](https://en.wikipedia.org/wiki/Rotation_matrix)* -- the correct
matrix is this?
```text
[ cos, -sin ]
[ sin, cos ]
```
Oops!
## Solution
Fix the matrix signs. Now my joint's axes are oriented correctly :)
## Testing
Added a simple regression test. Fails before the change, passes after.
0 commit comments