General principle in the 2D case
Example for a point \(p=(x,y)\)
- Rotation \(\mathrm{R}=\left(\begin{array}{rr}\cos(\theta) & \sin(\theta) \\-\sin(\theta) & \cos(\theta)\end{array}\right), \;\;\;\) Scaling
\(\mathrm{S}=\left(\begin{array}{rr}a & 0 \\ 0 & b \end{array} \right), \;\;\; \) Translation \((x+t_x, y+t_y)\) (not linear)
- Cannot express conveniently composition b/w several rotation, scaling, translation.
Trick - Add an extra coordinates to points \(p=(x,y,1)\) (homogeneous coordinates).
- Then translation can be expressed linearly \(p'=\mathrm{T}\,p\), with \( p'= \underbrace{\left(\begin{array}{rrr}1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0
& 1\end{array}\right)}_{\mathrm{T}} \left(\begin{array}{r}x\\y\\1\end{array}\right)=\left(\begin{array}{c}x+t_x \\ y+t_y \\ 1\end{array}\right) \)
- Similarily with rotation \( \mathrm{R}= \left( \begin{array}{rrr} \cos(\theta) & \sin(\theta) & 0\\ -\sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 1
\end{array} \right), \;\;\; \) and scaling \(\mathrm{S}= \left( \begin{array}{rrr} a & 0 & 0 \\ 0 & b & 0 \\ 0 & 0 & 1 \end{array} \right) \).