# Geometry - Transformation Matrix

### Table of Contents

## About

A geometric transformation can be represented by a matrix.

THE advantage of using transformation matrices is that cumulative transformations can be described by simply multiplying the matrices that describe each individual transformation.

To represent affine transformations with matrices, homogeneous coordinates are used. This means representing a 2-vector (x, y) as a 3-vector (x, y, 1), and similarly for higher dimensions.

## Articles Related

## Structure for a 2D

A 3 × 3 matrix that describes how an object is to be transformed in a 2D plane where:

- the upper-right 1 × 2 sub-matrix controls translations

In non-matrix form (linear), we have the transformation: <MATH> \begin{array}{rrl} x' & = & ax + cy + e \\ y' & = & bx + dy + f \\ \end{array} </MATH>

which is equivalent in matrix form to

<MATH> \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} = \begin{bmatrix} ax + cy + e\\ bx + dy + f \\ 1 \end{bmatrix} </MATH>

where (x', y') is the new coordinate of a point at (x, y).

For:

- a translation: e is magnitude of a translation in the x direction and f is magnitude of a translation in the y direction.
- scaling, a and d are the scale factors for the x and y directions, respectively.
- a pure rotation, a = d = sin(theta) and b = -c = cos(theta) where theta is the angle of the desired rotation.
- skewing, c and b control skewing parallel to the x and y axes, respectively.