Transformations and Matrices
From Math Images
|Line 1:||Line 1:|
- This picture shows an example of four basic transformations (where the original teapot is a red wire frame). On the top left is a translation, which is essentially the teapot being moved. On the top right is a scaling. The teapot has been squished or stretched in each of the three dimensions. On the bottom left is a rotation. In this case the teapot has been rotated around the x axis and the z axis (veritcal). On the bottom right is a shearing, creating a skewed look.
Basic DescriptionWhen an object undergoes a transformation, the transformation can be represented as a matrix. Different transformations such as translations, rotations, scaling and shearing are represented mathematically in different ways. One matrix can also represent multiple transformations in sequence when the matrices are multiplied together.
Basic Transformations For Graphics
Computer graphics works by representing objects in terms of simple primitives that are manipulated with transformations that preserve some primitives’ essential properties. These properties may include angles, lengths, or basic shapes. Some of these transformations can work on primitives with vertices in standard 2D or 3D space, but some need to have vertices in homogeneous coordinates. The general graphics approach is to do everything in homogeneous coordinates, but we’ll talk about the primitives in terms of both kinds when we can.
The most fundamental kinds of transformations for graphics are rotation, scaling, and translation. There are also a few cases when you might want to use shear transformations, so we’ll talk about these as well.
A More Mathematical Explanation
- Note: understanding of this explanation requires: *stacks
Linear Transformations Are MatricesA linear transformation on 2D (or 3D) space is a function f f [...]
Linear Transformations Are Matrices
A linear transformation on 2D (or 3D) space is a function f from 2D (or 3D) space to itself that has the property that
Since points in 2D or 3D space can be written as or with , , and the coordinate vectors, then we see that or
This tells us that the linear transformation is completely determined by what it does to the coordinate vectors.
Let’s see an example of this: if the transformation has the following action on the coordinates:
then for any point we have:
From this example, we see that the linear transformation is exactly determined by the matrix whose first column is , whose second column is , and whose third column is , and that applying the function f is exactly the same as multiplying by the matrix. So the linear transformation is the matrix multiplication, and we can use the concepts of linear transformation and matrix multiplication interchangeably.
Transformation Composition Is Matrix Multiplication
Transformations are usually not used by themselves, especially in graphics, so you need to have a way to compose transformations, as in . But if G is the matrix for the transformation g, and F is the matrix for the transformation f, then the matrix product G*F is the matrix for the composed functions gf.
For example, we have the translation represented by the matrix
which represents a move two units in the x direction and one unit in the y direction. If we want to then rotate the same object with the matrix
we can represent the combination of the two actions with a single composed matrix. This matrix is found by multiplying the second action by the first action.
So this matrix represents moving, then rotating an object in sequence.
In the example below, the teapot on the left has just been translated by the translation matrix above. The next image is just the rotation from the rotation images. The two images that follow are the translation then rotation and rotation then translation respectively. This demonstrates the combination of different transformations and how they must be done in the right order.
Transformations and Graphics Environments
- There are currently no teaching materials for this page. Add teaching materials.
Page written by Steve Cunningham.
Leave a message on the discussion page by clicking the 'discussion' tab at the top of this image page.
Messages to the Future
When there is a page for 2D, 3D, 4D real spaces; affine spaces; homogeneous coordinates, this page should link to that page (to the homogeneous coordinates section).