0% found this document useful (0 votes)
18 views

CG Chapter 5

This document discusses various geometric transformations including translation, scaling, rotation, reflection, and homogeneous coordinates. Translation moves an object by shifting it along the x-axis, y-axis, or both axes. Scaling enlarges or reduces the size of an object by multiplying its coordinates by scaling factors. Rotation moves an object in a circular path around a point by a specified angle. Reflection produces a mirror image of an object across a reflection axis. Homogeneous coordinates allow different transformations to be combined into a single matrix.

Uploaded by

rajmaisuria111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

CG Chapter 5

This document discusses various geometric transformations including translation, scaling, rotation, reflection, and homogeneous coordinates. Translation moves an object by shifting it along the x-axis, y-axis, or both axes. Scaling enlarges or reduces the size of an object by multiplying its coordinates by scaling factors. Rotation moves an object in a circular path around a point by a specified angle. Reflection produces a mirror image of an object across a reflection axis. Homogeneous coordinates allow different transformations to be combined into a single matrix.

Uploaded by

rajmaisuria111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Chapter-5: Geometric Transformation

Chapter-5: Geometric Transformation


Que-1: Basic Transformations.
Ans: -There are three basic actions or movements, moving, scaling, and rotating which
are widely used in the graphics applications.

-These movements are performed through some basic geometry.

-Since these transformations are performed using geometry, they are also known as
geometric transformations.

-There are three basic transformations:

1) Translation (Shifting)
2) Scaling
3) Rotation
Chapter-5: Geometric Transformation

Que-2: Explain Translation in Detail. (Feb-2020)

- Translating an object means moving (shifting) an object from one place to another.

-Translation of an object is possible in any one of the following three directions.

1) Translation of an object in the horizontal direction that is translation parallel to x-axis.

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

2) Translation of an object in the vertical direction that is translation parallel to y-axis.

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

3) Translation of an object in the horizontal and the vertical directions simultaneously.

-Suppose We translate a two-dimensional point by adding translation factors (Tx, Ty) to


the original coordinate position (x, y) to move the point to a new position (x’, y’).

x’ = x + Tx

y’ = y + Ty

-These followers as to write the two-dimensional translation equation in the matrix form.

(x’,y’) = (x+Tx , y+Ty)

[ x’ y’] = [x y] + [Tx Ty]

P’ = P + T

- Where P’ is 1x2 row matrix of coordinates of the translated point.

- P is 1x2 row matrix of coordinates of the original point.

- T is 1x2 row matrix of Translation factor.


Chapter-5: Geometric Transformation

-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.

Que-3: Explain Scaling Transformation in Detail. (Feb-2018, Jan-2017, Feb-


2016)

- A scaling transformation alters a size of the object.


- This operation can be carried out for polygon by multiplying coordinates value (x, y) of
which vertex by scaling factors (Sx, Sy) to produce the transform coordinate (x’, y’).

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.

(x’,y’) = (x.Sx , y.Sy)


𝑆𝑥 0
[ x’ y’] = [x y] * [ ]
0 𝑆𝑦
P’=P.S

- Where P’ is 1x2 row matrix of coordinates of the scaled point.

- P is 1x2 row matrix of coordinates of the original point.


- S is 2 × 2 scaling factor matrix.
Chapter-5: Geometric Transformation

- 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

Que-4: Explain Rotation in Detail. (Feb-2020, Feb-2019, Feb-2018, Feb-2016)

-Rotation moves an object on a circular path about an origin.

-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 𝞱.

- Let us take a point P(x, y) to be rotated in anti-clockwise direction.

- 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).

- 𝟇 is an angle of point P from X-axis.

- According to simple trigonometric principles

x=r cos 𝟇 and y= r sin 𝟇

- where r is the distance of point P from the origin(0,0).

- Following figure shows anticlockwise rotation of point P.


Chapter-5: Geometric Transformation

- x’=r cos (𝞱 +𝟇)


