SlideShare a Scribd company logo
Unit 3: Overview Of Transformation
Mr. C. P. Divate
Department Of Computer Engineering
Contents
Two Dimensional 2D Transformations
What is transformations?
a) The geometrical changes of an object from it’s current
state to another modified state is known as
transformation.
b) “Transformations are the operations applied to existing
geometrical data of an object to change its position,
orientation, or size are called geometric
transformations”.
Two Dimensional 2D Transformations
Why the transformations are needed?
• To manipulate the initially created object and to display
the modified object without having to redraw it.
• To Change the shape of object.
• To Study the object surface details.
• To Study the future and past changes in objects.
• To modify old images.
• To get mirror image / Reflections of object.
• To change the color of objects. etc.
Two Dimensional 2D Transformations
a) Translation- It is a process of Moving / shifting the position of an
object from one location to another in a straight-line path.
b) Rotation- It is a process rotating an object either
• Around itself.
• In clockwise or anti clockwise direction about any point on screen.
c) Scaling- It is a process enlarging / Compressing an object size.
d) Reflection- It is the process which gives mirror image of an object.
e) Shearing- It is the process where object get distorted in different
shape.
f) Morphing- It is the process where object gets transit from
between two shapes.
g) Coloring- It is process where object gets colored.
Types of Transformations?
Two Dimensional 2D Transformations
Process of Transformation:
It is a single step process in computer graphics where original object image
is given as input to transformation process software and returns output as
Transformed object image.
Positional Vector: It is a representation of an original object image in
computers memory. Usually represented in Matrix format (data structure).
Process of Transformations
• Translation
• Rotation
• Scaling
• Reflection
• Shearing
• Morphing
• Coloring
Original
object
image
Transformed
image
Positional
Vector
Transformed
Vector
Geometric Operation /
(Multiplication) [T]
Two Dimensional 2D Transformations
Geometric Operation:
• All Transformations can be performed with Mathematical Techniques only.
• In Computer Graphics transformations are performed with Matrix
Calculations only.
• Especially it uses Matrix Multiplication Operation to perform above
transformations.
• It has transformation matrix [ T ] of size 3 x 3 for each type of
Transformation.
• Translation
• Rotation
• Scaling
• Reflection
• Shearing
• Morphing
• Coloring
Original
object
image
Transformed
image
Positional
Vector
Transformed
Vector
Geometric Operation /
(Multiplication) [T]
Process of Transformations
Two Dimensional 2D Transformations
Transformed Vector: It is a representation of an Transformed object image
in computers memory. Usually represented in Matrix format (data
structure).
It has same matrix size as that of Positional Vector.
• Translation
• Rotation
• Scaling
• Reflection
• Shearing
• Morphing
• Coloring
Original
object
image
Transformed
image
Positional
Vector
Transformed
Vector
Geometric Operation /
(Multiplication) [T]
Process of Transformations
Two Dimensional 2D Transformations
Representation of Original Object /
Positional Vector in Brain
Two Dimensional 2D Transformations
Representation of Original Object /
Positional Vector in Brain
Two Dimensional 2D Transformations
Representation of Original Object /
Positional Vector in Brain
Two Dimensional 2D Transformations
Representation of Original Object /
Positional Vector in Brain
Two Dimensional 2D Transformations
Representation of Original Object / Positional Vector
Why do we use matrix to represent Positional Vector?
• More convenient organization of data.
• More efficient processing
• Enable the combination of various concatenations
Example 1: Consider a single point object P
then, the Positional Vector in matrix form is,
as follows,
P =
𝑥
𝑦 OR P = 𝒙 𝒚 P(x,y)
Column
Matrix Form
Row Matrix
Form
Note: In this Presentation we use Row Matrix Form to show all Transformations
Two Dimensional 2D Transformations
Representation of Original Object / Positional Vector
Example 2: Consider a line object P1P2 then, the Positional
Vector P in matrix form is, as follows,
P =
𝒙𝟏
𝒚𝟏
OR P =
𝒙𝟏
𝒙𝟐
𝒚𝟏
𝒚𝟐
Column
Matrix Form
Row Matrix
Form
𝒙𝟐
𝒚𝟐
Example 3: Consider a Triangle object
ΔP1P2P3 then, the Positional Vector P in
matrix form is, as follows,
P =
𝒙𝟏
𝒚𝟏
𝒙𝟐
𝒚𝟐
𝒙𝟑
𝒚𝟑
OR P =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
P1(x1,y1)
P2(x2,y2)
P3(x3,y3)
Two Dimensional 2D Transformations
Homogeneous co-ordinate system Positional Vector
Example 2:
Consider a line object P1P2
P =
𝒙𝟏
𝒙𝟐
𝒚𝟏
𝒚𝟐
𝒛𝟏
𝒛𝟐
Example 3:
Consider a Triangle object ΔP1P2P3
P =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
• In 3D system there are three coordinates ( x, y, z ) to represent each pixel P.
• When we perform 2D transformation it is must that all points of the objects
lies in single plane i.e. z = 1.
• When all pixels of the objects lies in same 2D plane e.g. z =1 the these pixels
are known to be in homogeneous co-ordinate system.
𝒛𝟏
𝒛𝟐
𝒛𝟑
When Object pixels are in 3D Space
When Object pixels are in Homogeneous Coordinate system z=1 plane
P =
𝒙𝟏
𝒙𝟐
𝒚𝟏
𝒚𝟐
𝟏
𝟏 P =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
𝟏
𝟏
𝟏
Note: In this Presentation we use Homogeneous PV to show all Transformations
Two Dimensional 2D Transformations
Transformation Matrix / Geometric Operator [ T ]
• In Computer Graphics it uses matrix multiplications to Perform any
Transformations on set of points represented in positional vector [ P
].
• The Transformation matrix [ T ] is used to performed the desired
Transformation.
• It is assumed that two matrices are known i.e. [ P ] and [ T ] and
these are the input for all transformations.
• The Transformation Matrix [ T ] is of 3 X 3 size i.e. 3 rows and 3 col.
• Following is the Transformation Matrix [ T ].
[ T ] =
𝒂
𝒅
𝒈
𝒃
𝒆
𝒉
𝒄
𝒇
𝒊
• The desired Transformation is obtained with multiplication of [ P ]
and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]
Two Dimensional 2D Transformations
Transformation Matrix / Geometric Operator [ T ]
• The desired Transformation is obtained with multiplication
of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
𝟏
𝟏
𝟏
X
𝒂
𝒅
𝒈
𝒃
𝒆
𝒉
𝒄
𝒇
𝒊
R1 x 3 3 x C2
• The Size of Resultant Matrix [ R ] is R1 x C2
Two Dimensional 2D Transformations
Transformation by Unit Matrix
• If the Transformation Matrix [ T ] is Unit Matrix as follows.
• The desired Transformation is obtained with multiplication
of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]
• Here Transformed Object is same as that of Original Object hence no
transformation has done.
• So Object has not transformed and remain as it is at original positions.
• The Size of Resultant Matrix [ R ] is R1 x C2.
[ T ] =
𝟏
𝟎
𝟎
𝟎
𝟏
𝟎
𝟎
𝟎
𝟏
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
𝟏
𝟎
𝟎
𝟎
𝟏
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x C2
=
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
𝟏
𝟏
𝟏
R1 x C2
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics
• In scaling, we can expend or compress the size of any object.
• We can apply scaling on the object by multiplying the original
coordinates with scaling factors Sx and Sy.
• The term scaling factor is used to define whether the size of an
object is increased or decreased.
• We can represent the scaling factor by ‘Sx’ for the x-axis and
‘Sy’ for the y-axis.
• The Scaling Transformation is obtained with multiplication of
[ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x C2
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
𝑺𝒙
𝟎
𝟎
𝟎
𝑺𝒚
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x C2
=
𝑺𝒙 . 𝒙𝟏
𝑺𝒙 . 𝒙𝟐
𝑺𝒙 . 𝒙𝟑
𝑺𝒚 . 𝒚𝟏
𝑺𝒚 . 𝒚𝟐
𝑺𝒚 . 𝒚𝟑
𝟏
𝟏
𝟏
R1 x C2
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics
𝟏
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
X
𝟑
𝟎
𝟎
𝟎
𝟒
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x C2
=
𝟑
𝟏𝟐
𝟏𝟐
𝟑
𝟏𝟔
𝟏𝟔
𝟒
𝟒
𝟏
𝟏
𝟏
𝟏
R1 x C2
• Example: A Square object
with the coordinate points D
(1, 4), C (4, 4), B (4, 1), A
(1,1).
• Apply the scaling factor 3 on
the X-axis and 4 on the Y-
axis.
• Find out the new coordinates
of the square?
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics - Enlargement
𝟏
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
X
𝟑
𝟎
𝟎
𝟎
𝟒
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x C2
=
𝟑
𝟏𝟐
𝟏𝟐
𝟑
𝟏𝟔
𝟏𝟔
𝟒
𝟒
𝟏
𝟏
𝟏
𝟏
R1 x C2
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics compression
𝟏
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
X
𝟏
𝟎
𝟎
𝟎
𝟎. 𝟐𝟓
𝟎
𝟎
𝟎
𝟏
4 x 3 3 x C2
=
𝟏
𝟒
𝟒
𝟏
𝟏
𝟏
𝟎. 𝟐𝟓
𝟎. 𝟐𝟓
𝟏
𝟏
𝟏
𝟏
R1 x C2
• Example: A Square object
with the coordinate points D
(1, 4), C (4, 4), B (4, 1), A
(1,1).
• Apply the scaling factor 1 on
the X-axis and 0.25 on the Y-
axis.
• Find out the new coordinates
of the square?
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics - Compression
𝟏
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
X
𝟏
𝟎
𝟎
𝟎
𝟎. 𝟐𝟓
𝟎
𝟎
𝟎
𝟏
4 x 3 3 x C2
=
𝟏
𝟒
𝟒
𝟏
𝟏
𝟏
𝟎. 𝟐𝟓
𝟎. 𝟐𝟓
𝟏
𝟏
𝟏
𝟏
R1 x C2
Two Dimensional 2D Transformations
2D Scaling Rules in Computer Graphics
T= identity matrix:
a=e=i=1, b=c=d==f=g=h=0 Results for all x’ = x, y’ = y.
Scaling Rules by parameters a and e :
b=c=d==f=g=h=0 => x' = a.x, y' = e.y; This is scaling by a in x, d in y.
• If, a = e > 1, we have enlargement (scale up) & uniform scaling.
• If, a ≠ e > 1, we have enlargement (scale up) & non-uniform scaling.
• If, 0 < a = e < 1, we have compression (scale down) & uniform scaling.
• If, 0 < a ≠ e < 1, we have compression (scale down) & non-uniform
scaling.
Uniform Scaling by parameter i: a = e = 1 and b=c=d==f=g=h=0
• If, i > 1, we have compression (scale down) & uniform scaling.
• If, i < 1, we have enlargement (scale up) & uniform scaling.
• If, i = 1, we have [ T ] as Unit Matrix hence results for all x’ = x, y’ = y.
[ T ] =
𝒂
𝒅
𝒈
𝒃
𝒆
𝒉
𝒄
𝒇
𝒊
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics compression
𝟏
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
X
𝟏
𝟎
𝟎
𝟎
𝟏
𝟎
𝟎
𝟎
𝟐
4 x 3 3 x 3
=
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
𝟐
𝟐
𝟐
𝟐
4 x 3
• Example: A Square object with the coordinate points D (1, 4), C (4, 4), B
(4, 1), A (1,1). Apply the scaling factor 2 on both axis. Find out the new
coordinates of the square?
Some Observations and Imaginations are,
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics compression
• Here Original object Matrix [ P ] is in One Homogeneous Co-ordinate Plane (z=1) plane.
• And The Resultant object Matrix [ R ] which is of same size, lies in another
Homogeneous Co-ordinate Plane (z=2) plane.
• It is needed to bring Resultant object of [ R ] in the same plane of [ P ] i.e. z = 1
• Divide each row of [ R ] by third column element
[ R ] =
𝟎. 𝟓
𝟐
𝟐
𝟎. 𝟓
𝟐
𝟐
𝟎. 𝟓
𝟎. 𝟓
𝟏
𝟏
𝟏
𝟏
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
𝟐
𝟐
𝟐
𝟐
[ R ] =
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics compression
[ R ] =
𝟎. 𝟓
𝟐
𝟐
𝟎. 𝟓
𝟐
𝟐
𝟎. 𝟓
𝟎. 𝟓
𝟏
𝟏
𝟏
𝟏
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics compression
𝟏
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
X
𝟏
𝟎
𝟎
𝟎
𝟏
𝟎
𝟎
𝟎
𝟎. 𝟓
4 x 3 3 x 3
=
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
𝟎. 𝟓
𝟎. 𝟓
𝟎. 𝟓
𝟎. 𝟓
4 x 3
• Example: A Square object with the coordinate points D (1, 4), C (4, 4), B
(4, 1), A (1,1). Apply the scaling factor 0.5 on both axis. Find out the new
coordinates of the square?
Some Observations and Imaginations are,
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics compression
• Here Original object Matrix [ P ] is in One Homogeneous Co-ordinate Plane (z=1) plane.
• And The Resultant object Matrix [ R ] which is of same size, lies in another
Homogeneous Co-ordinate Plane (z=0.5) plane.
• It is needed to bring Resultant object of [ R ] in the same plane of [ P ] i.e. z = 1
• Divide each row of [ R ] by third column element
[ R ] =
𝟐
𝟖
𝟖
𝟐
𝟖
𝟖
𝟐
𝟐
𝟏
𝟏
𝟏
𝟏
[ R ] =
𝟏
𝟒
𝟒
𝟏
𝟒
𝟒
𝟏
𝟏
𝟎. 𝟓
𝟎. 𝟓
𝟎. 𝟓
𝟎. 𝟓
Two Dimensional 2D Transformations
2D Scaling in Computer Graphics compression
[ R ] =
𝟐
𝟖
𝟖
𝟐
𝟖
𝟖
𝟐
𝟐
𝟏
𝟏
𝟏
𝟏
Two Dimensional 2D Transformations
2D Reflection in Computer Graphics
• It is a transformation which produces a mirror image of an object.
• The mirror image can be either about x-axis or y-axis.
• The object is rotated by180°.
• Types of Reflection:
a) Reflection about the x-axis (𝒓𝒙 = 1, 𝒓𝒚 = -1)
b) Reflection about the y-axis (𝒓𝒙 = -1, 𝒓𝒚 = 1)
c) Reflection about an axis perpendicular to xy plane and passing through
the origin. (𝒓𝒙 = -1, 𝒓𝒚 = -1)
d) Reflection about line y=x
• Here 𝒓𝒚 , 𝒓𝒙 can be either -1 for reflection.
• The Reflection Transformation is obtained with multiplication of [ P ] and [ T ]
matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x C2.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
𝒓𝒙
𝟎
𝟎
𝟎
𝒓𝒚
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x 3
=
𝒓𝒙. 𝒙𝟏
𝒓𝒙. 𝒙𝟐
𝒓𝒙. 𝒙𝟑
𝒓𝒚. 𝒚𝟏
𝒓𝒚. 𝒚𝟐
𝒓𝒚. 𝒚𝟑
𝟏
𝟏
𝟏
R1 x 3
Two Dimensional 2D Transformations
2D Reflection in Computer Graphics
• 1. Reflection about x-axis: The object
can be reflected about x-axis with the help
of the following matrix
• In this transformation value of x will
remain same whereas the value of y will
become negative.
• The Reflection Transformation is obtained
with multiplication of [ P ] and [ T ]
matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x
C2.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
𝟏
𝟎
𝟎
𝟎
−𝟏
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x 3
=
𝒙𝟏
𝒙𝟐
𝒙𝟑
−𝒚𝟏
−𝒚𝟐
−𝒚𝟑
𝟏
𝟏
𝟏
R1 x C2
[ T ] =
• Following figures shows the
reflection of the object axis.
• The object will lie another side of
the x-axis
Two Dimensional 2D Transformations
2D Reflection in Computer Graphics
• 2. Reflection about y-axis: The object
can be reflected about y-axis with the help
of following transformation matrix
• In this transformation value of y will
remain same whereas the value of x will
become negative.
• The Reflection Transformation is obtained
with multiplication of [ P ] and [ T ]
matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x
C2.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
−𝟏
𝟎
𝟎
𝟎
𝟏
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x 3
=
−𝒙𝟏
−𝒙𝟐
−𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
𝟏
𝟏
𝟏
R1 x C2
• The following figure shows the
reflection about the y-axis
[ T ] =
Two Dimensional 2D Transformations
2D Reflection in Computer Graphics
• 3. Reflection about an axis
perpendicular to xy plane and passing
through origin:
• In this value of x and y both will be
reversed. This is also called as half
revolution about the origin.
• The Reflection Transformation is obtained
with multiplication of [ P ] and [ T ]
matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x
C2.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
−𝟏
𝟎
𝟎
𝟎
−𝟏
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x 3
=
−𝒙𝟏
−𝒙𝟐
−𝒙𝟑
−𝒚𝟏
−𝒚𝟐
−𝒚𝟑
𝟏
𝟏
𝟏
R1 x C2
• The following figure shows the
reflection about an axis
perpendicular to xy plane
[ T ] =
Two Dimensional 2D Transformations
2D Reflection in Computer Graphics
• 3. Reflection about an axis
perpendicular to xy plane and passing
through origin:
• In this value of x and y both will be
reversed. This is also called as half
revolution about the origin.
• The Reflection Transformation is obtained
with multiplication of [ P ] and [ T ]
matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x
C2.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
−𝟏
𝟎
𝟎
𝟎
−𝟏
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x 3
=
−𝒙𝟏
−𝒙𝟐
−𝒙𝟑
−𝒚𝟏
−𝒚𝟐
−𝒚𝟑
𝟏
𝟏
𝟏
R1 x C2
• The following figure shows the
reflection about an axis
perpendicular to xy plane
[ T ] =
Two Dimensional 2D Transformations
2D Reflection in Computer Graphics
• 4. Reflection about line y=x: The object
may be reflected about line y = x with the
help of following transformation matrix
• In this value of x and y both will be
exchanged. This is also called as
reflection about y=x line.
• The Reflection Transformation is obtained
with multiplication of [ P ] and [ T ]
matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x
C2.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
𝟎
𝟏
𝟎
𝟏
𝟎
𝟎
𝟎
𝟎
𝟏
=
𝒚𝟏
𝒚𝟐
𝒚𝟑
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝟏
𝟏
𝟏
R1 x C2
• The following figure shows the
reflection about an x=y line
[ T ] =
Two Dimensional 2D Transformations
2D Reflection in Computer Graphics
Problem-01: Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the reflection on the
X axis and obtain the new coordinates of the object.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝟑
𝟔
𝟓
𝟒
𝟒
𝟔
X
𝟏
𝟎
𝟎
𝟎
−𝟏
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x 3
=
𝟑
𝟔
𝟓
−𝟒
−𝟒
−𝟔
𝟏
𝟏
𝟏
R1 x C2
Problem-02: Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the reflection on the
X=Y Line to obtain the new coordinates of the object.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝟑
𝟔
𝟓
𝟒
𝟒
𝟔
X
𝟎
𝟏
𝟎
𝟏
𝟎
𝟎
𝟎
𝟎
𝟏
R1 x 3 3 x 3
=
𝟒
𝟒
𝟔
𝟑
𝟔
𝟓
𝟏
𝟏
𝟏
R1 x C2
Problem-03: Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the reflection on the
Y axis to obtain the new coordinates of the object.
Two Dimensional 2D Transformations
2D Translation in Computer Graphics
• We can move any object from one to
another place without changing the shape
of the object.
• Translation of a Point: If we want to
translate a point from P (x0, y0) to Q (x1,
y1), then we have to add Translation
coordinates (Tx, Ty) with original
coordinates.
• The Translation Transformation is
obtained with multiplication of [ P ] and [
T ] matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x
C2.
𝟏
𝟏
𝟏
[ R ] = [ P ] . [ T ] =
𝒙𝟏
𝒙𝟐
𝒙𝟑
𝒚𝟏
𝒚𝟐
𝒚𝟑
X
𝟏
𝟎
𝑻𝒙
𝟎
𝟏
𝑻𝒚
𝟎
𝟎
𝟏
=
𝒙𝟏 + 𝑻𝒙
𝒙𝟐 + 𝑻𝒙
𝒙𝟑 + 𝑻𝒙
𝒚𝟏 + 𝑻𝒚
𝒚𝟐 + 𝑻𝒚
𝒚𝟑 + 𝑻𝒚
R1 x C2
• The following figure shows the
translation from P to Q Pixel.
𝟏
𝟏
𝟏
Two Dimensional 2D Transformations
2D Rotation in Computer Graphics
• In rotation, we rotate the object at
particular angle θ theta from its origin.
• From the following figure, we can see that
the point P(X,Y) is located at angle φ from
the horizontal X coordinate with distance
r from the origin.
• Let us suppose you want to rotate it at
the angle θ.
• The Rotation Transformation is obtained
with multiplication of [ P ] and [ T ]
matrices. i.e. [ P ] x [ T ] = [ R ].
• The Size of Resultant Matrix [ R ] is R1 x
C2.
• After rotating it to a new location,
you will get a new point P’ (X′,Y′).
Two Dimensional 2D Transformations
2D Anticlockwise Rotation in Computer Graphics
• Using standard trigonometric the original
coordinate of point P(X,Y) can be represented
as −
• X=rcosϕ......(1)
• Y=rsinϕ......(2)
• Same way we can represent the point P’ X′,Y′
as −
• x′=rcos(ϕ+θ)=r cosϕcosθ−r
sinϕsinθ.......(3)
• y′=rsin(ϕ+θ)=r cosϕsinθ+r
sinϕcosθ.......(4)
• Substituting equation 1 & 2 in 3 & 4
respectively, we will get
• x′ = xcosθ − ysinθ
• y′ = xsinθ + ycosθ
• Representing the above equation in matrix
[ R ] =[ X Y ] x
cos(θ) sin(θ)
−sin(θ) cos(θ)
0
0
1
𝒄𝒐𝒔(θ) 𝒔𝒊𝒏(θ)
−𝒔𝒊𝒏(θ)
𝟎
𝒄𝒐𝒔(θ)
𝟎
For Anti-clockwise Rotation
[ T ]=
Two Dimensional 2D Transformations
2D Clockwise Rotation in Computer Graphics
For clockwise Rotation
• Consider Previous equations,
• x′ = xcosθ − ysinθ .......(5)
• y′ = xsinθ + ycosθ .......(6)
• Substituting equation -θ in 5 & 6, we will get
• x′ = xcos(-θ) − y sin(-θ) .......(5)
• y′ = xsin(-θ) + ycos(-θ) .......(6)
• Becomes,
• x′ = xcosθ − ( - ysinθ)
• y′ = -xsinθ + ycosθ
• Results
• x′ = xcosθ + ysinθ .......(7)
• y′ = -xsinθ + ycosθ .......(8)
• Representing the above equation in matrix
form,
[ R ] =[ X Y ] x
cos(θ) −sin(θ)
sin(θ) cos(θ)
0
0
1
𝒄𝒐𝒔(θ) −𝒔𝒊𝒏(θ)
𝒔𝒊𝒏(θ)
𝟎
𝒄𝒐𝒔(θ)
𝟎
For clockwise Rotation
[ T ]=
Two Dimensional 2D Transformations
2D Shearing in Computer Graphics
• A transformation that slants the shape of an object is called the shear
transformation.
• There are two shear transformations
• X-Shear
• Y-Shear.
• X-Y Shear.
• One shifts X coordinates values and other shifts Y coordinate values.
• However in both the cases only one coordinate changes its coordinates and
other preserves its values.
• Shearing is also termed as Skewing.
Two Dimensional 2D Transformations
2D Shearing in Computer Graphics
X-Shear:
• The X-Shear preserves the Y coordinate and changes are made to X
coordinates, which causes the vertical lines to tilt right or left as shown in
below figure.
The transformation matrix for X-Shear can be represented as −
𝟏
𝟏
𝟏
𝟏 𝑺𝒉𝒙
𝟎
𝟎
𝟏
𝟎
For X-Shear
[ T ]=
Two Dimensional 2D Transformations
2D Shearing in Computer Graphics
Y-Shear:
• The Y-Shear preserves the X coordinates and changes the Y coordinates
which causes the horizontal lines to transform into lines which slopes up or
down as shown in the following figure.
The transformation matrix for Y-Shear can be represented as −
𝟏
𝟏
𝟏
𝟏 𝟎
𝑺𝒉𝒚
𝟎
𝟏
𝟎
For Y-Shear
[ T ]=
Two Dimensional 2D Transformations
2D Shearing in Computer Graphics
X-Y-Shear:
• The XY-Shear changes the X and Y coordinates which causes the horizontal
and vertical lines to transform into lines which slopes up and down as
shown in the following figure.
The transformation matrix for Y-Shear can be represented as −
𝟏
𝟏
𝟏
𝟏 𝑺𝒉𝒙
𝑺𝒉𝒚
𝟎
𝟏
𝟎
For Y-Shear
[ T ]=
Two Dimensional 2D Transformations
Composite / Concatenation / Combined Transformation
• If a transformation of the plane T1 is followed by a second plane transformation T2,
then the result itself may be represented by a single transformation T which is the
composition of T1 and T2 taken in that order.
• This is written as T = [ T1 ] ∙ [ T2 ].
• Composite transformation can be achieved by concatenation of transformation
matrices to obtain a combined transformation matrix.
• A combined matrix − [ T ] = [ T1 ] [ T2 ] [ T3 ] [ T4 ] …. [ Tn ]
• Where [Ti] is any combination of- Translation, Scaling, Shearing, Rotation,
Reflection
• The change in the order of transformation would lead to different results, as in
general matrix multiplication is not cumulative, that is [A] . [B] ≠ [B] . [A] and the
order of multiplication.
• The basic purpose of composing transformations is to gain efficiency by applying a
single composed transformation to a point, rather than applying a series of
transformation, one after another.

