Anda di halaman 1dari 6

Transformation matrix

From Wikipedia, the free encyclopedia

In linear algebra, linear transformations can be represented by matrices. If T is a linear transformation mapping Rn to
Rm and is a column vector with n entries, then

for some mn matrix A, called the transformation matrix of T. There is an alternative expression of transformation
matrices involving row vectors that is preferred by some authors.

Contents
1 Uses
2 Finding the matrix of a transformation
2.1 Eigenbasis and diagonal matrix
3 Examples in 2D graphics
3.1 Rotation
3.2 Scaling
3.3 Shearing
3.4 Reflection
3.5 Orthogonal projection
4 Examples in 3D graphics
4.1 Rotation
4.2 Reflection
5 Composing and inverting transformations
6 Other kinds of transformations
6.1 Affine transformations
6.2 Perspective projection
7 See also
8 References
9 External links

Uses
Matrices allow arbitrary linear transformations to be represented in a consistent format, suitable for computation. This
also allows transformations to be concatenated easily (by multiplying their matrices).

Linear transformations are not the only ones that can be represented by matrices. Some transformations that are non-
linear on a n-dimensional Euclidean space Rn, can be represented as linear transformations on the n+1-dimensional
space Rn+1. These include both affine transformations (such as translation) and projective transformations. For this
reason, 44 transformation matrices are widely used in 3D computer graphics. These n+1-dimensional transformation
matrices are called, depending on their application, affine transformation matrices, projective transformation matrices,
or more generally non-linear transformation matrices. With respect to an n-dimensional matrix, an n+1-dimensional
matrix can be described as an augmented matrix.

In the physical sciences, an active transformation is one which actually changes the physical position of a system, and
makes sense even in the absence of a coordinate system whereas a passive transformation is a change in the coordinate
description of the physical system (change of basis). The distinction between active and passive transformations is
important. By default, by transformation, mathematicians usually mean active transformations, while physicists could
mean either.

Put differently, a passive transformation refers to observation of the same event from two different coordinate frames.
Finding the matrix of a transformation
If one has a linear transformation in functional form, it is easy to determine the transformation matrix A by
transforming each of the vectors of the standard basis by T, then inserting the results into the columns of a matrix. In
other words,

For example, the function is a linear transformation. Applying the above process (suppose that n = 2 in
this case) reveals that

It must be noted that the matrix representation of vectors and operators depends on the chosen basis. Therefore, similar
matrix will result in the other basis. Nevertheless, the method to find the components remains the same.

To elaborate, vector v can be represented in basis vectors, with coordinates


:

Now, express the result of action operator A upon , in the given basis:

The elements of matrix A are determined for given basis E by applying A to every (
is the ) and observing the response vector
. This equation defines the wanted elements, , of j-th
[1]
column of the matrix A.

In the n-dimensional space matrix action upon a vector requires nxn elementary multiplications.

Eigenbasis and diagonal matrix


Main articles: Diagonal matrix and Eigenvalues and eigenvectors

Yet, there is a special basis for an operator in which the components form a diagonal matrix and, thus, multiplication
complexity reduces to n. Being diagonal means that all coefficients but are zeros leaving only one term in the
sum above. The surviving diagonal elements, , are known as eigenvalues and designated with in the
defining equation, which reduces to . The resulting equation is known as eigenvalue equation.[2] The
eigenvectors and eigenvalues are derived from it via the characteristic polynomial.

With diagonalization, it is often possible to translate to and from eigenbases.


Examples in 2D graphics
Most common geometric transformations that keep the origin fixed are linear, including rotation, scaling, shearing,
reflection, and orthogonal projection; if an affine transformation is not a pure translation it keeps some point fixed, and
that point can be chosen as origin to make the transformation linear. In two dimensions, linear transformations can be
represented using a 22 transformation matrix.

Rotation

For rotation by an angle clockwise about the origin, the functional form is and
. Written in matrix form, this becomes:

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

Scaling

For scaling (that is, enlarging or shrinking), we have and . The matrix form is:

When , then the matrix is a squeeze mapping and preserves areas in the plane.

If or is greater than 1 in absolute value, the transformation stretches the figures in the corresponding direction; if
less than 1, it shrinks them in that direction. Negative values of or also flips (mirrors) the points in that direction.

Applying this sort of scaling times is equivalent to applying a single scaling with factors and .

More generally, any symmetric matrix defines a scaling along two perpendicular axes (the eigenvectors of the
matrix) by equal or distinct factors (the eigenvalues corresponding to those eigenvectors).

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

A shear parallel to the x axis has and . Written in matrix form, this becomes:

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

Reflection
Main article: Householder transformation
To reflect a vector about a line that goes through the origin, let be a vector in the direction of the line:

Orthogonal projection

To project a vector orthogonally onto a line that goes through the origin, let be a vector in the direction of
the line. Then use the transformation matrix:

As with reflections, the orthogonal projection onto a line that does not pass through the origin is an affine, not linear,
transformation.

Parallel projections are also linear transformations and can be represented simply by a matrix. However, perspective
projections are not, and to represent these with a matrix, homogeneous coordinates must be used.

Examples in 3D graphics
Rotation

