Professional Documents
Culture Documents
1
Geometric transformation means change in
Place
orientation
Size
Shape.
2
2D Translations.
2D Scaling
2D Rotation
2D shearing
3
Point P defined as P( x, y),
translate to Point P′( x′, y′) a distance d x parallel to x axis, d y parallel to y axis.
x′ = x + d x y ′ = y + d y
x x′ d x
P = , P′ = , T =
y y′ dy
Now P’
P
P′ = P + T
4
Y 6
5
6
5
dx = 2 4
3
dy = 3 3
3
2
1
0
1 2 3 4 5 6 7 8 9 10
X
Component-wise addition
x x ' dx
v’ = v + t where v = , v ' = , t =
y y ' dy
and x’ = x + dx
y’ = y + dy
To move polygons: translate vertices of polygon after adding translation factors
and redraw lines between them.
5
Point P defined as P ( x, y ),
Perform a scale (stretch) to Point P′( x′, y′) by a factor s x along the x axis,
and s y along the y axis.
x′ = s x . x, y′ = s y . y
Define the matrix P’
P
sx 0
S=
0 s y
Now
x ′ s x 0 x
P′ = S ⋅ P or y′ = 0 .
s y y
6
After applying Scaling factor coordinates of
object is either increase or decrease. Expansion
and compression of object is depend upon the
scaling factor Sx and Sy.
Uniform Scaling
If Sx = Sy < 1 Uniform compression occurs.
If Sx = Sy > 1 Uniform Expansion Will occur.
If Sx=Sy=1 No Change will occur.
Non uniform scaling
If Sx ≠ Sy < 1 Non uniform compression occurs.
If Sx ≠ Sy > 1 Non uniform expansion Will
occur.
7
Uniform Scaling
8
Y 6
5
s x =3 4
s y =2 3
2 6 9
2 2
2 3
1
1
1
0
1 2 3 4 5 6 7 8 9 10
X
Component-wise scalar multiplication of vectors
x x '
v’ = Sv where v = , v ' =
y y '
and
s x 0 x ' =s x x
S =
0 sy
y ' =s y y
9
2D case
Add a 3rd coordinate to every 2D point. A point (a, b) in 2D can
be represented as (a,b,1) in homogeneous coordinate system.
Any point (x, y, w) where w!=0 represents a point at location
(x/w, y/w) in this coordinate system.
Point (2/3,4/3) can be represented in homogeneous coordinate
system (6,12,9)
3D Case
• Add a 4th coordinate to every 3D point. A point (a, b, c) in 3D can be
represented as (a,b,c,1) in homogeneous coordinate system.
Any point (x, y, z, w) in 3D where w!=0 represents a point at location
(x/w, y/w, z/w) in this coordinate system.
Example of Homogeneous
Coordinates
11
Object coordinates are (00,10,11,01) Perform uniform expansion of this
object. Take scaling factor from your side.Draw final Figure also.
12
Q1. Write a 2X2 transformation matrix for each
of the following scaling transformation.
(1)The entire picture is 3 times as large.
13
Translate the square ABCD whose coordinates are A(0,0), B(3,0),c(3,3),
D(0,3).
Translate this square 1.5 unit in x direction and 0.5 unit in y direction.
After translation performing scaling with scaling factor sx=1.5 and
sy=0.5
14
Find the transformation matrix that transforms
the square ABCD whose center is at (2,2) is
reduced to half of its size, with center still
remaining at (2,2). The coordinate of square
ABCD are A(0,0), B(0,4), C(4,4),D(4,0). Find the
coordinates of new square.
15
x' = x + t x
y' = y + t y
Q: How can we represent translation as a
3x3 matrix?
1 0 0
Translation = 0 1 0
tx ty 1
Example of translation
Homogeneous Coordinates
x ' 1 0 t x x x + t x
y ' = 0 1 t y = y + t
y y
1 0 0 1 1 1
tx = 2
ty = 1
Prove that two scaling transformation is
commutative
Commutative property is
S1.s2=s2.s1
Prove that two successive translation are additive.
18
Composite 2D Translation (Two successive
Translation)
T = T(t x1 , t y1 ) ⋅ T(t x 2 , t y 2 )
= T(t x1 + t x 2 , t y1 + t y 2 )
1 0 t x 2 1 0 t x1 1 0 t x1 + t x 2
0 1 t y 2 ⋅ 0 1 t y1 = 0 1 t y1 + t y 2
0 0 1 0 0 1 0 0 1
Two Successive Translation is Additive
Composite 2D Scaling (two successive
Scaling)
T = S( s x1 , s y1 ) ⋅ S( s x 2 , s y 2 )
= S( s x1s x 2 , s y1s y 2 )
sx2 0 0 s x1 0 0 s x1 ⋅ s x 2 0 0
0 sy2 0 ⋅ 0 s y1 0 = 0 s y1 ⋅ s y 2 0
0 0 1 0 0 1 0 0 1
Two Successive Scaling is Multiplicative
2D Rotation
21
y
P’(x’,y’)
r
P(x,y) x = r. cos φ
y = r. sin φ
θ y
r
φ
x
x
22
x′ = r. cos(θ + φ ) = r. cos φ . cosθ − r. sin φ . sin θ
y y′ = r. sin(θ + φ ) = r. cos φ . sin θ + r. sin φ . cosθ
P’(x’,y’)
P(x,y)
r x = r. cos φ
y = r. sin φ
θ y
r
φ
x
x
23
x′ = r. cos(θ + φ ) = r. cos φ . cosθ − r. sin φ . sin θ
y′ = r. sin(θ + φ ) = r. cos φ . sin θ + r. sin φ . cosθ
Substituting for r :
Rotation (Anticlockwise)
x = r. cos φ x′ cosθ − sin θ x
y = r. sin φ y′ = sin θ .
cosθ y
Gives us :
Rotation (Clockwise)
x′ = x. cos θ − y. sin θ
y′ = x. sin θ + y. cosθ x′ cos θ sin θ x
y′ = − sin θ .
cos θ y
24
Rotate a point (10,0) in anticlockwise direction
Angle is 90 degree.
5 ⋅ 0 − 1⋅1
=
5 ⋅1 + 1⋅ 0
− 1
=
5
27
What happens when you apply a rotation
transformation to an object that is not at the
origin?
Solution:
Translate the center of rotation to the origin
Rotate the object
Translate back to the original location
In matrix form, it can be shown as
[ T ] = [ TR ] [ Rθ ] [ TR ]
−1
Here
TR is Translation Matrix (Translation towards Origin)
RƟ is Rotation Matrix (Rotation Matrix can be clockwise and
anticlockwise Rotation)
TR-1 is Translation matrix (Away from origin)
29
Rotating About An Arbitrary Point
y y
x x
y y
x x
Consider the square A(1,0) B(0,0) C(0,1) D(1,1).
Rotate the square ABCD by 90 degree
clockwise about A(1,0). Apply rotation about
arbitrary point to solve this question.
31
Translation.
P′=T + P
Scale
P′=S ⋅ P
Rotation
P′=R ⋅ P
We would like all transformations to be
multiplications
32
Translate [1,3] by [7,9]
1 0 7 1 8
0 9 12
1 ⋅3=
0 0
1
1 1
5 0 0 2 10
0 10 0⋅3 =30
0 0
1
1 1
Rotate [2,2] by 90° (π/2)
33
Shearing Transformation
The shearing transformation when applied to the object it results
distortion of shape.
35
Basic 2D transformations as 3x3 matrices
x ' 1 0 t x x x ' s x 0 0 x
y ' = 0 1 t y y ' = 0 sy 0 y
y
1 0 0 1 1 1 0 0 1 1
Translate Scale
Rotate Shear
Transformations can be combined by
matrix multiplication
Object * T (− x, − y ) ×R (θ ) ×T ( x, y )
1 0 − x cos θ − sin θ 0 1 0 x
÷ ÷ ÷
= Object * 0 1 − y ÷× sin θ cos θ 0 ÷× 0 1 y ÷
0 0 1 ÷ 0 0 1÷ ÷
0 0 1
Steps for Fix point Scaling
39
Scaling with respect to a fixed point (x,y)
Object * T (− x, − y ) ×S ( sx , s y ) ×T ( x, y )
1 0 0 sx 0 0 1 0 0
÷ ÷ ÷
= Object * 0 1 0 ÷× 0 sy 0 ÷× 0 1 0 ÷
−x − y 1 ÷ 0 0 1 ÷ x y 1 ÷
Q1. Magnify the triangle with vertices A(0,0),
B(1,1), C(5,2) to twice its size while keeping
c(5,2) fixed.
41
Composite 2D Rotation (Two Successive
Rotation)
T = R (θ 2 ) ⋅ R (θ1 )
= R (θ 2 + θ1 )
43