Skip to content

12. 2D Transformations - 2

Dated: 12-05-2025

Homogeneous Coordinates

All the transformations can be summed up into

\[\vec P^\prime = \textbf A_{2 \times 2} \cdot \vec P + \textbf B_{2 \times 1}\]

We can eliminate \(\textbf B_{2 \times 1}\) by extending \(\textbf A_{2 \times 2}\) into \(\textbf A_{3 \times 3}\).
The coordinates need to be translated to a homogeneous triplet.

\[(x, y) \to (x_h, y_h, h)\]

Where

\[x = \frac{x_h} h, \quad y = \frac{y_h} h\]

For simplicity,

\[h = 1 \implies (x, y, 1)\]

Translation

\[ \begin{bmatrix} x^\prime \\ y^\prime \\ 1 \end{bmatrix} = \begin{bmatrix} 1 & 0 & t_x\\ 0 & 1 & t_y\\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x\\ y\\ 1 \end{bmatrix} \]
\[ \vec P^\prime = \textbf T(t_x, t_y) \cdot \vec P \]

Rotation

\[ \begin{bmatrix} x^\prime \\ y^\prime \\ 1 \end{bmatrix} = \begin{bmatrix} \cos \theta & -\sin\theta & 0\\ \sin \theta & \cos \theta & 0\\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x\\ y\\ 1 \end{bmatrix} \]
\[ \vec P^\prime = \textbf R(\theta) \cdot \vec P \]

Scaling

\[ \begin{bmatrix} x^\prime \\ y^\prime \\ 1 \end{bmatrix} = \begin{bmatrix} S_x & 0 & 0\\ 0 & S_y & 0\\ 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x\\ y\\ 1 \end{bmatrix} \]
\[ \vec P^\prime = \textbf S(S_x, S_y) \cdot \vec P \]

Composition

Imagine we have a vector1 \(\vec V\) and 3 transformations \(\textbf A, \textbf B\) and \(\textbf C\).
Although, we can apply transformations as \(\textbf A\), then followed by \(\textbf B\) and then followed by \(\textbf C\).

\[\textbf C (\textbf B (\textbf A \cdot \vec V))\]

Due to associative property of matrices.2

\[\textbf {M} (\vec V)\]

Where

\[\textbf M = \textbf {CBA}\]

References


  1. Read more about vectors

  2. Read more about matrices