Introduction to Computer Graphics
Lecture 3
2-D Affine Transformations
Don Herbison-Evans
donherbisonevans@yahoo.com
(updated 29 August 2006)
Affine transformations are those for which straight lines stay straight after the transformation.
Basic Transformations
|
x2 = -x1 y2 = y1 | or |
x2 = x1 y2 = -y1 | or |
x2 = -x1 y2 = -y1 |
Note that the last one is actually a rotation through 180 degrees!
Unification
Augment each point to be a 3D row vector by adding a third unit coordinate :
All 5 transformations can then be performed using a 3x3 array of 9 coefficients
with m[2][0] = 0; m[2][1] = 0; m[2][2] = 1;
and the remaining 6 coefficients doing all the work.
A transformation can then be abbreviated to :
A property of this unification is that if
then
The elements of M31 can be derived from those of M32 and M21 in a simple fashion:
In mathematics, M is called a matrix , and the combining of two such matrices in this way is called matrix multiplication.
This is very important for computer graphics. For scenes containing many points being viewed by a series of transformations, each point need only be transformed by one combined matrix instead of a succession of matrices.
Inverse Transformations
Each of the 5 basic transformations has an inverse, written M-1 :
Note that if M1 = M2-1 then M2 = M1-1
The product of a matrix with its inverse is called the Unit or Identity matrix :
| ( 1 0 0 ) | |
| I = | ( 0 1 0 ) |
| ( 0 0 1 ) |
Similarity Transformations
In a triple matrix product: if the first and third transformations are the inverse of each other, the the second transformation is said to be undergoing a similarity transformation, eg
Rows versus Columns
If the vector had been written as a column instead of a row:
| ( x ) | |
| x = | ( y ) |
| ( h ) |
then the rows and columns need to be interchanged (transposed) in the previous algebra, and matrices are applied to the left of a vector instead of the right :
and matrices are concatenated on the left instead of the right :
A matrix that is the same when its rows and columns are transposed
is said to be symmetric.
For example the matrices for scaling and reflection are symmetric.
The transpose of a rotation matrix is its inverse.