CG Chapter 5
CG Chapter 5
-Since these transformations are performed using geometry, they are also known as
geometric transformations.
1) Translation (Shifting)
2) Scaling
3) Rotation
Chapter-5: Geometric Transformation
- Translating an object means moving (shifting) an object from one place to another.
Suppose we want to translate a point (x,y) in the horizontal direction by Tx units, then this
movement can be obtained by simply adding Tx units to x-coordinates.
x’ = x + Tx
y’ = y
Suppose we want to translate a point (x,y) in the vertical direction by Ty units, then this
movement can be obtained by simply adding Ty units to y-coordinates.
x’ = x
y’ = y + Ty
x’ = x + Tx
y’ = y + Ty
-These followers as to write the two-dimensional translation equation in the matrix form.
P’ = P + T
-Translation is performed on each and every vertex of an object to translate the entire
object.
-Translation of other object like circles and ellipses is performed by translating their
parameters.
x’ = x . Sx
y’ = y . Sy
- Scaling factor Sx scales in the x direction while sy scales in the y direction.
- The transformation can be also return in the matrix form.
- Any positive number can be assign to the scaling factors Sx and Sy values less than 1
reduce the size of object values greater than 1 produce in enlargement.
- Specifying a value of 1 for both Sx and Sy lives the size of object unchanged.
- When Sx and Sy are assign the same value, Then it is known as uniform scaling (Sx=Sy)
otherwise Differential scaling (Sx≠Sy).
- This matrix will work with the objects define by straight lines.
-But objects like circles and ellipses will not work with this matrix.
-For scaling this type of objects, the scaling is performed on their parameter like radius,
major and minor axis.
Chapter-5: Geometric Transformation
-This transformation requires two major parameters, direction of rotation and angle of
rotation.
-Any given object can be rotated either in clockwise direction or in anti-clockwise direction
by a given angle 𝞱.
- the point P’(x’, y’) is a rotated point, which is the result of anti-clockwise rotation
performed on point P(x, y) with 𝞱 angle relative to origin(0,0).
𝑐𝑜𝑠θ 𝑠𝑖𝑛θ
[x’ y’]=[x y]*[ ]
−𝑠𝑖𝑛θ 𝑐𝑜𝑠θ
P’=P*R.
-Similarly, we can derive the equation to rotate a point in clockwise direction by angle 𝞱
about origin (0, 0).
-Here we are rotating point P(x, y) in opposite direction of that we did in the anticlockwise
rotation. In this case angle will be 𝞱.
cos(−θ) sin(−θ)
[x’ y’]=[x y]*[ ]
−sin(−θ) cos(−θ)
𝑐𝑜𝑠θ −𝑠𝑖𝑛θ
[x’ y’]=[x y]*[ ]
𝑠𝑖𝑛θ 𝑐𝑜𝑠θ
P’=P*R.
-If we want to do first scaling, then rotation and then translation. Then this process is very
time consuming.
-Instead of this, if we have a single matrix which performs all this three transformations
simultaneously using a single transformation matrix then it is given as below.
-Let us rewrite all the matrices with homogeneous rows and columns.
-Coordinate matrix [x y 1]
𝑆𝑥 0 0
-Scale Transformation Matrix [ 0 𝑆𝑦 0]
0 0 1
1 0 0
-Translation Transformation Matrix [0 1 0]
𝑇𝑥 𝑇𝑦 1
𝑎 𝑏 0
-And generalized transformation Matrix will be [ 𝑐 𝑑 0]
𝑇𝑥 𝑇𝑦 1
-where a, b, c, and d constants will take different values for scaling and rotation
transformations, depending on the transformation on hand.
-The mirror image for a two –dimensional reflection is generated relative to an axis of
reflection by rotating the object 180o about the reflection axis.
Chapter-5: Geometric Transformation
-Reflection gives image based on position of axis of reflection. Transformation matrix for
few positions are discussed here.
- This transformation keeps x values are same, but flips (Change the sign) y values of
coordinate positions.
1 0 0
[0 −1 0]
0 0 1
Transformation matrix for reflection about the line 𝒙 =0 , 𝒕𝒉𝒆 𝒚 𝒂𝒙𝒊𝒔.
- This transformation keeps y values are same, but flips (Change the sign) x values of
coordinate positions.
−1 0 0
[0 1 0]
0 0 1
Transformation matrix for reflection about the 𝑶𝒓𝒊𝒈𝒊𝒏.
Chapter-5: Geometric Transformation
- This transformation flips (Change the sign) x and y both values of coordinate positions.
−1 0 0
[0 −1 0]
0 0 1
Transformation matrix for reflection about the line 𝒙 = y .
0 1 0
[1 0 0]
0 0 1
Chapter-5: Geometric Transformation
0 −1 0
[−1 0 0]
0 0 1
-Two common shearing transformations are those that shift coordinate x values and those
that shift y values.
𝒚′ = 𝒚
Chapter-5: Geometric Transformation
1 0 0
[𝑆ℎ𝑥 1 0]
0 0 1
- Shear relative to y − 𝑎𝑥𝑖𝑠 that is x = 0 line can be produced by following equation:
𝒙′ = 𝒙
1 𝑆ℎ𝑦 0
[0 1 0]
0 0 1
-The generalized shearing Matrix is given by,
1 𝑆ℎ𝑦 0
[𝑆ℎ𝑥 1 0]
0 0 1
-Here it will interesting to show that shearing can also be obtained by Scaling and
Rotation.
𝑆𝑥 0 0 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0
[0 𝑆𝑦 0 ]and [−𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0]
0 0 1 0 0 1
-We want to derive shearing matrix as a result of composite transformation of scaling and
rotation. That is given by,
1 𝑆ℎ𝑦 0 1 𝑡𝑎𝑛𝜃 0
[𝑆ℎ𝑥 1 ]=[
0 −𝑡𝑎𝑛𝜃 1 0]
0 0 1 0 0 1
Short Questions
Que-1: What is transformation? List out various types of transformations.
(Feb-2019)
-In most of the graphics applications, objects or images are required to be altered.
-To add reality, many times these objects are needed to be moved, rotated, enlarged or
reduced.
-This alteration or manipulation processes of objects is called transformation.
1) Translation (Shifting)
2) Scaling
3) Rotation
Que-3: Give the transformation matrix used to move an object from its
original place. (Jan-2017)
- Translating an object means moving (shifting) an object from one place to another.
P’ = P + T
Que-5: Give matrix to get reflection about the line y=x and y=-x.(Jan-2017)
-Reflection matrix about line y=x is given by,
0 1 0
[1 0 0]
0 0 1
-Reflection matrix about line y=-x is given by,
0 −1 0
[−1 0 0]
0 0 1
-The mirror image for a two –dimensional reflection is generated relative to an axis of
reflection by rotating the object 180o about the reflection axis.
1) X-shear
2) y-Shear