Jump to content
  • Advertisement
Sign in to follow this  
marquito

Rotation Matrix - quaternions

This topic is 4837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I have the following question regarding quaternions since i'm pretty new to this field. The situation is the following: I have two local coordinate systems T1 and T2. I'd like to calculate the angles i need to move T1 into T2. This is easiely done by calculating the rotation matrix: R = T2^-1 * T1 and extracting the euler angles from R. There are two known problems: 1. you always get 2 angle-triplets and have to choose 2. gimbal lock, if rotation around second axis is ~90°. I heard about quaternions and that they don't suffer of those problems. How can I use them in this special case? Do I have to transform T1 and T2 to quaternions, calculate the "rotation" quaternion and convert it back to euler angles? Would this work and how? To make things clearer: I already know the two matrices T1 and T2, what is unknown are the 3 angles for transformation (i need only orientation, not translation). Thanks in advanced! marquito

Share this post


Link to post
Share on other sites
Advertisement
If 'slerp'-ing efficiently is important you might choose to use quaternions, but otherwise matrices should work fine.

Whichever you use, my question would be, why do you want to use Euler angles as an intermediary? Unless there's more to it than what you've posted, this seems like an unnecessary complication.

Share this post


Link to post
Share on other sites
Quote:
Original post by jyk
Whichever you use, my question would be, why do you want to use Euler angles as an intermediary? Unless there's more to it than what you've posted, this seems like an unnecessary complication.


What we do is capturing motion of the upper human body. Those movements are shown as euler-angles. For this we are able to calculate local coordinate systems in each joint, for example the ellbow and shoulder. If you move now your upper arm, the orientation of the ellbow coordinate system (E) to the shoulder coord. system (S) changes (in each frame). For each frame you can then calculate the rotation matrix, extract from it the euler angles and finally say, how the arm was moved (f.e. 60° around x, 35° around y, 50° around z-axes of S).
We use a euler representation, because they are very intuitive.

The Problem is: when a person moves his arm around the y-Axes with 90°, you can't tell what the other 2 angles were because of gimbal lock. Another problem is, that you always get 2 angle-triplets from R.

I was hoping to find a solution for both problems with quaternions. Since they are also used in computer games I thought that maybe somebody could help me here :-)

Interpolation is not important. We treat each frame independently and dont use data from already processed frames for the angle extraction.



Share this post


Link to post
Share on other sites
I'd advise you to store the orientations in quaternion - even if you do find an acceptable way to work with euler angles, it might not work in all cases, and might cause you more headache than the problem warrants.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!