More Related Content

What's hot

Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
Saideep
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.ppt
karthikaparthasarath
 
Adversarial Search
Adversarial SearchAdversarial Search
Adversarial Search
Megha Sharma
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicIntroduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in Logic
Vishal Tandel
 
Hill climbing
Hill climbingHill climbing
Hill climbing
Mohammad Faizan
 
First order logic
First order logicFirst order logic
First order logic
Megha Sharma
 
Planning
PlanningPlanning
Planning
ahmad bassiouny
 
AI - Local Search - Hill Climbing
AI - Local Search - Hill ClimbingAI - Local Search - Hill Climbing
AI - Local Search - Hill Climbing
Andrew Ferlitsch
 
SPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSINGSPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSING
muthu181188
 
blackboard architecture
blackboard architectureblackboard architecture
blackboard architecture
Nguyễn Ngân
 
Frequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesFrequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement Techniques
Diwaker Pant
 
Ch2 properties of the task environment
Ch2 properties of the task environmentCh2 properties of the task environment
Ch2 properties of the task environment
Julyn Mae Pagmanoja
 
COMPUTER GRAPHICS
COMPUTER GRAPHICSCOMPUTER GRAPHICS
COMPUTER GRAPHICS
Jagan Raja
 
Water jug problem ai part 6
Water jug problem ai part 6Water jug problem ai part 6
Water jug problem ai part 6
Kirti Verma
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
Tech_MX
 
