11. 2D Transformations 1
Dated: 12-05-2025
Basic Transformations
Geometric transformations
involve changing
- Position
- Orientation
- Size
Translation
Changing position is called translation
.
If an object is at coordinates
\(O = (x, y)\), we can write it in vector
1 form as \(\vec O = \langle x, y\rangle\) or even in matrix
2 form
\[
\textbf{O} =
\begin{bmatrix}
x \\
y
\end{bmatrix}
\]
After moving the object, the new coordinates are
\[
\textbf{O}^\prime =
\begin{bmatrix}
x^\prime \\
y^\prime
\end{bmatrix}
\]
\[\textbf{O}^\prime = \textbf{O} + \textbf{T}\]
Where \(\textbf{T}\) is the amount of units \(\textbf{O}\) changes.
\[
\textbf{T} =
\begin{bmatrix}
t_x \\
t_y
\end{bmatrix}
\]
Rotation
Changing orientation is called rotation
.
Imagine an object, initially at \(\vec P = \langle x, y\rangle\) where \(\vec P\) makes an angle
\(\Phi\) with respect to \(x\) axis.
Orientation after rotating \(\theta\) angle
\(|\vec P| = |\vec{P^\prime}|\) as they are position vectors
.1
\[
\vec P =
\begin{bmatrix}
x \\
y
\end{bmatrix}
=
\begin{bmatrix}
|\vec P| \cos(\Phi) \\
|\vec P| \sin(\Phi) \\
\end{bmatrix}
\]
\[\Downarrow\]
\[
\vec P^\prime =
\begin{bmatrix}
x^\prime \\
y^\prime
\end{bmatrix}
=
\begin{bmatrix}
|\vec P| \cos(\theta + \Phi) \\
|\vec P| \sin(\theta + \Phi) \\
\end{bmatrix}
\]
\[
=
\begin{bmatrix}
|\vec P|\left(\cos \Phi \cos \theta - \sin \Phi \sin \theta\right)\\
|\vec P|\left(\cos \Phi \sin \theta + \sin \Phi \cos \theta\right)
\end{bmatrix}
\]
\[
=
\begin{bmatrix}
|\vec P|\cos \Phi \cos \theta - |\vec P|\sin \Phi \sin \theta\\
|\vec P|\cos \Phi \sin \theta + |\vec P|\sin \Phi \cos \theta
\end{bmatrix}
\]
\[
=
\begin{bmatrix}
x\cos \theta - y\sin \theta\\
y\cos \theta + x\sin \theta
\end{bmatrix}
\]
\[
=
\begin{bmatrix}
x\cos \theta - y\sin \theta\\
x\sin \theta + y\cos \theta
\end{bmatrix}
\]
\[
=
\begin{bmatrix}
x\cos \theta + y(-\sin \theta)\\
x\sin \theta + y\cos \theta
\end{bmatrix}
\]
\[
=
\begin{bmatrix}
x \cos \theta\\
x \sin \theta\\
\end{bmatrix}
+
\begin{bmatrix}
y (-\sin \theta)\\
y \cos \theta\\
\end{bmatrix}
\]
\[
=
x
\begin{bmatrix}
\cos \theta\\
\sin \theta\\
\end{bmatrix}
+ y
\begin{bmatrix}
-\sin \theta\\
\cos \theta\\
\end{bmatrix}
\]
\[
=
\begin{bmatrix}
\cos \theta & - \sin \theta \\
\sin \theta & \cos \theta
\end{bmatrix}
\begin{bmatrix}
x \\
y
\end{bmatrix}
\]
\[\vec P^\prime = \textbf R \cdot \vec P\]
Scaling
Changing size is called scaling
.
\[\vec P^\prime = \textbf S \cdot \vec P\]
\[
\begin{bmatrix}
x^\prime \\
y^\prime
\end{bmatrix}
=
\begin{bmatrix}
S_x & 0\\
0 & S_y
\end{bmatrix}
\begin{bmatrix}
x\\
y
\end{bmatrix}
\]
\[
\begin{aligned}
x^\prime = x S_x \\
y^\prime = y S_y
\end{aligned}
\]