# Matrix transformations

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

• – Shaun Jun 26 '14 at 19:20

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.

• Thanks, but I do the translation after the rotation in M1. Does it change something? Sorry, I'm very bad with matrix. – Mayhem50 Jun 26 '14 at 19:20
• Do you use matrices like this: $x \mapsto M_1 x$ or this: $x \mapsto x M_1$? – Omnomnomnom Jun 26 '14 at 19:22
• And yes, that would change something. The way you wrote your matrix product seems to contradict what you're saying now – Omnomnomnom Jun 26 '14 at 19:23
• It should be $xM1$ cause I take my point and apply tranformations to it. – Mayhem50 Jun 26 '14 at 19:28
• 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. – Omnomnomnom Jun 26 '14 at 19:31