Transformation matrix Guide, Meaning , Facts, Information and Description
In mathematics, in particular in linear algebra and geometry, a linear transformation can be represented by matrix multiplication. If A is a matrix and x a column vector,
- T(x) = Ax
The linear transformation T(x,y) = (x,y) would be represented by the identity matrix. T(x) = Ix = x, and would be known as the identity operator. It is useful, many times, to represent a transformation by using a matrix. It makes the calculations go quicker, and can make combining transformations much easier, such as for compositions of transformations.
| Table of contents |
|
|
In two dimensions, linear transformations can be represented using a 3×3 transformation matrix. Such transformations are useful, for example, in 2D computer graphics where translation corresponds to scrolling and scaling corresponds to zooming.
For translation (that is, moving all points a fixed amount horizontally and/or vertically), we have and for all points . The corresponding transformation matrix calculation is:
For scaling (that is, enlarging or shrinking), we have and , and the matrix form is:
For shearing (for example, slanting a figure), we have and , and the matrix form is:
For rotation by an angle A counterclockwise about the origin, we have and , and the matrix form is:
For reflection (that is, a mirror image) about one or both axes, simply use a scale factor of -1 for zx and/or zy (see Scaling above).
It is important to note that transformation matricies can be combined using ordinary matrix multiplication. For example, if we want to both translate and scale all points, we could apply the two appropriate matrices from above to each point; but a better way would be to multiply the two matrices to get a new, combined transformation matrix and then apply that single new matrix to each point.
Multiplying transformation matrices results in a composition of the transformations. In general, matrix multiplication is not commutative, so the order of multiplication is important. Transforming with the product matrix A × B is equivalent to transforming with B first and then A.
An important special-case composite transformation represents translation by followed by scaling by . The matrix for this is simply:
Once a transformation matrix (call it T) has been calculated, for each point can be calculated using the rules for matrix multiplication. Note that all transformation matricies considered here have the third column equal to .
It is possible to perform a reverse transformation by calculating the inverse of the matrix. This would be useful, for example, in 2D computer graphics to interpret a mouse-down event. To calculate the inverse U of T in the 2D case:
Example: 2D graphics
Translation
Scaling
Shearing
Rotation
Reflection
Composite transformations
Calculating coordinates
Reverse transformations
One can then calculate
using formulae analogous to the above (see Calculating coordinates).