x’=r cos𝞱 cos𝟇- r sin𝞱 sin𝟇

Substitute r cos𝟇=x we get,

x’= x cos𝞱 – y sin𝞱

- similarly, y’= r sin(𝞱 +𝟇)


y’=r sin𝞱 cos𝟇 + r cos𝞱 sin𝟇

Substitute r sin 𝟇=y we get,

y’= x sin𝞱 + y cos𝞱

-Anticlockwise-Rotation Matrix is given by,

𝑐𝑜𝑠θ 𝑠𝑖𝑛θ
[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 𝞱.

- Following figure shows clockwise rotation of point P.


Chapter-5: Geometric Transformation

-Clockwise-Rotation Matrix is given by,

cos(−θ) sin(−θ)
[x’ y’]=[x y]*[ ]
−sin(−θ) cos(−θ)

𝑐𝑜𝑠θ −𝑠𝑖𝑛θ
[x’ y’]=[x y]*[ ]
𝑠𝑖𝑛θ 𝑐𝑜𝑠θ

P’=P*R.

Que-5: Explain Homogeneous coordinates in Detail.


-The general form of the basic transformation based on following equation.
P’=PG1+G2
-where P’ is a transformed matrix, P is matrix of point to be transformed, G1 is a 2x2
matrix of transformation factors and G2 is another 1x2 row matrix of translation factor.
𝑎 𝑏
-Here G1=[ ] ; a, b, c and d are constants which assume different values for different
𝑐 𝑑
transformations.
-For example, the values of a, b, c and d are Sx, 0, 0, and Sy respectively for scaling
transformation and cos 𝞱, sin 𝞱, -sin𝞱 and cos𝞱 respectively for rotation in anticlockwise
direction by angle 𝞱.
-G2= [Tx, Ty]; Tx, Ty are translation factors.
-Matrix multiplication and addition is not possible for a matrix of order 1x2 and order 3x3.
-so the coordinate matrices are also to be expanded by one more column.
-by adding newly element to the matrix is called homogeneous coordinates.
Chapter-5: Geometric Transformation

-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

cosθ 𝑠𝑖𝑛θ 0 cosθ −𝑠𝑖𝑛θ 0


-Rotation Matrices are[−𝑠𝑖𝑛θ 𝑐𝑜𝑠θ 0 ]and [ 𝑠𝑖𝑛θ 𝑐𝑜𝑠θ 0]
0 0 1 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.

Some Other Transformations


- Some package provides few additional transformations which are useful in certain
applications. Two such transformations are reflection and shear.

Que-6: Explain Reflection in Detail. (Feb-2019)


-A reflection is a transformation that produces a mirror image of an object.

-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.

Transformation matrix for reflection about the line 𝒚 = 0 , 𝒕𝒉𝒆 𝒙 𝒂𝒙𝒊𝒔.

- 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 .

- This transformation interchange x and y values of coordinate positions.

0 1 0
[1 0 0]
0 0 1
Chapter-5: Geometric Transformation

Transformation matrix for reflection about the line 𝒙 = −y .

- This transformation interchange x and y values of coordinate positions.

0 −1 0
[−1 0 0]
0 0 1

Que-7: Explain Shearing in Detail. (Feb-2019, Feb-2018, Jan-2017)


- A transformation that distorts the shape of an object such that the transformed shape
appears as if the object were composed of internal layers that had been caused to slide
over each other is called shear.

-Two common shearing transformations are those that shift coordinate x values and those
that shift y values.

- Shear relative to 𝑥 − 𝑎𝑥𝑖𝑠 that is 𝑦 = 0 line can be produced by following equation:

𝒙′ = 𝒙 + 𝒔𝒉𝒙 ∙ , here 𝒔hx is a x-shear factor

𝒚′ = 𝒚
Chapter-5: Geometric Transformation

-Transformation matrix for x-shear is:

1 0 0
[𝑆ℎ𝑥 1 0]
0 0 1
- Shear relative to y − 𝑎𝑥𝑖𝑠 that is x = 0 line can be produced by following equation:

𝒙′ = 𝒙

𝒚′ = x . shy+ y, here 𝒔hy is a y-shear factor

-Transformation matrix for y-shear is:

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.

- Scaling matrix and anticlockwise rotation matrix is given below.

𝑆𝑥 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 𝑆𝑥 0 0 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0


[𝑆ℎ𝑥 1 0 ]=[ 0 𝑆𝑦 0 ] ∗ [−𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0]
0 0 1 0 0 1 0 0 1

1 𝑆ℎ𝑦 0 𝑆𝑥. 𝑐𝑜𝑠𝜃 𝑆𝑥. 𝑠𝑖𝑛𝜃 0


[𝑆ℎ𝑥 1 0 ]=[ −𝑆𝑦. 𝑠𝑖𝑛𝜃 𝑆𝑦. 𝑐𝑜𝑠𝜃 0]
0 0 1 0 0 1
-therefore 𝑆𝑥. 𝑐𝑜𝑠𝜃=1 and 𝑆𝑦. 𝑐𝑜𝑠𝜃=1

-therefore Sx= 1/ 𝑐𝑜𝑠𝜃 and Sy= 1/𝑐𝑜𝑠𝜃

Substituting it in above matrix we get,

1 𝑆ℎ𝑦 0 𝑐𝑜𝑠𝜃/𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃/𝑐𝑜𝑠𝜃 0


[𝑆ℎ𝑥 1 0 ]=[ −𝑠𝑖𝑛𝜃/𝑐𝑜𝑠𝜃 𝑐𝑜𝑠𝜃/𝑐𝑜𝑠𝜃 0]
0 0 1 0 0 1
Chapter-5: Geometric Transformation

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.

-There are three basic transformations:

1) Translation (Shifting)
2) Scaling
3) Rotation

