Unit 2
Two-Dimensional Geometric Transformations
Changing co-ordinate description of an object is called transformation.
Types:
- Rigid body transformation (transformation without change in shape.)
- Non rigid body transformation (transformation with change in shape.)
When a transformation takes place on a 2D plane, it is called 2D transformation.
The three basic transformations are
Translation
Rotation
Scaling
Other transformation includes reflection and shear.
2D Translation
Repositioning of object along a straight-line path from one coordinate location to another is
called translation.
Translation is performed on a point by adding offset to its coordinate so as to generate a new
coordinate position.
Let p(x, y) be translated to 𝑝′(𝑥′, 𝑦′) by using offset 𝑡𝑥 and 𝑡𝑦 in x & y direction. Then,
𝑥′=𝑥 + 𝑡𝑥
𝑦′=𝑦 + 𝑡𝑦 𝑝′(𝑥′, 𝑦′)
In matrix form,
𝑇
i.e. 𝑃′ = 𝑃 + 𝑇 where T is transformation matrix.
2D Rotation
- Changing the co-ordinate position along a circular path is called rotation.
2D rotation is applied to re-position the object along a circular path in XY-plane. Rotation is
generated by specifying rotation angle (𝜃) and pivot point (rotation point).
The positive 𝜃 rotates object in anti-clockwise direction and the negative value of 𝜃
rotates the object in clockwise direction.
Let 𝑝(𝑥, 𝑦) be a point rotated by 𝜃 about origin to new point 𝑝′(𝑥′, 𝑦′).
Here, y
𝑥 = 𝑟𝑐𝑜𝑠(∅ + 𝜃)
′
𝑝′(𝑥′, 𝑦′)
= 𝑟𝑐𝑜𝑠∅𝑐𝑜𝑠𝜃 − 𝑟𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃
𝑝(𝑥, 𝑦)
r
But 𝑥 = 𝑟𝑐𝑜𝑠∅ & 𝑦 = 𝑟𝑠𝑖𝑛∅ 𝜃
∴ 𝒙′ = 𝒙𝒄𝒐𝒔𝜽 − 𝒚𝒔𝒊𝒏𝜽................(i) ∅
x
Similarly,
∴ 𝒚′ = 𝒙𝒔𝒊𝒏𝜽 + 𝒚𝒄𝒐𝒔𝜽.................(ii)
,Which are equation for rotation of (x, y) with angle 𝜃 and taking pivot as origin.
In matrix form
𝑃′ = 𝑅. 𝑃
𝑥′ 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 𝑥
[ ]=[ ][ ]
𝑦′ 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 𝑦
If the pivot point is at(𝒙𝒓, 𝒚𝒓).
Here,
cos(∅ + 𝜃) = (𝑥′ − 𝑥𝑟)/𝑟
or, 𝑟 cos(∅ + 𝜃) = (𝑥′ − 𝑥𝑟)
or, (𝑥′ − 𝑥𝑟) = 𝑟𝑐𝑜𝑠∅𝑐𝑜𝑠𝜃 − 𝑟𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃
Since, 𝑟𝑐𝑜𝑠∅ = (𝑥 − 𝑥𝑟), 𝑟𝑠𝑖𝑛∅ = (𝑦 − 𝑦𝑟)
∴ 𝒙′ = 𝒙𝒓 + (𝒙 − 𝒙𝒓)𝒄𝒐𝒔𝜽 − (𝒚 − 𝒚𝒓)𝒔𝒊𝒏𝜽 ……… (i)
Similarly,
sin(∅ + 𝜃) = (𝑦′ − 𝑦𝑟)/𝑟
or, 𝑟 s 𝑖𝑛(∅ + 𝜃) = (𝑦′ − 𝑦𝑟)
or, (𝑦′ − 𝑦𝑟) = 𝑟𝑠𝑖𝑛∅𝑐𝑜𝑠𝜃 + 𝑟𝑐𝑜𝑠∅𝑠𝑖𝑛𝜃
Since, 𝑟𝑐𝑜𝑠∅ = (𝑥 − 𝑥𝑟), 𝑟𝑠𝑖𝑛∅ = (𝑦 − 𝑦𝑟)
∴ 𝒚′ = 𝒚𝒓 + (𝒙 − 𝒙𝒓)𝒔𝒊𝒏𝜽 + (𝒚 − 𝒚𝒓)𝒄𝒐𝒔𝜽 ……… (ii)
These equations (i) and (ii) are the equations for rotation of a point (x, y) with angle 𝜃 taking
pivot point(xr, yr).
2D Scaling
Scaling transformation alters the size of object. A simple two dimensional scaling operation
is performed by multiplying object position (x, y) with scaling factors 𝑠𝑥 & 𝑠𝑦 along x & y
direction to produce (𝑥′, 𝑦′).
𝑥′ = 𝑥. 𝑠𝑥 & 𝑦′ = 𝑦. 𝑠𝑦
In matrix form,
𝑃′ = 𝑆. 𝑃
,𝑥 𝑥
, 𝑥′ 𝑠𝑥 0 𝑥
[ ′] = [ ][ ]
𝑦 0 𝑠𝑦 𝑦
If the scaling factor is less than 1, the size of object is decreased and if it is greater than 1
the size of object is increased. The scaling factor = 1 for both direction does not change the
size of the object.
If both scaling factors have same value then the scaling is known as uniform scaling.
If the value of 𝑠𝑥 and 𝑠𝑦 are different, then the scaling is known as differential scaling.
The differential scaling is mostly used in the graphical package to change the shape of
the object.
If fixed point is (𝑥𝑓, 𝑦𝑓) about which rotation is made, then
𝑥′ = 𝑥. 𝑠𝑥 + 𝑥𝑓(1 − 𝑠𝑥)
𝑦′ = 𝑦. 𝑠𝑦 + 𝑦𝑓(1 − 𝑠𝑦)
Matrix representation & Homogenous coordinate
The homogeneous co-ordinate system provides a uniform framework for handling different
geometric transformations, simply as multiplication of matrices.
To perform more than one transformation at a time, homogeneous coordinates are used.
They reduce unwanted calculations, intermediate steps, saves time and memory and
produce a sequence of transformations.
We represent each Cartesian coordinate position (x, y) with the homogeneous coordinate
triple(𝑥ℎ, 𝑦ℎ, ℎ), where, 𝑥 = 𝑥ℎ/ℎ, 𝑦 = 𝑦ℎ/ℎ. (h is 1 usually for 2D case).
Therefore, (x, y) in Cartesian system is represented as (x, y, 1) in homogeneous co-ordinate
system.
For Translation: 𝑻(𝒕𝒙, 𝒕𝒚)
𝑃′ = 𝑇. 𝑃
1 0 𝑡𝑥 𝑥
𝑥′′
Where, 𝑃′ = [𝑦 ], 𝑇 = [0 1 𝑡𝑦] & 𝑃 = [𝑦]
1 0 0 1 1
By which we can
get,
𝑥′=𝑥 + 𝑡𝑥
𝑦′=𝑦 + 𝑡𝑦
For Rotation: R(𝜽 )
𝑃′ = 𝑅. 𝑃
𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 0 𝑥
𝑥′′
Where, 𝑃′ = [𝑦 ], 𝑅 = [𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0] & 𝑃 = [𝑦]
1 0 0 1 1
Two-Dimensional Geometric Transformations
Changing co-ordinate description of an object is called transformation.
Types:
- Rigid body transformation (transformation without change in shape.)
- Non rigid body transformation (transformation with change in shape.)
When a transformation takes place on a 2D plane, it is called 2D transformation.
The three basic transformations are
Translation
Rotation
Scaling
Other transformation includes reflection and shear.
2D Translation
Repositioning of object along a straight-line path from one coordinate location to another is
called translation.
Translation is performed on a point by adding offset to its coordinate so as to generate a new
coordinate position.
Let p(x, y) be translated to 𝑝′(𝑥′, 𝑦′) by using offset 𝑡𝑥 and 𝑡𝑦 in x & y direction. Then,
𝑥′=𝑥 + 𝑡𝑥
𝑦′=𝑦 + 𝑡𝑦 𝑝′(𝑥′, 𝑦′)
In matrix form,
𝑇
i.e. 𝑃′ = 𝑃 + 𝑇 where T is transformation matrix.
2D Rotation
- Changing the co-ordinate position along a circular path is called rotation.
2D rotation is applied to re-position the object along a circular path in XY-plane. Rotation is
generated by specifying rotation angle (𝜃) and pivot point (rotation point).
The positive 𝜃 rotates object in anti-clockwise direction and the negative value of 𝜃
rotates the object in clockwise direction.
Let 𝑝(𝑥, 𝑦) be a point rotated by 𝜃 about origin to new point 𝑝′(𝑥′, 𝑦′).
Here, y
𝑥 = 𝑟𝑐𝑜𝑠(∅ + 𝜃)
′
𝑝′(𝑥′, 𝑦′)
= 𝑟𝑐𝑜𝑠∅𝑐𝑜𝑠𝜃 − 𝑟𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃
𝑝(𝑥, 𝑦)
r
But 𝑥 = 𝑟𝑐𝑜𝑠∅ & 𝑦 = 𝑟𝑠𝑖𝑛∅ 𝜃
∴ 𝒙′ = 𝒙𝒄𝒐𝒔𝜽 − 𝒚𝒔𝒊𝒏𝜽................(i) ∅
x
Similarly,
∴ 𝒚′ = 𝒙𝒔𝒊𝒏𝜽 + 𝒚𝒄𝒐𝒔𝜽.................(ii)
,Which are equation for rotation of (x, y) with angle 𝜃 and taking pivot as origin.
In matrix form
𝑃′ = 𝑅. 𝑃
𝑥′ 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 𝑥
[ ]=[ ][ ]
𝑦′ 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 𝑦
If the pivot point is at(𝒙𝒓, 𝒚𝒓).
Here,
cos(∅ + 𝜃) = (𝑥′ − 𝑥𝑟)/𝑟
or, 𝑟 cos(∅ + 𝜃) = (𝑥′ − 𝑥𝑟)
or, (𝑥′ − 𝑥𝑟) = 𝑟𝑐𝑜𝑠∅𝑐𝑜𝑠𝜃 − 𝑟𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃
Since, 𝑟𝑐𝑜𝑠∅ = (𝑥 − 𝑥𝑟), 𝑟𝑠𝑖𝑛∅ = (𝑦 − 𝑦𝑟)
∴ 𝒙′ = 𝒙𝒓 + (𝒙 − 𝒙𝒓)𝒄𝒐𝒔𝜽 − (𝒚 − 𝒚𝒓)𝒔𝒊𝒏𝜽 ……… (i)
Similarly,
sin(∅ + 𝜃) = (𝑦′ − 𝑦𝑟)/𝑟
or, 𝑟 s 𝑖𝑛(∅ + 𝜃) = (𝑦′ − 𝑦𝑟)
or, (𝑦′ − 𝑦𝑟) = 𝑟𝑠𝑖𝑛∅𝑐𝑜𝑠𝜃 + 𝑟𝑐𝑜𝑠∅𝑠𝑖𝑛𝜃
Since, 𝑟𝑐𝑜𝑠∅ = (𝑥 − 𝑥𝑟), 𝑟𝑠𝑖𝑛∅ = (𝑦 − 𝑦𝑟)
∴ 𝒚′ = 𝒚𝒓 + (𝒙 − 𝒙𝒓)𝒔𝒊𝒏𝜽 + (𝒚 − 𝒚𝒓)𝒄𝒐𝒔𝜽 ……… (ii)
These equations (i) and (ii) are the equations for rotation of a point (x, y) with angle 𝜃 taking
pivot point(xr, yr).
2D Scaling
Scaling transformation alters the size of object. A simple two dimensional scaling operation
is performed by multiplying object position (x, y) with scaling factors 𝑠𝑥 & 𝑠𝑦 along x & y
direction to produce (𝑥′, 𝑦′).
𝑥′ = 𝑥. 𝑠𝑥 & 𝑦′ = 𝑦. 𝑠𝑦
In matrix form,
𝑃′ = 𝑆. 𝑃
,𝑥 𝑥
, 𝑥′ 𝑠𝑥 0 𝑥
[ ′] = [ ][ ]
𝑦 0 𝑠𝑦 𝑦
If the scaling factor is less than 1, the size of object is decreased and if it is greater than 1
the size of object is increased. The scaling factor = 1 for both direction does not change the
size of the object.
If both scaling factors have same value then the scaling is known as uniform scaling.
If the value of 𝑠𝑥 and 𝑠𝑦 are different, then the scaling is known as differential scaling.
The differential scaling is mostly used in the graphical package to change the shape of
the object.
If fixed point is (𝑥𝑓, 𝑦𝑓) about which rotation is made, then
𝑥′ = 𝑥. 𝑠𝑥 + 𝑥𝑓(1 − 𝑠𝑥)
𝑦′ = 𝑦. 𝑠𝑦 + 𝑦𝑓(1 − 𝑠𝑦)
Matrix representation & Homogenous coordinate
The homogeneous co-ordinate system provides a uniform framework for handling different
geometric transformations, simply as multiplication of matrices.
To perform more than one transformation at a time, homogeneous coordinates are used.
They reduce unwanted calculations, intermediate steps, saves time and memory and
produce a sequence of transformations.
We represent each Cartesian coordinate position (x, y) with the homogeneous coordinate
triple(𝑥ℎ, 𝑦ℎ, ℎ), where, 𝑥 = 𝑥ℎ/ℎ, 𝑦 = 𝑦ℎ/ℎ. (h is 1 usually for 2D case).
Therefore, (x, y) in Cartesian system is represented as (x, y, 1) in homogeneous co-ordinate
system.
For Translation: 𝑻(𝒕𝒙, 𝒕𝒚)
𝑃′ = 𝑇. 𝑃
1 0 𝑡𝑥 𝑥
𝑥′′
Where, 𝑃′ = [𝑦 ], 𝑇 = [0 1 𝑡𝑦] & 𝑃 = [𝑦]
1 0 0 1 1
By which we can
get,
𝑥′=𝑥 + 𝑡𝑥
𝑦′=𝑦 + 𝑡𝑦
For Rotation: R(𝜽 )
𝑃′ = 𝑅. 𝑃
𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 0 𝑥
𝑥′′
Where, 𝑃′ = [𝑦 ], 𝑅 = [𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0] & 𝑃 = [𝑦]
1 0 0 1 1