Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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 $(t_x,t_y,t_z)$. 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\left(\frac{a}{2}\right) + x \cdot \sin\left(\frac{a}{2}\right)$$ 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 = (t_x,t_y,t_z)$$ $$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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

To apply a subsequent rotation corresponding to $q_1$ and translation corresponding to $T_1$ to your $v'$, you'd just do it in terms of quaternion algebra: you'd get

$v''=q_1v'q_1^{-1}+T_1=q_1(qvq^{-1}+T)q_1^{-1}+T_1=(q_1q)v(q_1q)^{-1}+q_1Tq_1^{-1}+T_1$

Thus, as you say, it is possible to do the computations on the transformations cumulatively, and then apply it to the data, to avoid cumulative distortion in the data.

(edited to correct original typo in formula)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.