From Math Images
2D Matrix Transformations
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.
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 transformation 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
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:
For scaling we have and . The matrix form is:
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:
2D Affine Transformations
Affine transformations are represented by transformation matrices that are one higher dimension then the regular transformations. For example a 2d shear transformation could be represented by the affine transformation matrix . The transformation performed by the affine transformation matrix can be found in the same manner as a regular transformation matrix with 1 extra dimension added on the matrix and vector or orignal points. Instead of performing the transformation on the points you would perform the transformation on the points . If you calculate the transformation you end up with where w is a value that you can discard if you are only interested in the (x,y) transformation.
2D Transformation applet
Examples in 3D Graphics
Objects in three dimensions can be transformed using transformation matrices in the same way as two dimensional objects. Three dimensional transformation matrices are 3x3 matrices. Three dimensional affine transformation matrices are 4x4 matrices.
For scaling we have , and . The matrix form is:
X axis rotation:
Y axis rotation:
Z axis rotation:
3d Transformation Applet