Que-2: What is Sacling? Differentiate between Uniform and Diffrential


scaling. (Feb-2018)
- A scaling transformation alters a size of the object.
- This operation can be carried out for polygon by multiplying coordinates value (x, y) of
which vertex by scaling factors (Sx, Sy) to produce the transform coordinate (x’, y’).
- When Sx and Sy are assign the same value, Then it is known as uniform scaling (Sx=Sy)
otherwise Differential scaling (Sx≠Sy).
Chapter-5: Geometric Transformation

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.

-Translation matrix is given by,

[ x’ y’] = [x y] + [Tx Ty]

P’ = P + T

- Where P’ is 1x2 row matrix of coordinates of the translated point.

- P is 1x2 row matrix of coordinates of the original point.

- T is 1x2 row matrix of Translation factor.

Que-4: What is Homogeneous coordinates? Explain with example.(Feb-2020)


-Matrix multiplication and addition is not possible for a matrix of order 1x2 and order 3x3.
-so the coordinate matrices are also to be expanded by one more column.
-by adding newly element to the matrix is called homogeneous coordinates.
𝑆𝑥 0
-e.g. [ ] is 2x2 matrix, and by aading one more column to this matrix is
0 𝑆𝑦
𝑆𝑥 0 0
homogeneous coordinates. [ 0 𝑆𝑦 0]
0 0 1

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

Que-6: Define Reflection.(Feb-2018)


-A reflection is a transformation that produces a mirror image of an object.
Chapter-5: Geometric Transformation

-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.

Que-7: What is transformation? Write shearing transformation matrix.(Feb-


2016)
-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.
-Shearing matrix is given by,
1 𝑆ℎ𝑦 0
[𝑆ℎ𝑥 1 0]
0 0 1

Que-8: What is shearing? List types of shearing.(Feb-2020)


- A transformation that distorts the shape of an object such that the transformed shape
appears as if the object were composed of internal layers that had been caused to slide
over each other is called shear.

-Two common shearing transformations are:

1) X-shear

2) y-Shear

You might also like