transformation matrix for points translations


Rotation

For rotation by an angle θ clockwise about the origin, the functional form is x' = x \cos \theta + y \sin \theta and y' = - x \sin \theta + y \cos \theta. Written in matrix form, this becomes:


\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} \cos \theta &  \sin\theta \\ -\sin \theta & \cos \theta \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
Similarly, for a rotation counter clockwise about the origin, the functional form is x' = x \cos \theta - y \sin \theta and y' = x \sin \theta + y \cos \theta and the matrix form is:

\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} \cos \theta &  - \sin\theta \\ \sin \theta & \cos \theta \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}

Scaling

For scaling (that is, enlarging or shrinking), we have x' = s_x \cdot x and y' = s_y \cdot y. The matrix form is:


\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} s_x & 0 \\ 0 & s_y \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
When \ s_x s_y = 1, no change in size
when  > 1 , size increases
when  < 1 , size decreases


Shearing

For shear mapping (visually similar to slanting), there are two possibilities.

A shear parallel to the x axis has x' = x + ky and y' = y. Written in matrix form, this becomes:

\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} 1 & k \\ 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
A shear parallel to the y axis has x' = x and y' = y + kx, which has matrix form:

\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ k & 1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
reference https://en.wikipedia.org/wiki/Transformation_matrix

Comments

Popular Posts