16-02-2011, 11:36 AM
submitted by:
CHITTESH KHILNANI
[attachment=8685]
2D TRANSFORMATIONS –TRANSLATION -SCALING
2D Transformation
Given a 2D object, transformation is to change the object’s
Position (translation)
Size (scaling)
Orientation (rotation)
Shapes (shear)
Apply a sequence of matrix multiplication to the object vertices
Translation
Moving an object is called a translation. We translate a point by adding to the x and y coordinates, respectively, the amount the point should be shifted in the x and y directions. We translate an object by translating each vertex in the object.
Re-position a point along a straight line
Given a point (x,y), and the translation distance (tx,ty)
3x3 2D Translation Matrix
2D Scaling
o Changing the size of an object is called a scale.
o We scale an object by scaling the x and y coordinates of each
vertex in the object.
o Alter the size of an object by a scaling factor (Sx, Sy)
Why use 3x3 matrices?
So that we can perform all transformations using matrix/vector multiplications
This allows us to pre-multiply all the matrices together
The point (x,y) needs to be represented as (x,y,1) -> this is called Homogeneous coordinates!
Homogeneous Coordinates
Although the formulas we have shown are usually the most efficient way to implement programs to do scales and translations, it is easier to use matrix transformations to represent and manipulate them.