-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
How do I generate a quaternion from euler angles? #306
Comments
Hi @badasahog, Sorry for the delay, It could be nice to have this feature in cglm too. I had tried to update Euler with #128 but couldn't finished that PR yet, We can have this before that, Any PR would be awesome otherwise I added to TODOs. 🙂 |
Yes It would be amazing I also need a quat structure for my project. |
Sorry for answering very late, but for anyone else who needs help in the future, you could try making a function that rotates the quaternion by each axis. I guess you could also try and push it to the repository even though it might not be optimal // example for rotating the quaternion by the y axis by an angle: // y axis // creates a quaternion with the angle and axis // when multiplying this rotation with an angular position quaternion, it will apply the rotation to the angular position |
@telephone001 many thanks, hope we add this asap 🚀 |
do you think glm_quate_xyz or glm_quat_euler_xyz would be a better name for this new function? |
To convert Euler to Quat, I would use
|
Alright thanks for the response. I'll try and get this done soon |
@telephone001 thanks 🤗 |
@recp |
Thanks for the implementation a PR would be nice to see,
https://github.com/recp/cglm/actions seems fine, may I ask what are the errors? Also can you pull latest commits and try again? there was an issue about #360 (comment) but fixed later. |
I created a pr and most tests failed. The error is just that all tests fail on certain builds. |
The 'expected' quaternion is overwriting itself during multiplication. Another thing to check is whether |
Oh I see now. Thank you for the reply. I'll try and get this fixed up. |
@gottfriedleibniz many thanks for the catch! I'll also check all places e.g.
Yes since SRC->DST is Euler -> Quat I think they must be in euler.h, In the future we can add reverse quat_to_euler in quat.h.
To simplify creating tests, any macro, utility functions can be used 👍 |
I want to get a quaternion based on roll, pitch, and yaw, but as far as I can tell there is no function for this.
The only functions I could find were based on a unit vector and an angle (glm_quatv, glm_quat)
glm provides this functionality in the form of the glm::quat(glm::vec3) constructor
The text was updated successfully, but these errors were encountered: