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

Incorrect Quaterniond .rotationX() function behaviour #355

Open
Povstalec opened this issue Sep 16, 2024 · 0 comments
Open

Incorrect Quaterniond .rotationX() function behaviour #355

Povstalec opened this issue Sep 16, 2024 · 0 comments

Comments

@Povstalec
Copy link

Povstalec commented Sep 16, 2024

The Quaterniond class implementation of rotationX() is different from the Quaternionf class, resulting in behaviour not consistent with how quaternions rotated around the X-axis should behave.

The correct code in Quaternionf => 0 rotation around X-axis creates a (0, 0, 0, 1) quaternion:

public Quaternionf rotationX(float angle) {
float sin = Math.sin(angle * 0.5f);
float cos = Math.cosFromSin(sin, angle * 0.5f);
return set(sin, 0, 0, cos);
}

Incorrect code in Quaterniond => 0 rotation around X-axis creates a (0, 0, 1, 0) quaternion:

public Quaterniond rotationX(double angle) {
double sin = Math.sin(angle * 0.5);
double cos = Math.cosFromSin(sin, angle * 0.5);
return set(sin, 0, cos, 0);
}

@Povstalec Povstalec changed the title Incorrect Quaterniond rotationX() function behaviour Incorrect Quaterniond .rotationX() function behaviour Sep 16, 2024
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