I'm interested in implementing a clean solution providing an alternative to 4x4 matrices for 3D transformation. Quaternions provide the equivalent of rotation, but no translation. Therefore, in addition to a Quaternion, you need an additional vector of translations (tx,ty,tz). I have always seen it stated that you need 12 values for the matrix representation, and only 7 for the quaternion-based representation.
What I don't understand is how to manipulate the translation values.
For rotation of a quaternion, no problem.
For a vector v, an axis vector x, and an angle a:
q = cos(a/2) + x sin(a/2)
To rotate the vector:
v' = qvq^-1
For multiple rotations, you can apply the transformations to the quaternion, and only when you have the final rotation do you have to apply it to the data. This is why matrix transformation is so nice in 3d graphics systems.
Ok, so now if translation enters into it, what do I do?
A given vector transformation is:
T = (tx,ty,tz)
v' = qvq^-1 + T
If I want to apply a rotation and translation operation to this, I would have to modify T and q. What should the result be?
Well, I don't know quaterions from Adam, but I do know that these are linear operations. So if you have one (rotate,translate) operation (q,T), and another (r,U), and you apply them in that order, the total transformation is:
r(qvq^-1 + T)r^-1 + U
Distribute r over the stuff in parens from the left:
(rqvq^-1 + rT)r^-1 + U
Then distribute r^-1 from the right:
rqvq^-1r^-1 + rTr^-1 + U
And re-arrange slightly:
= (rq)v((rq)^-1) + (rTr^-1 + U)
So this composition is equivalent to a single (rotate,translate) of (rq, rTr^-1 + U). And if you can compose 2 of them, you can compose N of them.
Does this help at all, or did I misunderstand the question?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With