0
$\begingroup$

I have to find components of a matrix for 3D transformation. I have a first system in which transformations are made by multiplying:

$M_1 = [Translation] \times [Rotation] \times [Scale]$

I want to have the same transformations in an engine who compute like this:

$M_2 = [Rotation] \times [Translation] \times [Scale]$

So when I enter the same values there's a problem due to the inversion of translation and rotation.

How can I compute the values in the last matrix $M_2$ for having the same transformation?

Thanks

$\endgroup$
0
$\begingroup$

I assume you multiply matrices on the left, so that $x$ is mapped to $M_1 x$ and $x$ is a column vector.

Let $T_R(x) = Rx$ be a rotation, and let $T_T(x) = x+b$ be a translation. We have $$ T_R(T_T(x)) = R(x + b) = Rx + Rb\\ T_T(T_R(x)) = T_Rx + b $$ If you want to have the second behave like the first, you have to "prerotate" the translation before applying it. That is, let $T_{T'}(x) = x + Rb$. We then have: $$ T_{T'}(T_R(x)) = Rx + Rb $$ which matches the first output.


In the below, I assume you multiply matrices on the right, so that $x$ is mapped to $x \, M_1$, $x$ is a row vector, and successive transformations are done from left to right.

Let $T_R(x) = xR$ be a rotation, and let $T_T(x) = x+b$ be a translation. We have $$ T_T(T_R(x)) = xR + b\\ T_R(T_T(x)) = (x + b)R = xR + bR $$ If you want to have the second behave like the first, you have to "un-rotate" the translation before applying it. That is, let $T_{T'}(x) = x + bR^{-1} = x+b R^T$. We then have: $$ T_R(T_{T'}(x)) = (x + bR^T)R = xR + bR^T R = Rx + b $$ which matches the first output.

$\endgroup$
  • $\begingroup$ Thanks, but I do the translation after the rotation in M1. Does it change something? Sorry, I'm very bad with matrix. $\endgroup$ – Mayhem50 Jun 26 '14 at 19:20
  • $\begingroup$ Do you use matrices like this: $x \mapsto M_1 x$ or this: $x \mapsto x M_1$? $\endgroup$ – Omnomnomnom Jun 26 '14 at 19:22
  • $\begingroup$ And yes, that would change something. The way you wrote your matrix product seems to contradict what you're saying now $\endgroup$ – Omnomnomnom Jun 26 '14 at 19:23
  • $\begingroup$ It should be $xM1$ cause I take my point and apply tranformations to it. $\endgroup$ – Mayhem50 Jun 26 '14 at 19:28
  • $\begingroup$ Well the question is whether you apply transformations from left to right or from right to left. It seems you go from left to right, which is contrary to the typical mathematical convention. $\endgroup$ – Omnomnomnom Jun 26 '14 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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