Histogram processing
Histogram processingHistogram processing
Predicate logic
 Predicate logic Predicate logic
Predicate logic
Harini Balamurugan
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
Akhil Kaushik
 
Hog and sift
Hog and siftHog and sift
Hog and sift
AnandShinde47
 

What's hot (20)

Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
 
Heuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.pptHeuristic Search Techniques Unit -II.ppt
Heuristic Search Techniques Unit -II.ppt
 
Adversarial Search
Adversarial SearchAdversarial Search
Adversarial Search
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Introduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in LogicIntroduction on Prolog - Programming in Logic
Introduction on Prolog - Programming in Logic
 
Hill climbing
Hill climbingHill climbing
Hill climbing
 
First order logic
First order logicFirst order logic
First order logic
 
Planning
PlanningPlanning
Planning
 
AI - Local Search - Hill Climbing
AI - Local Search - Hill ClimbingAI - Local Search - Hill Climbing
AI - Local Search - Hill Climbing
 
SPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSINGSPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSING
 
blackboard architecture
blackboard architectureblackboard architecture
blackboard architecture
 
Frequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesFrequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement Techniques
 
Ch2 properties of the task environment
Ch2 properties of the task environmentCh2 properties of the task environment
Ch2 properties of the task environment
 
COMPUTER GRAPHICS
COMPUTER GRAPHICSCOMPUTER GRAPHICS
COMPUTER GRAPHICS
 
