L7-2DTransformations
L7-2DTransformations
2D
TRANSFORMATIONS
Lecture 7 ITSW4111 : COMPUTER GRAPHICS
Affine Transformations
2
An affine transformation is a
transformation where:
lines are preserved (lines remain lines after
transformation)
parallelism is preserved
proportional distances are preserved
eg. if point P is at a distance F between
points A and B before, it will remain so
after the transform
the change in area of any object
transformed is:
(area after transform) / (area before
Objectives of the
3
Course
1. Basic Affine Transformations:
Translation
Scaling
Rotation
Shearing
Translation
4
x’= x+ tx , y’ = y + ty
Translation
The translation distance pair (tx, ty) is called a
translation vector or shift vector.
This allows us to write the two-dimensional
translation equations in the matrix form:
P’ = P + T
where P = x , T = tx and P’ = x’
y ty y’
6
Rotation
7
f Substitute…
x’ = x cos() - y sin()
y’ = x sin() + y cos()
Rotation About a Pivot
11
Point
Rotating of a point from position (x,y) to
position(x',y') through angle about rotation point
(xr,yr).
x’ = x.sx, y’ = y.sy .
Scaling factor sx,sy scales objects in the x
Scaling about a Fixed
13
Point
We can control the location of a scaled
object by choosing a position, called the
fixed point, that is to remain unchanged
after the scaling transformation.
Coordinates for the fixed point (xf,yf)
can be chosen as one of the vertices, the
object centroid, or any other position.
Scaling about a Fixed
14
Point
Transformation equations with the fixed
point (xf ,yf) are calculated as:
Uniform Scaling
Non-uniform Scaling
17
2D Shear
18