Sign in to follow this  
Nairou

Comparing quaternion rotations

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this