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

[raymath] QuaternionFromMatrix() not returning expected result #2591

Merged
merged 1 commit into from
Jul 26, 2022

Conversation

kirigirihitomi
Copy link
Contributor

@kirigirihitomi kirigirihitomi commented Jul 25, 2022

Test code:

float theta = GetRandomValue(0, 360) * DEG2RAD;
Vector3 n = Vector3Normalize((Vector3) { GetRandomValue(0, 100) / 100.0f, GetRandomValue(0, 100) / 100.0f, GetRandomValue(0, 100) / 100.0f });
Quaternion q0 = { .w = cos(theta / 2), .x = n.x * sin(theta / 2), .y = n.y * sin(theta / 2), .z = n.z * sin(theta / 2) };
Quaternion q = QuaternionFromMatrix(QuaternionToMatrix(q0));

assert(QuaternionEquals(q, q0));

algorithm form: Ken Shoemake. "Quaternions and 4 x 4 Matrices."

@raysan5 raysan5 merged commit 64710e6 into raysan5:master Jul 26, 2022
@raysan5
Copy link
Owner

raysan5 commented Jul 26, 2022

@kirigirihitomi thanks for the review! :)

@kirigirihitomi
Copy link
Contributor Author

kirigirihitomi commented Jul 26, 2022 via email

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

Successfully merging this pull request may close these issues.

None yet

2 participants