Doing a complex 2D transformation

70 Views Asked by At

Given the following graphical representation of shape that has been transformed:

Transformation

What is the final transformation matrix for it?

I am doing the following:

Translate center to origin: $ T_1=\begin{bmatrix} 1 & 0 & -0.5 \\ 0 & 1 & -0.5 \\ 0 & 0 & 1 \\ \end{bmatrix} $

Scale : $S = \begin{bmatrix} 4 & 0 & 0 \\ 0 & 5 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} $

Then some kind of rotation should occur after : $R=?$

Then finally another translation to the point $M=(4,5)$ : $ T_2 = \begin{bmatrix} 1 & 0 & 4 \\ 0 & 1 & 5 \\ 0 & 0 & 1 \\ \end{bmatrix} $

Any ideas what's the easiest approach to figure out $R$ ?

1

There are 1 best solutions below

5
On

Let's forget the translation first and consider the figure where the transformed house has its lower-left corner at the origin.

You can represent $v_x'$ using polar coordinates:

$$v_x' = \begin{bmatrix} R\cos(\theta) \\ R\sin(\theta) \end{bmatrix}$$

where $\theta$ is the angle of rotation and $R$ the scaling factor. From the figure $R=4$ and $\theta=\frac{\pi}{4}$. Therefore, $v_x'=\begin{bmatrix} 2\sqrt{2}\\ 2\sqrt{2} \end{bmatrix}$.

Now, $v_y'$ is vertical, so $v_y'=\begin{bmatrix} 0 \\ h \end{bmatrix}$ for some real number $h$. Using the right triangle in the figure with side $5$ and taking $\theta=\frac{\pi}{4}$, we got $h=5\sqrt{2}$. Therefore, $v_y'=\begin{bmatrix} 0 \\ 5\sqrt{2} \end{bmatrix}$.

This means that the linear transformation (without the translation) is

$$\begin{bmatrix} x\\y\end{bmatrix} \mapsto \begin{bmatrix} 2\sqrt{2} & 0 \\ 2\sqrt{2} & 5\sqrt{2} \end{bmatrix}\begin{bmatrix} x\\y\end{bmatrix}$$

Finally, the translation sends $\begin{bmatrix} 0\\ 0\end{bmatrix}$ onto $\begin{bmatrix} 4-\sqrt{2}\\ 5-\frac{7\sqrt{2}}{2}\end{bmatrix}$ so can be represented by the vector $\begin{bmatrix} 4-\sqrt{2}\\ 5-\frac{7\sqrt{2}}{2}\end{bmatrix}$ and the transformation you are looking for is

$$ \begin{bmatrix} x\\y\end{bmatrix} \mapsto \begin{bmatrix} 4-\sqrt{2}\\ 5-\frac{7\sqrt{2}}{2}\end{bmatrix} + \begin{bmatrix} 2\sqrt{2} & 0 \\ 2\sqrt{2} & 5\sqrt{2} \end{bmatrix}\begin{bmatrix} x\\y\end{bmatrix} = \begin{bmatrix} 4-\sqrt{2} + 2x\sqrt{2} \\ 5-\frac{7\sqrt{2}}{2} + 2x\sqrt{2} + 5y\sqrt{2} \end{bmatrix} $$