Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

euler_angles_ordered returns surprising results on gimbal lock (strange sign) #1482

Open
lierdakil opened this issue Feb 7, 2025 · 0 comments

Comments

@lierdakil
Copy link

Consider the following example:

Rotation3::from_euler_angles(0., -90f64.to_radians(), 45f64.to_radians())
    .euler_angles_ordered(
        [
            UnitVector3::new_normalize(Vector3::z()),
            UnitVector3::new_normalize(Vector3::y()),
            UnitVector3::new_normalize(Vector3::x()),
        ],
        false,
    )

The expected result is:

([0.7853981633974483, -1.5707963267948966, 0.0], false)

However, the actual result is:

([-0.7853981633974483, -1.5707963267948966, 0.0], false)

Notice the yaw sign is inverted.

Outside gimbal lock (so at pitch = -89.9 for example), the sign is as expected, so there's a weird discontinuity here.

At apex gimbal lock (so pitch = 90.0) the angle is also as expected.

It seems the yaw is multiplied redundantly by the sign of the pitch here.

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

No branches or pull requests

1 participant