1

Is the result of combining two quaternion rotations the same as that of two matrices and then converting that into a quaternion?

I have a quaternion (q1) and rotation matrix (m2) as input for a function (unfortunately non-negotiable) and would like to rotate the initial quaternion by the matrix resulting in a new quaternion. I have tried a fair few ways of doing this and have slightly bizarre results.

If I convert q1 into a matrix (m1), calculate m2.m1 and convert the result into a quaternion I get what is a likely quaternion result. However if I convert m2 into a quaternion using the exact same function and multiply those together (in both orders, I know it's non-commutative) I get something entirely different. I would like to realise the quaternion combination so that I can eventually SLERP from the current quaternion to the result.

All functions have come from here: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm and are being implemented in c++ and mathematica to test

1 Answer 1

2

There is an exact correspondence between 3x3 rotation matrices and unit quarternions, up to a sign change in the quarternion (the sign is irrelevant when in comes to performing rotation on 3D vectors).

This means that given two quarternions, q1, q2, and their corresponding matrices, m1, m2, the action of the quarternions on a vector v is the same as the action of the matrices on v:

q2*(q1*v*(q1^-1))*(q2^-1) = m2*m1*v

If your program does not achieve this result with an arbitrary vector v, there is likely an error in your formula somewhere.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much Chris. That equation is actually very helpful for testing my functions. I think my issue was slightly more fundamental (down to the handedness of my matrices) but this very much helped me spot that. Thanks again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.