# Transformation Matrix

### From Math Images

Line 1: | Line 1: | ||

- | A '''transformation matrix''' is a special matrix used in linear algebra and computer graphics | + | A '''transformation matrix''' is a special matrix that can describe 2d and 3d transformations. Transformations are frequently used in linear algebra and computer graphics, since transformations can be easily represented, combined and computed. |

- | + | ===Computing Transformations=== | |

- | + | If you have a transformation matrix you can evaluate the transformation that would be performed by multiplying the transformation matrix by the original array of points. For example in 2d suppose you had a trandformation matrix of <math>\begin{bmatrix} a & b \\ c & d \end{bmatrix}</math> then the transfomations of the points <math>\begin{bmatrix} x \\ y \end{bmatrix}</math> would be <math>\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} a & b \\ c & d \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix}</math>. Similarly, to perform 3d transformation <math>\begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}</math> on the points <math>\begin{bmatrix} x \\ y \\ z \end{bmatrix}</math> you would use <math>\begin{bmatrix} x' \\ y' \\ z' \end{bmatrix} = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}\begin{bmatrix} x \\ y \\ z \end{bmatrix}</math> | |

- | + | ||

- | + | ||

- | + | ||

===Examples in 2D Graphics=== | ===Examples in 2D Graphics=== | ||

In 2D graphics Linear transformations can be represented by 2x2 matrices. Most common transformations such as rotation, scaling, shearing, and reflection are linear transformations and can be represented in the 2x2 matrix. Other affine transformations can be represented in a 3x3 matrix. | In 2D graphics Linear transformations can be represented by 2x2 matrices. Most common transformations such as rotation, scaling, shearing, and reflection are linear transformations and can be represented in the 2x2 matrix. Other affine transformations can be represented in a 3x3 matrix. |

## Revision as of 15:23, 25 August 2009

A **transformation matrix** is a special matrix that can describe 2d and 3d transformations. Transformations are frequently used in linear algebra and computer graphics, since transformations can be easily represented, combined and computed.

## Contents |

### Computing Transformations

If you have a transformation matrix you can evaluate the transformation that would be performed by multiplying the transformation matrix by the original array of points. For example in 2d suppose you had a trandformation matrix of then the transfomations of the points would be . Similarly, to perform 3d transformation on the points you would use

### Examples in 2D Graphics

In 2D graphics Linear transformations can be represented by 2x2 matrices. Most common transformations such as rotation, scaling, shearing, and reflection are linear transformations and can be represented in the 2x2 matrix. Other affine transformations can be represented in a 3x3 matrix.

#### Rotation

For rotation by an angle θ clockwise about the origin, the functional form is x' = xcosθ + ysinθ and y' = − xsinθ + ycosθ. Written in matrix form, this becomes:

Similarly, for a rotation counterclockwise about the origin, the functional form is and and the matrix form is:

#### Scaling

For scaling we have and . The matrix form is:

#### Shearing

For shear mapping (visually similar to slanting), there are two possibilities. For a shear parallel to the *x* axis has and ; the shear matrix, applied to column vectors, is:

A shear parallel to the *y* axis has and , which has matrix form:

### Composing transformations

### 2D Affine Transformations

Affine transformations are represented by (x,y,1) and a 3x3 matrix instead of a 2x2 matrix.