42/45

Affine transform matrix

With the extra dimension (in 2D):

  • Translation \(T\), rotation \(R\), scaling \(S\) can be composed as matrix products representation

  • ex. \(\mathrm{M}=T_0\,R_0\,S_0\,T_1\,R_1\,S_1\,\dots\;\;\;\;\) \(\small \mathrm{M}= \left( \begin{array}{cc|c} \color{red}{m_{00}} & \color{red}{m_{01}} & \color{blue}{t_x} \\ \color{red}{m_{10}} & \color{red}{m_{11}} & \color{blue}{t_y} \\ \hline 0 & 0 & 1 \end{array} \right) \).

  • \(\color{red}{m_{ij}}\):linear part (rotation and scaling); \(\color{blue}{t_{x/y}}\):translation part

Similar in 3D but with 4-components vectors, and \(\bf 4\times 4\) matrices.

  • \(p=(x,y,z,1)\) - represents 3D position

  • \( \small \mathrm{M}= \left( \begin{array}{ccc|c} \color{red}{m_{00}} & \color{red}{m_{01}} & \color{red}{m_{02}} & \color{blue}{t_x} \\ \color{red}{m_{10}} & \color{red}{m_{11}} & \color{red}{m_{12}} & \color{blue}{t_y} \\ \color{red}{m_{20}} & \color{red}{m_{21}} & \color{red}{m_{22}} & \color{blue}{t_z} \\ \hline 0 & 0 & 0 & 1 \end{array} \right) \) - represents 3D affine transformation (rotation, scaling, translation)

  • Note: vectors and points can be expressed

    • 3D point \((x,y,z,1)\) - translation applies.

    • 3D vector \((x,y,z,0)\) - translation doesn’t apply.