Water jug problem ai part 6
Water jug problem ai part 6Water jug problem ai part 6
Water jug problem ai part 6
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Histogram processing
Histogram processingHistogram processing
Histogram processing
 
Predicate logic
 Predicate logic Predicate logic
Predicate logic
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Hog and sift
Hog and siftHog and sift
Hog and sift
 

Similar to Overview of Transformation in Computer Graphics

Part 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptxPart 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptx
Khalil Alhatab
 
Part 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxPart 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptx
Khalil Alhatab
 
Part 2- Transformation.pptx
Part 2- Transformation.pptxPart 2- Transformation.pptx
Part 2- Transformation.pptx
Khalil Alhatab
 
Lecture 9-online
Lecture 9-onlineLecture 9-online
Lecture 9-online
lifebreath
 
Kulum alin-11 jan2014
Kulum alin-11 jan2014Kulum alin-11 jan2014
Kulum alin-11 jan2014
rolly purnomo
 
Two dimensionaltransformations
Two dimensionaltransformationsTwo dimensionaltransformations
Two dimensionaltransformations
Nareek
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Bala Murali
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Diksha Trivedi
 
affine transformation for computer graphics
affine transformation for computer graphicsaffine transformation for computer graphics
affine transformation for computer graphics
DrSUGANYADEVIK
 
2d transformations
2d transformations2d transformations
2d transformations
kmrvivek2
 
2d transformations
2d transformations2d transformations
2d transformations
Rajat Kaliraman
 
Introduction to Transformationjrshyree4ytszs.pptx
Introduction to Transformationjrshyree4ytszs.pptxIntroduction to Transformationjrshyree4ytszs.pptx
Introduction to Transformationjrshyree4ytszs.pptx
IshanSharma386792
 
GeometricTransformations.ppt
GeometricTransformations.pptGeometricTransformations.ppt
GeometricTransformations.ppt
Debjit Doira
 
3 d transformation
3 d transformation3 d transformation
3 d transformation
Pooja Dixit
 
2 transformation computer graphics
2 transformation computer graphics2 transformation computer graphics
2 transformation computer graphics
cairo university
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
Ankit Garg
 
moule 3 ppt1 basic 2D transformations.pptx
moule 3 ppt1 basic 2D transformations.pptxmoule 3 ppt1 basic 2D transformations.pptx
moule 3 ppt1 basic 2D transformations.pptx
RADHIKAB20
 
TRANSFORMATION-CG.pptx
TRANSFORMATION-CG.pptxTRANSFORMATION-CG.pptx
TRANSFORMATION-CG.pptx
RubaNagarajan
 
transformation IT.ppt
transformation IT.ppttransformation IT.ppt
transformation IT.ppt
ShubhamBatwani
 
2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx
2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx
2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx
Harikumar Rajasekar
 

Similar to Overview of Transformation in Computer Graphics (20)

Part 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptxPart 3- Manipulation and Representation of Curves.pptx
Part 3- Manipulation and Representation of Curves.pptx
 
Part 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptxPart 2- Geometric Transformation.pptx
Part 2- Geometric Transformation.pptx
 
Part 2- Transformation.pptx
Part 2- Transformation.pptxPart 2- Transformation.pptx
Part 2- Transformation.pptx
 
Lecture 9-online
Lecture 9-onlineLecture 9-online
Lecture 9-online
 
Kulum alin-11 jan2014
Kulum alin-11 jan2014Kulum alin-11 jan2014
Kulum alin-11 jan2014
 
Two dimensionaltransformations
Two dimensionaltransformationsTwo dimensionaltransformations
Two dimensionaltransformations
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
affine transformation for computer graphics
affine transformation for computer graphicsaffine transformation for computer graphics
affine transformation for computer graphics
 
2d transformations
2d transformations2d transformations
2d transformations
 
2d transformations
2d transformations2d transformations
2d transformations
 
Introduction to Transformationjrshyree4ytszs.pptx
Introduction to Transformationjrshyree4ytszs.pptxIntroduction to Transformationjrshyree4ytszs.pptx
Introduction to Transformationjrshyree4ytszs.pptx
 
