Jump to content

Converting Quaternions to Euler Angles


ikarus

Recommended Posts

I know quaternions can be generated from euler angles (euler2quat) but I need to convert back to a set of euler angles for torque calculations. I'm having some trouble following online resources on quat to euler, could someone explain this or provide an example file? thanks

Link to comment
Share on other sites

You can look here:

http://en.wikipedia....nd_Euler_angles

First, get your quaternion components, q0, q1, q2, q3 as written there. Then make those 3 equations that look like a matrix (at the bottom) and you get roll, pitch and yaw. If you do that in vopsop nodes it will be quite fiddly and you get radians, so you need to convert them to degrees. Vex or Python will probably be easier for this but either way will work.

I've tried that once but forgot if it completely worked. I think there was some flipping if you rotate more than pi, but arctan2 solved that if I remember correctly.

I may even have posted it here. Not sure.

Edit: Be careful, I think that very last equation on the wiki is confusing, there is a comma what should be a / I think.

Edited by Macha
Link to comment
Share on other sites

What I normally do is use VOPs to go Quaternion to Matrix, followed by an Extract Transform VOP to get you the Euler rotations.

Edit: Whoops, that's exactly what's in Marc's link. ><

Edited by Darric
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...