2. Transformation
An operation that changes one configuration into
another
Types of Transformation:
Geometric transformation
Object itself is transformed relative to a stationary co-
ordinate
Co-ordinate transformation
Co-ordinate system is transformed relative to an object.
Object is held stationary
3. 2D Geometric Transformations
A two dimensional transformation is any operation
on a point in space (x, y) that maps that point's
coordinates into a new set of coordinates (x1, y1).
Instead of applying a transformation to every point in
every line that makes up an object, the transformation
is applied only to the vertices of the object and then
new lines are drawn between the resulting endpoints.
5. 2D Translation
One of rigid-body transformation, which move objects without
deformation
Translate an object by Adding offsets to coordinates to generate
new coordinates positions
Set tx, ty be the translation distance, we have
P’=P+T
Translation moves the object without deformation
P
P’
T
xtx'x += yty'y +=
=
y
x
P
=
y
x
t
t
T
=
'y
'x
'P
6. Basic 2D Translation
To move a line segment, apply the
transformation equation to each of the two
line endpoints and redraw the line between
new endpoints
To move a polygon, apply the transformation
equation to coordinates of each vertex and
regenerate the polygon using the new set of
vertex coordinates
7. Example
Translate a polygon with coordinates
A(2,5), B(7,10) and c(10,2) by 3 units in
x direction and 4 units in y direction
8. 2D Rotation
Object is rotated ϴ° about the origin.
ϴ > 0 – rotation is counter clock wise
ϴ < 0 – rotation is clock wise
6
π
θ =
y
x0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
9. 2-D Rotation
x = r cos (φ)
y = r sin (φ)
x’ = r cos (φ + θ)
y’ = r sin (φ + θ)
Trig Identity…
x’ = r cos(φ) cos(θ) – r sin(φ)
sin(θ)
y’ = r sin(φ) sin(θ) + r cos(φ)
cos(θ)
Substitute…
x’ = x cos(θ) - y sin(θ)
y’ = x sin(θ) + y cos(θ)
θ
(x, y)
(x’, y’)
φ
10. Basic 2D Geometric Transformations
2D Rotation matrix
P’=R·P
ΘΘ
Θ−Θ
=
cossin
sincos
R
ΦΦ
(x,y)r
r θ
(x’,y’)
−
=
y
x
y
x
θθ
θθ
cossin
sincos
'
'
11. Basic 2D Geometric Transformations
2D Rotation
Rotation for a point about any specified
position (xr, yr)
x’=xr+(x - xr) cos θ – (y - yr) sin θ
y’=yr+(x - xr) sin θ + (y - yr) cos θ
12. Rotations also move objects without
deformation
A line is rotated by applying the rotation
formula to each of the endpoints and redrawing
the line between the new end points
A polygon is rotated by applying the rotation
formula to each of the vertices and redrawing
the polygon using new vertex coordinates
13. Example
A point (4,3) is rotated
counterclockwise by an angle 45°
find the rotation matrix and
resultant point.
14. Basic 2D Geometric Transformations
2D Scaling
Scaling is the process of expanding or compressing
the dimension of an object
Simple 2D scaling is performed by multiplying object
positions (x, y) by scaling factors sx and sy
x’ = x · sx
y’ = y · sy
⋅
=
y
x
s
s
y
x
y
x
0
0
'
'
P(x,y)
P’(x’,y’)
xsx• x
sy• y
y
15. 2D Scaling
Any positive value can be
used as scaling factor
Sf < 1 reduce the size of the
object
Sf > 1 enlarge the object
Sf = 1 then the object stays
unchanged
If sx= sy, we call it uniform
scaling
If scaling factor <1, then the
object moves closer to the
origin and If scaling factor >1,
then the object moves farther
from the origin
y
x
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
1
2
1
3
3
6
3
9
16. Basic 2D Geometric Transformations
2D Scaling
We can control the location of the scaled object by
choosing a position called the fixed point (xf, yf)
x’ – xf = (x – xf) sx y’ – yf = (y – yf) sy
x’=x · sx+ xf (1 – sx)
y’=y · sy+ yf (1 – sy)
Polygons are scaled by applying the above formula to
each vertex, then regenerating the polygon using the
transformed vertices
17. Example
Scale the polygon with co-ordinates
A(2,5), B(7,10) and c(10,2) by 2 units in
x direction and 2 units in y direction
18. Homogeneous Coordinates
Expand each 2D coordinate (x, y) to three element
representation (xh, yh, h) called homogenous
coordinates
h is the homogenous parameter such that
x = xh/h, y = yh/h,
A convenient choice is to choose h = 1
19. Homogeneous Coordinates for translation
2D Translation Matrix
or, P’ = T(tx,ty)·P
⋅
=
1100
10
01
1
'
'
y
x
t
t
y
x
y
x
25. 2D Composite Transformations
We can setup a sequence of transformations as
a composite transformation matrix by
calculating the product of the individual
transformations
P’=M2·M1·P
P’=M·P
26. 2D Composite Transformations
Composite 2D Translations
+
+
=
⋅
100
10
01
100
10
01
100
10
01
21
21
1
1
2
2
yy
xx
y
x
y
x
tt
tt
t
t
t
t
34. Example
I sat in the car, and find the side mirror is 0.4m on
my right and 0.3m in my front
• I started my car and drove 5m forward, turned 30
degrees to right, moved 5m forward again, and
turned 45 degrees to the right, and stopped
• What is the position of the side mirror now,
relative to where I was sitting in the beginning?
35. Other Two Dimensional Transformations
Reflection
Transformation that produces a mirror
image of an object
Image is generated relative to an axis of
reflection by rotating the object 180°
about the reflection axis
40. Example
Consider the triangle ABC with co-
ordinates x(4,1), y(5,2), z(4,3). Reflect
the triangle about the x axis and then
about the line y = -x
41. Shear
Transformation that distorts the shape of an
object is called shear transformation.
Two shearing transformation used:
Shift X co-ordinates values
Shift Y co-ordinates values
42. X shear
y
x
(0,1) (1,1)
(1,0)(0,0)
y
x
(2,1) (3,1)
(1,0)(0,0)
shx=2
100
010
01 xsh
yy
yshxx x
=
⋅+=
'
'
Preserve Y coordinates but change the X coordinates values
43. Y shear
Preserve X coordinates but change the Y coordinates values
x’ = x
y’ = y + Shy . x
y
x
(0,1) (1,1)
(1,0)(0,0)
y
x
(0,1)
(1,2)
(1,1)(0,0)
100
01
001
ysh
45. Shear relative to other axis
X shear with reference to Y axis
x
y
1
1
yref = -1
x
shx = ½, yref = -1
1
1 2 3
yref = -1
( )x refx x sh y y
y y
′ = + −
′ =
1
0 1 0
1 0 0 1 1
x x refx sh sh y x
y y
′ − ×
÷ ÷ ÷′ = ÷ ÷ ÷
÷ ÷ ÷
46. Shear relative to other axis
Y shear with reference to X axis
( )y ref
x x
y y sh x x
′ =
′ = + −
1 0 0
1
1 0 0 1 1
x y ref
x x
y sh sh x y
′
÷ ÷ ÷′ = − × ÷ ÷ ÷
÷ ÷ ÷
x
y
1
1xref = -1
y
x
1
1
2
xref = -1
47. Example
Apply shearing transformation to square with
A(0,0), B(1,0), C(1,1), D(0,1).
Shear parameter value is 0.5 relative to line
Yref = - 1 and Xref = - 1
48. 321321321 M)MM()MM(MMMM ⋅⋅=⋅⋅=⋅⋅
Associative properties
Transformation is not commutative (CopyCD!)
Order of transformation may affect transformation
position
Matrix Concatenation Properties
49. Transformations between 2DTransformations between 2D
Coordinate SystemsCoordinate Systems
To translate object descriptions from xy coordinates to x’y’
coordinates, we set up a transformation that superimposes
the x’y’ axes onto the xy axes. This is done in two steps:
1. Translate so that the origin (x0, y0) of the x’y’ system is
moved to the origin (0, 0) of the xy system.
2. Rotate the x’ axis onto the x axis.
x
y
x0
x’
y’
y0
θ
50. Translation
(x’,y’)=Tv(x,y)
x’= x – tx
y’=y-ty
Rotation about origin
(x’,y’)=Rϴ(x,y)
x’= xcosϴ + ysinϴ
y’= -xsinϴ + ycosϴ
Scaling with origin
(x’, y’)=Ssx, sy(x,y)
x’= (1/sx)x
y’= (1/sy)y
Reflection about X
axis
(x’,y’)= Mx(x,y)
x’= x
y’= -y
Reflection about Y
axis
(x’,y’)= My(x,y)
x’= -x
y’= y
51. Example
Find the x’y’-coordinates of the xy points (10, 20)
and (35, 20), as shown in the figure below:
x
y
30
x’
y’
10
30º
(10, 20)
(35, 20)