The matrix to rotate an angle about the axis defined by unit vector (l,m,n) is[3]

Reflection
Main article: Householder transformation

To reflect a point through a plane (which goes through the origin), one can use
, where is the 3x3 identity matrix and is the three-dimensional unit vector for the surface
normal of the plane. If the L2 norm of and is unity, the transformation matrix can be expressed as:

Note that these are particular cases of a Householder reflection in two and three dimensions. A reflection about a line or
plane that does not go through the origin is not a linear transformation; it is an affine transformation.

Composing and inverting transformations


One of the main motivations for using matrices to represent linear transformations is that transformations can then be
easily composed (combined) and inverted.

Composition is accomplished by matrix multiplication. If A and B are the matrices of two linear transformations, then
the effect of applying first A and then B to a vector x is given by:
(This is called the associative property.) In other words, the matrix of the combined transformation A followed by B is
simply the product of the individual matrices. Note that the multiplication is done in the opposite order from the English
sentence: the matrix of "A followed by B" is BA, not AB.

A consequence of the ability to compose transformations by multiplying their matrices is that transformations can also
be inverted by simply inverting their matrices. So, A 1 represents the transformation that "undoes" A.

Other kinds of transformations


Affine transformations
To represent affine transformations with matrices, we can use homogeneous coordinates. This means representing a 2-
vector (x, y) as a 3-vector (x, y, 1), and similarly for higher dimensions. Using this system, translation can be expressed
with matrix multiplication. The functional form ; becomes:

All ordinary linear transformations are included in the set of affine transformations, and can be described as a simplified
form of affine transformations. Therefore, any linear transformation can be also represented by a general transformation
matrix. The latter is obtained by expanding the corresponding linear transformation matrix by one row and column,
filling the extra space with zeros except for the lower-right corner, which must be set to 1. For example, the clockwise
rotation matrix from above becomes:

Using transformation matrices containing homogeneous coordinates, translations can be seamlessly intermixed with all
other types of transformations. The reason is that the real plane is mapped to the w = 1 plane in real projective space,
and so translation in real Euclidean space can be represented as a shear in real projective space. Although a translation
is a non-linear transformation in a 2-D or 3-D Euclidean space described by Cartesian coordinates, it becomes, in a 3-D
or 4-D projective space described by homogeneous coordinates, a simple linear transformation (a shear).

When using affine transformations, the homogeneous component of a coordinate vector (normally called w) will never
be altered. One can therefore safely assume that it is always 1 and ignore it. However, this is not true when using
perspective projections.

Perspective projection
See also: Perspective projection

Another type of transformation, of importance in 3D computer graphics, is the perspective projection. Whereas parallel
projections are used to project points onto the image plane along parallel lines, the perspective projection projects
points onto the image plane along lines that emanate from a single point, called the center of projection. This means that
an object has a smaller projection when it is far away from the center of projection and a larger projection when it is
closer.

The simplest perspective projection uses the origin as the center of projection, and z = 1 as the image plane. The
functional form of this transformation is then ; . We can express this in homogeneous coordinates
as:
After carrying out the matrix multiplication, the homogeneous component wc will, in general, not be equal to 1.
Therefore, to map back into the real plane we must perform the homogeneous divide or perspective divide by dividing
each component by wc:

More complicated perspective projections can be composed by combining this one with rotations, scales, translations,
and shears to move the image plane and center of projection wherever they are desired.

See also
3D projection
Transformation (function)

References
1. ^ Nearing, James (2010). "Chapter 7.3 Examples of
Operators" (http://www.physics.miami.edu/~nearing/mathmethods/operators.pdf). Mathematical Tools for Physics
(http://www.physics.miami.edu/nearing/mathmethods). ISBN 048648212X. Retrieved January 1, 2012.
2. ^ Nearing, James (2010). "Chapter 7.9: Eigenvalues and
Eigenvectors" (http://www.physics.miami.edu/~nearing/mathmethods/operators.pdf). Mathematical Tools for Physics
(http://www.physics.miami.edu/nearing/mathmethods). ISBN 048648212X. Retrieved January 1, 2012.
3. ^ Szymanski, John E. (1989). Basic Mathematics for Electronic Engineers:Models and Applications. Taylor & Francis.
p. 154. ISBN 0278000681.

External links
The Matrix Page (http://web.archive.org/web/20091027131421/http://geocities.com/evilsnack/matrix.htm)
Practical examples in POV-Ray
Reference page (http://mathworld.wolfram.com/RotationMatrix.html) - Rotation of axes
Linear Transformation Calculator (http://www.idomaths.com/linear_transformation.php)
Transformation Applet
(http://www.wiley.com/legacy/products/subject/life/biological_anthropology/0471205079_virtual_reconstruction/ch
- Generate matrices from 2D transformations and vice versa.

Retrieved from "http://en.wikipedia.org/w/index.php?title=Transformation_matrix&oldid=554070691"


Categories: Computer graphics Matrices Transformation (function)

This page was last modified on 8 May 2013 at 03:50.


Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By
using this site, you agree to the Terms of Use and Privacy Policy.
Wikipedia is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.

Anda mungkin juga menyukai