GeometricTransformations.ppt
GeometricTransformations.pptGeometricTransformations.ppt
GeometricTransformations.ppt
 
3 d transformation
3 d transformation3 d transformation
3 d transformation
 
2 transformation computer graphics
2 transformation computer graphics2 transformation computer graphics
2 transformation computer graphics
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
moule 3 ppt1 basic 2D transformations.pptx
moule 3 ppt1 basic 2D transformations.pptxmoule 3 ppt1 basic 2D transformations.pptx
moule 3 ppt1 basic 2D transformations.pptx
 
TRANSFORMATION-CG.pptx
TRANSFORMATION-CG.pptxTRANSFORMATION-CG.pptx
TRANSFORMATION-CG.pptx
 
transformation IT.ppt
transformation IT.ppttransformation IT.ppt
transformation IT.ppt
 
2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx
2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx
2hjsakhvchcvj hSKchvsABJChjSVCHjhvcvdxz.pptx
 

More from Chandrakant Divate

Web Technology LAB MANUAL for Undergraduate Programs
Web Technology  LAB MANUAL for Undergraduate ProgramsWeb Technology  LAB MANUAL for Undergraduate Programs
Web Technology LAB MANUAL for Undergraduate Programs
Chandrakant Divate
 
UNIVERSAL HUMAN VALUES- Harmony in the Nature
UNIVERSAL HUMAN VALUES- Harmony in the NatureUNIVERSAL HUMAN VALUES- Harmony in the Nature
UNIVERSAL HUMAN VALUES- Harmony in the Nature
Chandrakant Divate
 
Study of Computer Hardware System using Block Diagram
Study of Computer Hardware System using Block DiagramStudy of Computer Hardware System using Block Diagram
Study of Computer Hardware System using Block Diagram
Chandrakant Divate
 
Computer System Output Devices Peripherals
Computer System Output  Devices PeripheralsComputer System Output  Devices Peripherals
Computer System Output Devices Peripherals
Chandrakant Divate
 
Computer system Input Devices Peripherals
Computer system Input  Devices PeripheralsComputer system Input  Devices Peripherals
Computer system Input Devices Peripherals
Chandrakant Divate
 
Computer system Input and Output Devices
Computer system Input and Output DevicesComputer system Input and Output Devices
Computer system Input and Output Devices
Chandrakant Divate
 
Introduction to COMPUTER’S MEMORY RAM and ROM
Introduction to COMPUTER’S MEMORY RAM and ROMIntroduction to COMPUTER’S MEMORY RAM and ROM
Introduction to COMPUTER’S MEMORY RAM and ROM
Chandrakant Divate
 
Introduction to Computer Hardware Systems
Introduction to Computer Hardware SystemsIntroduction to Computer Hardware Systems
Introduction to Computer Hardware Systems
Chandrakant Divate
 
Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2
Chandrakant Divate
 
Fundamentals of Internet of Things (IoT)
Fundamentals of Internet of Things (IoT)Fundamentals of Internet of Things (IoT)
Fundamentals of Internet of Things (IoT)
Chandrakant Divate
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
Chandrakant Divate
 
Fundamentals of functions in C program.pptx
Fundamentals of functions in C program.pptxFundamentals of functions in C program.pptx
Fundamentals of functions in C program.pptx
Chandrakant Divate
 
Fundamentals of Structure in C Programming
Fundamentals of Structure in C ProgrammingFundamentals of Structure in C Programming
Fundamentals of Structure in C Programming
Chandrakant Divate
 
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN CINPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
Chandrakant Divate
 
Programming in C - Fundamental Study of Strings
Programming in C - Fundamental Study of  StringsProgramming in C - Fundamental Study of  Strings
Programming in C - Fundamental Study of Strings
Chandrakant Divate
 
Basics of Control Statement in C Languages
Basics of Control Statement in C LanguagesBasics of Control Statement in C Languages
Basics of Control Statement in C Languages
Chandrakant Divate
 
Features and Fundamentals of C Language for Beginners
Features and Fundamentals of C Language for BeginnersFeatures and Fundamentals of C Language for Beginners
Features and Fundamentals of C Language for Beginners
Chandrakant Divate
 
Basics of Programming Algorithms and Flowchart
Basics of Programming Algorithms and FlowchartBasics of Programming Algorithms and Flowchart
Basics of Programming Algorithms and Flowchart
Chandrakant Divate
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
Chandrakant Divate
 
Computer Graphics Three-Dimensional Geometric Transformations
Computer Graphics Three-Dimensional Geometric TransformationsComputer Graphics Three-Dimensional Geometric Transformations
Computer Graphics Three-Dimensional Geometric Transformations
Chandrakant Divate
 

More from Chandrakant Divate (20)

Web Technology LAB MANUAL for Undergraduate Programs
Web Technology  LAB MANUAL for Undergraduate ProgramsWeb Technology  LAB MANUAL for Undergraduate Programs
Web Technology LAB MANUAL for Undergraduate Programs
 
UNIVERSAL HUMAN VALUES- Harmony in the Nature
UNIVERSAL HUMAN VALUES- Harmony in the NatureUNIVERSAL HUMAN VALUES- Harmony in the Nature
UNIVERSAL HUMAN VALUES- Harmony in the Nature
 
Study of Computer Hardware System using Block Diagram
Study of Computer Hardware System using Block DiagramStudy of Computer Hardware System using Block Diagram
Study of Computer Hardware System using Block Diagram
 
Computer System Output Devices Peripherals
Computer System Output  Devices PeripheralsComputer System Output  Devices Peripherals
Computer System Output Devices Peripherals
 
Computer system Input Devices Peripherals
Computer system Input  Devices PeripheralsComputer system Input  Devices Peripherals
Computer system Input Devices Peripherals
 
Computer system Input and Output Devices
Computer system Input and Output DevicesComputer system Input and Output Devices
Computer system Input and Output Devices
 
Introduction to COMPUTER’S MEMORY RAM and ROM
Introduction to COMPUTER’S MEMORY RAM and ROMIntroduction to COMPUTER’S MEMORY RAM and ROM
Introduction to COMPUTER’S MEMORY RAM and ROM
 
Introduction to Computer Hardware Systems
Introduction to Computer Hardware SystemsIntroduction to Computer Hardware Systems
Introduction to Computer Hardware Systems
 
Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2
 
Fundamentals of Internet of Things (IoT)
Fundamentals of Internet of Things (IoT)Fundamentals of Internet of Things (IoT)
Fundamentals of Internet of Things (IoT)
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Fundamentals of functions in C program.pptx
Fundamentals of functions in C program.pptxFundamentals of functions in C program.pptx
Fundamentals of functions in C program.pptx
 
Fundamentals of Structure in C Programming
Fundamentals of Structure in C ProgrammingFundamentals of Structure in C Programming
Fundamentals of Structure in C Programming
 
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN CINPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
INPUT AND OUTPUT STATEMENTS IN PROGRAMMING IN C
 
Programming in C - Fundamental Study of Strings
Programming in C - Fundamental Study of  StringsProgramming in C - Fundamental Study of  Strings
Programming in C - Fundamental Study of Strings
 
Basics of Control Statement in C Languages
Basics of Control Statement in C LanguagesBasics of Control Statement in C Languages
Basics of Control Statement in C Languages
 
Features and Fundamentals of C Language for Beginners
Features and Fundamentals of C Language for BeginnersFeatures and Fundamentals of C Language for Beginners
Features and Fundamentals of C Language for Beginners
 
Basics of Programming Algorithms and Flowchart
Basics of Programming Algorithms and FlowchartBasics of Programming Algorithms and Flowchart
Basics of Programming Algorithms and Flowchart
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Computer Graphics Three-Dimensional Geometric Transformations
Computer Graphics Three-Dimensional Geometric TransformationsComputer Graphics Three-Dimensional Geometric Transformations
Computer Graphics Three-Dimensional Geometric Transformations
 

Recently uploaded

Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
PreethaV16
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
Paris Salesforce Developer Group
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 08 Doors and Windows.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 08 Doors and Windows.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 08 Doors and Windows.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 08 Doors and Windows.pdf
Yasser Mahgoub
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
CVCSOfficial
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
aryanpankaj78
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
upoux
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
ijaia
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
Prakhyath Rai
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 

