Geometric Transformation
Transformation on Matrices
• Translation
• Scaling
• Shear (x, y)
• Rotating
• Reflection (+ Scaling)
• Composition
• Decomposition
– Symmetric Eigenvalue Decomposition
– Singular Value Decomposition
• Inverse Transformation
Faculty of Computer Science
Translation
• Objects can be translated using both matrix
addition and matrix multiplication.
Faculty of Computer Science
2D Translation by Addition
Set tx,ty be the translation distance, we have
x' x t x
y' y t y
In matrix format, where T is the translation vector
x' x t x
P' P T y
y' y t y
P' P T 𝑦 ′
(,)
y (x,y)
x 𝑥′ x
Faculty of Computer Science
• 3D Translation by Addition
Faculty of Computer Science
Ideal Points or Points at Infinity
• Homogeneous coordinates can easily capture the concept
of infinity.
• Let a point (x,y) be fixed and converted to a homogeneous
coordinate by multiplying with 1/w, (x/w,y/w,1/w).
• Let the value of w approach to zero, then (x/w,y/w) moves
farther and farther away in the direction of (x,y).
• When w becomes zero, (x/w,y/w) moves to infinity.
Therefore, we would say, the homogeneous coordinate
(x,y,0) is the ideal point or point at infinity in the direction
of (x,y).
Faculty of Computer Science
Translation (Cont’d)
• 2D Translation by Multiplication
• 3D Translation by Multiplication
Faculty of Computer Science
Translation - Example
• Suppose
you had an object at point P(1,2) and
you wanted to move it three units to the right
and one unit up. What would you do?
• Add 3 to the x-coordinate and 1 to the y-
coordinate => (4,3)
Faculty of Computer Science
Translation - Exercise
1) Set up a general matrix equation that will move 3D
objects 100 pixels to the left, 200 pixels up, and 50
pixels back, and then use it to move a triangle with
vertices at A(40, 0,100), B(0,350, 200) and C(-100,
200, -10). (using addition)
2) Using matrix multiplication, find a general matrix
equation that will move 2D objects 50 pixels to the
right and 100 pixels down on the computer screen,
and then use it move a triangle with vertices at
A(20,30), B(0,200), and C(300, 400).
Faculty of Computer Science
Scaling
• Matrix multiplication can be used to scale
objects, like translation
– Uniform Scale
– Differential Scale
Faculty of Computer Science
Faculty of Computer Science
2D Scaling
Faculty of Computer Science
Scaling- Example
1) Uniformly scale objects 3 times larger if four
vertices of an object are A(10,10),
B(50,10),C(50,40) and D(10,40).
Solution: Matrix equation for 3 times larger
A’(30,30), B’(150,30),C’(150,120), D’(30,120)
Faculty of Computer Science
Scaling- Example (Cont’d)
1) A rectangular-shaped object whose vertices are
A(20,0), B(50,0),C(50,100) and D(20,100) will scale
1.5 time in x-direction and 0.1 in y direction. Set up
matrix equation and find the new vertices.
Solution: Matrix equation for differential scale
A’(30,0), B’(75,0),C’(75,10), D’(30,10)
Faculty of Computer Science
Rotation(An angle relative to the
coordinate Origin)
x =
y=
x' =
= )
=
=
y' =
= )
=
=
The rotation equation in matrix form,
P‘ = R . P
= .
Where, the rotation matrix is-
R=
Faculty of Computer Science
Rotation - Exercise
1) Write a general matrix equation that will rotate
2D objects 30 and then use it to rotate a
triangle with vertices at A(-10, 50), B(80,0) and
C(-50,100) to find the new vertices.
Faculty of Computer Science
Rotation(An angle about the rotation Point (xr, yr)
= xr +
= yr +
Faculty of Computer Science
Exercise
Find a 3×3 matrix transformation that rotates the
entire plane 30◦ counterclockwise around the
point P = (2, 4), as shown in figure
Transformation sequence:
• 1. Move the point (2, 4)
to the origin.
• 2. Rotate by 30◦.
• 3. Move the origin back to
(2, 4)
Faculty of Computer Science
Exercise
• A square has vertices p1 = (1, 1), p2 = (2, 1), p3
= (2, 2), and p4(1, 2). Determine the new
vertices of the square after a rotation about p2
through an angle of π/4.
Faculty of Computer Science
• Solution
Faculty of Computer Science
Reflection
• A
reflection is a transformation that produces a
mirror image of an object.
• The image is generated relative to an axis of
reflection by rotating the object about the reflection
axis.
• When the reflection axis is a line in the xy-plane the
rotation path is perpendicular to xy-plane.
• When the reflection axis is perpendicular to xy-
plane , the rotation path is in the xy-plane.
Faculty of Computer Science
Reflection
Faculty of Computer Science
1.reflection about the x axis
x' = x
y' = -y
′
𝑥 1 0 0 𝑥
1
′
𝑦 ¿ 0 −1 0 𝑦 Reflection axis
0 0 1 1
Faculty of Computer Science
2.reflection about the y axis
x' = -x
y' = y
′
𝑥 −1
0 0 𝑥
1
′
𝑦 ¿ 0 1 0 𝑦
0 0 1 1
Faculty of Computer Science
3.Reflection relative to an axis passing through
the Coordinate Origin
x' = -x
y' = -y
′
𝑥 −1
0 0 𝑥
1
′
𝑦 ¿ 0 −1 0 𝑦
0 0 1 1
Faculty of Computer Science
4.Reflection about the diagonal y=x
x' = y
y' = x
′
𝑥 0 1 0 𝑥
1
′
𝑦 ¿ 1 0 0 𝑦
0 0 1 1
Faculty of Computer Science
5.Reflection about the diagonal y=-x
x' = -y
y' = -x
′
𝑥 0 −1 0 𝑥
1
′
𝑦 ¿ −1 0 0 𝑦
0 0 1 1
Faculty of Computer Science
Exercise
• Describe the transformation sequence and
transformation matrix for reflection about the
diagonal line y=x.
Method-1
Transformation sequence:
• 1. clockwise rotation by 45˙ (-45˙)
• 2. reflection about the x axis
• 3. counter-clockwise rotation by 45˙ (+45˙)
Faculty of Computer Science
Cont’d
Method-2
Transformation sequence:
• 1. reflect the object about the x axis
• 2. rotate counter-clockwise 90˙ (+90˙)
Faculty of Computer Science
Composition
• To apply more than one transformation to an
object
• Example, to first apply a scale S and then a
rotation R on a 2D vector v1:
first, v2= Sv1, then, v3 = Rv2
Faculty of Computer Science
Composite Transformation
• Composite transformation matrix is formed by
calculating the product of individual
transformations
• Successive translations (additive)
Faculty of Computer Science
Composite Transformations (2)
• Successive rotations (additive)
• Successive scaling (multiplicative)
Faculty of Computer Science
Decomposition of
Transformations
• To undo a composition of transformations
– Symmetric Eigenvalue Decomposition
– Singular Value Decomposition
– Paeth Decomposition of Rotations
Faculty of Computer Science
Affine Transformation
• The single matrix implements a linear
transformation followed by a translation
This kind of transformation is called an affine
transformation
Faculty of Computer Science
Inverse Transformation
Inverse translation
Inverse rotation
Inverse scaling
Faculty of Computer Science
Shear
1. shift coordinate x values
2. shift coordinate y values
Faculty of Computer Science
x-direction shear relative to the x axis
Faculty of Computer Science
y-direction shear relative to the y axis
Faculty of Computer Science
Faculty of Computer Science
x-direction shears relative to other
reference lines y=yref
Faculty of Computer Science
Faculty of Computer Science
y-direction shears relative to other
reference lines x=xref
Faculty of Computer Science
Faculty of Computer Science