• Advertisement
Sign in to follow this  

Comparing quaternion rotations

This topic is 3104 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

While trying to compare quaternion rotations, I came across a result that doesn't make sense to me. I'm hoping someone here can explain it to me (or point me to a reference that explains it -- I don't know what to call it in order to do a search). Essentially, to break it down to the core issue, I took an identity quaternion: [ 0 0 0 1 ] (in x,y,z,w format) And rotated it 360 degrees (2 * pi). I expected the result to be identity still, as it had come full circle. Instead, I ended up with this: [ 0 0 -3.25841e-007 -1 ] Or, ignoring floating point errors: [ 0 0 0 -1 ] Why did the sign change? Does the sign not matter in this case? How can you reliably compare two quaternions if the signs might arbitrarily not match? Is there a way to "correct" a rotated quaternion so the signs are not so random? Or am I missing something else here? Any input would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
A quaternion that represents a rotation of alpha around an axis (x, y, z) has the form: x * sin(alpha/2), y * sin(alpha / 2), z * sin(alpha / 2), cos(alpha/2). For alpha = 0, sin(alpha/2) is 0 and cos(alpha/2) is 1, so gives the quaternion (0, 0, 0, 1). For alpha = 360, sin(alpha/2) is still 0, but cos(alpha/2) is -1, so the quaternion is (0, 0, 0, -1).

Share this post


Link to post
Share on other sites
The change in sign after one full 360-degree rotation can be seen as the result of lifting a path in the group of 3D rotations SO(3) to its universal covering space SU(2). There are some details here: http://en.wikipedia.org/wiki/SU(2)

You can check if two quaternions are close to each other by checking if the absolute value of their dot product is close to 1.

Share this post


Link to post
Share on other sites
Thanks guys! It makes more sense now, and the dot product test is awesome.

I also found this article which explained it some as well.

Share this post


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

  • Advertisement