Recently uploaded (20)

Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 08 Doors and Windows.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 08 Doors and Windows.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 08 Doors and Windows.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 08 Doors and Windows.pdf
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...Software Engineering and Project Management - Introduction, Modeling Concepts...
Software Engineering and Project Management - Introduction, Modeling Concepts...
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...Software Engineering and Project Management - Software Testing + Agile Method...
Software Engineering and Project Management - Software Testing + Agile Method...
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 

Overview of Transformation in Computer Graphics

  • 1. Unit 3: Overview Of Transformation Mr. C. P. Divate Department Of Computer Engineering
  • 3. Two Dimensional 2D Transformations What is transformations? a) The geometrical changes of an object from it’s current state to another modified state is known as transformation. b) “Transformations are the operations applied to existing geometrical data of an object to change its position, orientation, or size are called geometric transformations”.
  • 4. Two Dimensional 2D Transformations Why the transformations are needed? • To manipulate the initially created object and to display the modified object without having to redraw it. • To Change the shape of object. • To Study the object surface details. • To Study the future and past changes in objects. • To modify old images. • To get mirror image / Reflections of object. • To change the color of objects. etc.
  • 5. Two Dimensional 2D Transformations a) Translation- It is a process of Moving / shifting the position of an object from one location to another in a straight-line path. b) Rotation- It is a process rotating an object either • Around itself. • In clockwise or anti clockwise direction about any point on screen. c) Scaling- It is a process enlarging / Compressing an object size. d) Reflection- It is the process which gives mirror image of an object. e) Shearing- It is the process where object get distorted in different shape. f) Morphing- It is the process where object gets transit from between two shapes. g) Coloring- It is process where object gets colored. Types of Transformations?
  • 6. Two Dimensional 2D Transformations Process of Transformation: It is a single step process in computer graphics where original object image is given as input to transformation process software and returns output as Transformed object image. Positional Vector: It is a representation of an original object image in computers memory. Usually represented in Matrix format (data structure). Process of Transformations • Translation • Rotation • Scaling • Reflection • Shearing • Morphing • Coloring Original object image Transformed image Positional Vector Transformed Vector Geometric Operation / (Multiplication) [T]
  • 7. Two Dimensional 2D Transformations Geometric Operation: • All Transformations can be performed with Mathematical Techniques only. • In Computer Graphics transformations are performed with Matrix Calculations only. • Especially it uses Matrix Multiplication Operation to perform above transformations. • It has transformation matrix [ T ] of size 3 x 3 for each type of Transformation. • Translation • Rotation • Scaling • Reflection • Shearing • Morphing • Coloring Original object image Transformed image Positional Vector Transformed Vector Geometric Operation / (Multiplication) [T] Process of Transformations
  • 8. Two Dimensional 2D Transformations Transformed Vector: It is a representation of an Transformed object image in computers memory. Usually represented in Matrix format (data structure). It has same matrix size as that of Positional Vector. • Translation • Rotation • Scaling • Reflection • Shearing • Morphing • Coloring Original object image Transformed image Positional Vector Transformed Vector Geometric Operation / (Multiplication) [T] Process of Transformations
  • 9. Two Dimensional 2D Transformations Representation of Original Object / Positional Vector in Brain
  • 10. Two Dimensional 2D Transformations Representation of Original Object / Positional Vector in Brain
  • 11. Two Dimensional 2D Transformations Representation of Original Object / Positional Vector in Brain
  • 12. Two Dimensional 2D Transformations Representation of Original Object / Positional Vector in Brain
  • 13. Two Dimensional 2D Transformations Representation of Original Object / Positional Vector Why do we use matrix to represent Positional Vector? • More convenient organization of data. • More efficient processing • Enable the combination of various concatenations Example 1: Consider a single point object P then, the Positional Vector in matrix form is, as follows, P = 𝑥 𝑦 OR P = 𝒙 𝒚 P(x,y) Column Matrix Form Row Matrix Form Note: In this Presentation we use Row Matrix Form to show all Transformations
  • 14. Two Dimensional 2D Transformations Representation of Original Object / Positional Vector Example 2: Consider a line object P1P2 then, the Positional Vector P in matrix form is, as follows, P = 𝒙𝟏 𝒚𝟏 OR P = 𝒙𝟏 𝒙𝟐 𝒚𝟏 𝒚𝟐 Column Matrix Form Row Matrix Form 𝒙𝟐 𝒚𝟐 Example 3: Consider a Triangle object ΔP1P2P3 then, the Positional Vector P in matrix form is, as follows, P = 𝒙𝟏 𝒚𝟏 𝒙𝟐 𝒚𝟐 𝒙𝟑 𝒚𝟑 OR P = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 P1(x1,y1) P2(x2,y2) P3(x3,y3)
  • 15. Two Dimensional 2D Transformations Homogeneous co-ordinate system Positional Vector Example 2: Consider a line object P1P2 P = 𝒙𝟏 𝒙𝟐 𝒚𝟏 𝒚𝟐 𝒛𝟏 𝒛𝟐 Example 3: Consider a Triangle object ΔP1P2P3 P = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 • In 3D system there are three coordinates ( x, y, z ) to represent each pixel P. • When we perform 2D transformation it is must that all points of the objects lies in single plane i.e. z = 1. • When all pixels of the objects lies in same 2D plane e.g. z =1 the these pixels are known to be in homogeneous co-ordinate system. 𝒛𝟏 𝒛𝟐 𝒛𝟑 When Object pixels are in 3D Space When Object pixels are in Homogeneous Coordinate system z=1 plane P = 𝒙𝟏 𝒙𝟐 𝒚𝟏 𝒚𝟐 𝟏 𝟏 P = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 𝟏 𝟏 𝟏 Note: In this Presentation we use Homogeneous PV to show all Transformations
  • 16. Two Dimensional 2D Transformations Transformation Matrix / Geometric Operator [ T ] • In Computer Graphics it uses matrix multiplications to Perform any Transformations on set of points represented in positional vector [ P ]. • The Transformation matrix [ T ] is used to performed the desired Transformation. • It is assumed that two matrices are known i.e. [ P ] and [ T ] and these are the input for all transformations. • The Transformation Matrix [ T ] is of 3 X 3 size i.e. 3 rows and 3 col. • Following is the Transformation Matrix [ T ]. [ T ] = 𝒂 𝒅 𝒈 𝒃 𝒆 𝒉 𝒄 𝒇 𝒊 • The desired Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]
  • 17. Two Dimensional 2D Transformations Transformation Matrix / Geometric Operator [ T ] • The desired Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ] [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 𝟏 𝟏 𝟏 X 𝒂 𝒅 𝒈 𝒃 𝒆 𝒉 𝒄 𝒇 𝒊 R1 x 3 3 x C2 • The Size of Resultant Matrix [ R ] is R1 x C2
  • 18. Two Dimensional 2D Transformations Transformation by Unit Matrix • If the Transformation Matrix [ T ] is Unit Matrix as follows. • The desired Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ] • Here Transformed Object is same as that of Original Object hence no transformation has done. • So Object has not transformed and remain as it is at original positions. • The Size of Resultant Matrix [ R ] is R1 x C2. [ T ] = 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x C2 = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 𝟏 𝟏 𝟏 R1 x C2
  • 19. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics • In scaling, we can expend or compress the size of any object. • We can apply scaling on the object by multiplying the original coordinates with scaling factors Sx and Sy. • The term scaling factor is used to define whether the size of an object is increased or decreased. • We can represent the scaling factor by ‘Sx’ for the x-axis and ‘Sy’ for the y-axis. • The Scaling Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X 𝑺𝒙 𝟎 𝟎 𝟎 𝑺𝒚 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x C2 = 𝑺𝒙 . 𝒙𝟏 𝑺𝒙 . 𝒙𝟐 𝑺𝒙 . 𝒙𝟑 𝑺𝒚 . 𝒚𝟏 𝑺𝒚 . 𝒚𝟐 𝑺𝒚 . 𝒚𝟑 𝟏 𝟏 𝟏 R1 x C2
  • 20. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics 𝟏 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 X 𝟑 𝟎 𝟎 𝟎 𝟒 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x C2 = 𝟑 𝟏𝟐 𝟏𝟐 𝟑 𝟏𝟔 𝟏𝟔 𝟒 𝟒 𝟏 𝟏 𝟏 𝟏 R1 x C2 • Example: A Square object with the coordinate points D (1, 4), C (4, 4), B (4, 1), A (1,1). • Apply the scaling factor 3 on the X-axis and 4 on the Y- axis. • Find out the new coordinates of the square?
  • 21. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics - Enlargement 𝟏 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 X 𝟑 𝟎 𝟎 𝟎 𝟒 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x C2 = 𝟑 𝟏𝟐 𝟏𝟐 𝟑 𝟏𝟔 𝟏𝟔 𝟒 𝟒 𝟏 𝟏 𝟏 𝟏 R1 x C2
  • 22. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics compression 𝟏 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 X 𝟏 𝟎 𝟎 𝟎 𝟎. 𝟐𝟓 𝟎 𝟎 𝟎 𝟏 4 x 3 3 x C2 = 𝟏 𝟒 𝟒 𝟏 𝟏 𝟏 𝟎. 𝟐𝟓 𝟎. 𝟐𝟓 𝟏 𝟏 𝟏 𝟏 R1 x C2 • Example: A Square object with the coordinate points D (1, 4), C (4, 4), B (4, 1), A (1,1). • Apply the scaling factor 1 on the X-axis and 0.25 on the Y- axis. • Find out the new coordinates of the square?
  • 23. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics - Compression 𝟏 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 X 𝟏 𝟎 𝟎 𝟎 𝟎. 𝟐𝟓 𝟎 𝟎 𝟎 𝟏 4 x 3 3 x C2 = 𝟏 𝟒 𝟒 𝟏 𝟏 𝟏 𝟎. 𝟐𝟓 𝟎. 𝟐𝟓 𝟏 𝟏 𝟏 𝟏 R1 x C2
  • 24. Two Dimensional 2D Transformations 2D Scaling Rules in Computer Graphics T= identity matrix: a=e=i=1, b=c=d==f=g=h=0 Results for all x’ = x, y’ = y. Scaling Rules by parameters a and e : b=c=d==f=g=h=0 => x' = a.x, y' = e.y; This is scaling by a in x, d in y. • If, a = e > 1, we have enlargement (scale up) & uniform scaling. • If, a ≠ e > 1, we have enlargement (scale up) & non-uniform scaling. • If, 0 < a = e < 1, we have compression (scale down) & uniform scaling. • If, 0 < a ≠ e < 1, we have compression (scale down) & non-uniform scaling. Uniform Scaling by parameter i: a = e = 1 and b=c=d==f=g=h=0 • If, i > 1, we have compression (scale down) & uniform scaling. • If, i < 1, we have enlargement (scale up) & uniform scaling. • If, i = 1, we have [ T ] as Unit Matrix hence results for all x’ = x, y’ = y. [ T ] = 𝒂 𝒅 𝒈 𝒃 𝒆 𝒉 𝒄 𝒇 𝒊
  • 25. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics compression 𝟏 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 X 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟐 4 x 3 3 x 3 = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 𝟐 𝟐 𝟐 𝟐 4 x 3 • Example: A Square object with the coordinate points D (1, 4), C (4, 4), B (4, 1), A (1,1). Apply the scaling factor 2 on both axis. Find out the new coordinates of the square? Some Observations and Imaginations are,
  • 26. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics compression • Here Original object Matrix [ P ] is in One Homogeneous Co-ordinate Plane (z=1) plane. • And The Resultant object Matrix [ R ] which is of same size, lies in another Homogeneous Co-ordinate Plane (z=2) plane. • It is needed to bring Resultant object of [ R ] in the same plane of [ P ] i.e. z = 1 • Divide each row of [ R ] by third column element [ R ] = 𝟎. 𝟓 𝟐 𝟐 𝟎. 𝟓 𝟐 𝟐 𝟎. 𝟓 𝟎. 𝟓 𝟏 𝟏 𝟏 𝟏 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 𝟐 𝟐 𝟐 𝟐 [ R ] =
  • 27. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics compression [ R ] = 𝟎. 𝟓 𝟐 𝟐 𝟎. 𝟓 𝟐 𝟐 𝟎. 𝟓 𝟎. 𝟓 𝟏 𝟏 𝟏 𝟏
  • 28. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics compression 𝟏 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 X 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎. 𝟓 4 x 3 3 x 3 = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 𝟎. 𝟓 𝟎. 𝟓 𝟎. 𝟓 𝟎. 𝟓 4 x 3 • Example: A Square object with the coordinate points D (1, 4), C (4, 4), B (4, 1), A (1,1). Apply the scaling factor 0.5 on both axis. Find out the new coordinates of the square? Some Observations and Imaginations are,
  • 29. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics compression • Here Original object Matrix [ P ] is in One Homogeneous Co-ordinate Plane (z=1) plane. • And The Resultant object Matrix [ R ] which is of same size, lies in another Homogeneous Co-ordinate Plane (z=0.5) plane. • It is needed to bring Resultant object of [ R ] in the same plane of [ P ] i.e. z = 1 • Divide each row of [ R ] by third column element [ R ] = 𝟐 𝟖 𝟖 𝟐 𝟖 𝟖 𝟐 𝟐 𝟏 𝟏 𝟏 𝟏 [ R ] = 𝟏 𝟒 𝟒 𝟏 𝟒 𝟒 𝟏 𝟏 𝟎. 𝟓 𝟎. 𝟓 𝟎. 𝟓 𝟎. 𝟓
  • 30. Two Dimensional 2D Transformations 2D Scaling in Computer Graphics compression [ R ] = 𝟐 𝟖 𝟖 𝟐 𝟖 𝟖 𝟐 𝟐 𝟏 𝟏 𝟏 𝟏
  • 31. Two Dimensional 2D Transformations 2D Reflection in Computer Graphics • It is a transformation which produces a mirror image of an object. • The mirror image can be either about x-axis or y-axis. • The object is rotated by180°. • Types of Reflection: a) Reflection about the x-axis (𝒓𝒙 = 1, 𝒓𝒚 = -1) b) Reflection about the y-axis (𝒓𝒙 = -1, 𝒓𝒚 = 1) c) Reflection about an axis perpendicular to xy plane and passing through the origin. (𝒓𝒙 = -1, 𝒓𝒚 = -1) d) Reflection about line y=x • Here 𝒓𝒚 , 𝒓𝒙 can be either -1 for reflection. • The Reflection Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X 𝒓𝒙 𝟎 𝟎 𝟎 𝒓𝒚 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x 3 = 𝒓𝒙. 𝒙𝟏 𝒓𝒙. 𝒙𝟐 𝒓𝒙. 𝒙𝟑 𝒓𝒚. 𝒚𝟏 𝒓𝒚. 𝒚𝟐 𝒓𝒚. 𝒚𝟑 𝟏 𝟏 𝟏 R1 x 3
  • 32. Two Dimensional 2D Transformations 2D Reflection in Computer Graphics • 1. Reflection about x-axis: The object can be reflected about x-axis with the help of the following matrix • In this transformation value of x will remain same whereas the value of y will become negative. • The Reflection Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X 𝟏 𝟎 𝟎 𝟎 −𝟏 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x 3 = 𝒙𝟏 𝒙𝟐 𝒙𝟑 −𝒚𝟏 −𝒚𝟐 −𝒚𝟑 𝟏 𝟏 𝟏 R1 x C2 [ T ] = • Following figures shows the reflection of the object axis. • The object will lie another side of the x-axis
  • 33. Two Dimensional 2D Transformations 2D Reflection in Computer Graphics • 2. Reflection about y-axis: The object can be reflected about y-axis with the help of following transformation matrix • In this transformation value of y will remain same whereas the value of x will become negative. • The Reflection Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X −𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x 3 = −𝒙𝟏 −𝒙𝟐 −𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 𝟏 𝟏 𝟏 R1 x C2 • The following figure shows the reflection about the y-axis [ T ] =
  • 34. Two Dimensional 2D Transformations 2D Reflection in Computer Graphics • 3. Reflection about an axis perpendicular to xy plane and passing through origin: • In this value of x and y both will be reversed. This is also called as half revolution about the origin. • The Reflection Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X −𝟏 𝟎 𝟎 𝟎 −𝟏 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x 3 = −𝒙𝟏 −𝒙𝟐 −𝒙𝟑 −𝒚𝟏 −𝒚𝟐 −𝒚𝟑 𝟏 𝟏 𝟏 R1 x C2 • The following figure shows the reflection about an axis perpendicular to xy plane [ T ] =
  • 35. Two Dimensional 2D Transformations 2D Reflection in Computer Graphics • 3. Reflection about an axis perpendicular to xy plane and passing through origin: • In this value of x and y both will be reversed. This is also called as half revolution about the origin. • The Reflection Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X −𝟏 𝟎 𝟎 𝟎 −𝟏 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x 3 = −𝒙𝟏 −𝒙𝟐 −𝒙𝟑 −𝒚𝟏 −𝒚𝟐 −𝒚𝟑 𝟏 𝟏 𝟏 R1 x C2 • The following figure shows the reflection about an axis perpendicular to xy plane [ T ] =
  • 36. Two Dimensional 2D Transformations 2D Reflection in Computer Graphics • 4. Reflection about line y=x: The object may be reflected about line y = x with the help of following transformation matrix • In this value of x and y both will be exchanged. This is also called as reflection about y=x line. • The Reflection Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X 𝟎 𝟏 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎 𝟏 = 𝒚𝟏 𝒚𝟐 𝒚𝟑 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝟏 𝟏 𝟏 R1 x C2 • The following figure shows the reflection about an x=y line [ T ] =
  • 37. Two Dimensional 2D Transformations 2D Reflection in Computer Graphics Problem-01: Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the reflection on the X axis and obtain the new coordinates of the object. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝟑 𝟔 𝟓 𝟒 𝟒 𝟔 X 𝟏 𝟎 𝟎 𝟎 −𝟏 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x 3 = 𝟑 𝟔 𝟓 −𝟒 −𝟒 −𝟔 𝟏 𝟏 𝟏 R1 x C2 Problem-02: Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the reflection on the X=Y Line to obtain the new coordinates of the object. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝟑 𝟔 𝟓 𝟒 𝟒 𝟔 X 𝟎 𝟏 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎 𝟏 R1 x 3 3 x 3 = 𝟒 𝟒 𝟔 𝟑 𝟔 𝟓 𝟏 𝟏 𝟏 R1 x C2 Problem-03: Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the reflection on the Y axis to obtain the new coordinates of the object.
  • 38. Two Dimensional 2D Transformations 2D Translation in Computer Graphics • We can move any object from one to another place without changing the shape of the object. • Translation of a Point: If we want to translate a point from P (x0, y0) to Q (x1, y1), then we have to add Translation coordinates (Tx, Ty) with original coordinates. • The Translation Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2. 𝟏 𝟏 𝟏 [ R ] = [ P ] . [ T ] = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒚𝟏 𝒚𝟐 𝒚𝟑 X 𝟏 𝟎 𝑻𝒙 𝟎 𝟏 𝑻𝒚 𝟎 𝟎 𝟏 = 𝒙𝟏 + 𝑻𝒙 𝒙𝟐 + 𝑻𝒙 𝒙𝟑 + 𝑻𝒙 𝒚𝟏 + 𝑻𝒚 𝒚𝟐 + 𝑻𝒚 𝒚𝟑 + 𝑻𝒚 R1 x C2 • The following figure shows the translation from P to Q Pixel. 𝟏 𝟏 𝟏
  • 39. Two Dimensional 2D Transformations 2D Rotation in Computer Graphics • In rotation, we rotate the object at particular angle θ theta from its origin. • From the following figure, we can see that the point P(X,Y) is located at angle φ from the horizontal X coordinate with distance r from the origin. • Let us suppose you want to rotate it at the angle θ. • The Rotation Transformation is obtained with multiplication of [ P ] and [ T ] matrices. i.e. [ P ] x [ T ] = [ R ]. • The Size of Resultant Matrix [ R ] is R1 x C2. • After rotating it to a new location, you will get a new point P’ (X′,Y′).
  • 40. Two Dimensional 2D Transformations 2D Anticlockwise Rotation in Computer Graphics • Using standard trigonometric the original coordinate of point P(X,Y) can be represented as − • X=rcosϕ......(1) • Y=rsinϕ......(2) • Same way we can represent the point P’ X′,Y′ as − • x′=rcos(ϕ+θ)=r cosϕcosθ−r sinϕsinθ.......(3) • y′=rsin(ϕ+θ)=r cosϕsinθ+r sinϕcosθ.......(4) • Substituting equation 1 & 2 in 3 & 4 respectively, we will get • x′ = xcosθ − ysinθ • y′ = xsinθ + ycosθ • Representing the above equation in matrix [ R ] =[ X Y ] x cos(θ) sin(θ) −sin(θ) cos(θ) 0 0 1 𝒄𝒐𝒔(θ) 𝒔𝒊𝒏(θ) −𝒔𝒊𝒏(θ) 𝟎 𝒄𝒐𝒔(θ) 𝟎 For Anti-clockwise Rotation [ T ]=
  • 41. Two Dimensional 2D Transformations 2D Clockwise Rotation in Computer Graphics For clockwise Rotation • Consider Previous equations, • x′ = xcosθ − ysinθ .......(5) • y′ = xsinθ + ycosθ .......(6) • Substituting equation -θ in 5 & 6, we will get • x′ = xcos(-θ) − y sin(-θ) .......(5) • y′ = xsin(-θ) + ycos(-θ) .......(6) • Becomes, • x′ = xcosθ − ( - ysinθ) • y′ = -xsinθ + ycosθ • Results • x′ = xcosθ + ysinθ .......(7) • y′ = -xsinθ + ycosθ .......(8) • Representing the above equation in matrix form, [ R ] =[ X Y ] x cos(θ) −sin(θ) sin(θ) cos(θ) 0 0 1 𝒄𝒐𝒔(θ) −𝒔𝒊𝒏(θ) 𝒔𝒊𝒏(θ) 𝟎 𝒄𝒐𝒔(θ) 𝟎 For clockwise Rotation [ T ]=
  • 42. Two Dimensional 2D Transformations 2D Shearing in Computer Graphics • A transformation that slants the shape of an object is called the shear transformation. • There are two shear transformations • X-Shear • Y-Shear. • X-Y Shear. • One shifts X coordinates values and other shifts Y coordinate values. • However in both the cases only one coordinate changes its coordinates and other preserves its values. • Shearing is also termed as Skewing.
  • 43. Two Dimensional 2D Transformations 2D Shearing in Computer Graphics X-Shear: • The X-Shear preserves the Y coordinate and changes are made to X coordinates, which causes the vertical lines to tilt right or left as shown in below figure. The transformation matrix for X-Shear can be represented as − 𝟏 𝟏 𝟏 𝟏 𝑺𝒉𝒙 𝟎 𝟎 𝟏 𝟎 For X-Shear [ T ]=
  • 44. Two Dimensional 2D Transformations 2D Shearing in Computer Graphics Y-Shear: • The Y-Shear preserves the X coordinates and changes the Y coordinates which causes the horizontal lines to transform into lines which slopes up or down as shown in the following figure. The transformation matrix for Y-Shear can be represented as − 𝟏 𝟏 𝟏 𝟏 𝟎 𝑺𝒉𝒚 𝟎 𝟏 𝟎 For Y-Shear [ T ]=
  • 45. Two Dimensional 2D Transformations 2D Shearing in Computer Graphics X-Y-Shear: • The XY-Shear changes the X and Y coordinates which causes the horizontal and vertical lines to transform into lines which slopes up and down as shown in the following figure. The transformation matrix for Y-Shear can be represented as − 𝟏 𝟏 𝟏 𝟏 𝑺𝒉𝒙 𝑺𝒉𝒚 𝟎 𝟏 𝟎 For Y-Shear [ T ]=
  • 46. Two Dimensional 2D Transformations Composite / Concatenation / Combined Transformation • If a transformation of the plane T1 is followed by a second plane transformation T2, then the result itself may be represented by a single transformation T which is the composition of T1 and T2 taken in that order. • This is written as T = [ T1 ] ∙ [ T2 ]. • Composite transformation can be achieved by concatenation of transformation matrices to obtain a combined transformation matrix. • A combined matrix − [ T ] = [ T1 ] [ T2 ] [ T3 ] [ T4 ] …. [ Tn ] • Where [Ti] is any combination of- Translation, Scaling, Shearing, Rotation, Reflection • The change in the order of transformation would lead to different results, as in general matrix multiplication is not cumulative, that is [A] . [B] ≠ [B] . [A] and the order of multiplication. • The basic purpose of composing transformations is to gain efficiency by applying a single composed transformation to a point, rather than applying a series of transformation, one after another.