Affine transformation read order

25 Views Asked by At

I would like to ask a question about affine matrix transformations, specifically an explanation about why these two ways to interpret them are equivalent.

Suppose I have (in 2D for simplicity) an usual translation matrix T and a rotation matrix R as follows: $$ T=\begin{bmatrix}1 & 0 & tx\\0 & 1 & ty\\ 0 & 0 & 1\end{bmatrix} R=\begin{bmatrix}\cos \theta & -\sin\theta & 0\\\sin\theta & \cos\theta & 0\\ 0 & 0 & 1\end{bmatrix} $$

Suppose for example: $$ tx=0,ty=2,θ=45∘ $$

Now if I transform a quad applying translation and rotation to every vertex in this order: R * T * Vertex (Column vector), I obtain this:

After Translation

After Rotation

Reading the transforms left-to-right both translation and rotation transforms are done around the origin, considering T first and R after. However this is equivalent to considering the same equation reading it right-to-left R first and T after, transforming the quad relative to itself and not the origin:

After Rotation

After Translation

The result is the same. What is a mathematical explanation about why these two ways of reading the same affine transform composition are equivalent?