Computer Graphics Presentation
Computer Graphics Presentation
GRAPHICS
TWO DIMENSIONAL
TRANSFORMATION/
2D TRANSFORMATION
What is transformation?
There are various type of transformation in computer
graphics through which an image can be processed ,
edited ,& altered.
TRANSFORMATION
• Geometric Transformation : Object is • Co-ordinate transformation : In
changed or position is changed. coordinate transformation when
coordinates changes then only object
changes.
TYPES OF GEOMETRIC TRANSFORMATION
1. TRANSLATION:
2. ROTATION:
3. SCALING:
TRANSLATION
TRANSLATION
• It is the straight line movement of an object from one position to another is called Translation.
• Suppose, If point (X, Y) is to be translated by amount Tx and Ty to a new location (X’, Y’) then new coordinates
can be obtained by adding Tx to X and Ty to Y as:
• X’=X + Tx
• Y’=Y + Ty , where (x , y) are points before translation and (x ’, y’)are points after translation.
• Tx and Ty are also known as an translation vector.
Translation of new point
=+
Homogenous co-ordinates of translation
T=
TRANSLAT
ION OF
POINT
P(x , y)are points before translation
and P(x’, y’)are points after
translation.
Click icon to add picture
TRANSLATION OF OBJECT
It is achieved by shifting the object from one position to the other
position with a parameter tx in x direction and ty in y direction.
• Translate a polygon with co-ordinates A(3,4) B(6,8) C(7,5) by 3units in x-direction and 2units in y-
direction?
SOLUTION :
GIVEN : A(3,4) B(6,8) C(7,5) =3 =2
A’=A+T + =+= A’=(6,6)
B’=B+T+ B’=(9,10)
C’=C+T+=+= C’=(10,7)
Before translation
1 2 3 4 5 6 7 8
After translation
13
12
11
10
9
8
7
6
5
4
3
2
1
1 2 3 4 5 6 7 8 9 10 11 12 13
ROTATION
Rotation is a type of transformation that is which is used in computer graphics
and image processing. Rotation is a process of rotating an object considering an
angle in a two-dimensional plane.
It is a process of changing the angle of the object. Rotation can be clockwise or
anticlockwise . When we rotate an object every point is rotated with same angle.
Click icon to add picture
Let's now consider a point object
O which has to be rotated from
one angle to another.
Initial co-ordinates of the object O = (Xold, Yold)
Rotation angle = θ
SOLUTION:
COUNTER CLOCKWISE FORMULA:
=
(X , Y)=(5,4)
(X’ , Y’)=?
THEREFORE,
(X’ , Y’)=
(X’ , Y’)=
(X’ , Y’)=
(X’ , Y’)= (X’ , Y’)=
SCALING
What is scaling?
The process of changing size of an object is called scaling .We can scale an
object by scaling x and y co-ordinates of each vertex of an object.
x’=x*sx
y’=y*sy
Where sx is the scaling factor in x-direction and sy is the scaling factor in y-
direction.
=
=
Scale a polygon with co-ordinates A(1,2)
B(2,3) C(2,2) by 2 unit in x direction and 2 units in y direction?
Given:
A(1,2) B(2,3) C(2,2)
2 units in x-direction & 2units in y direction.
4 Before Scaling
1 2 3 4
After Scaling
=
=
=
A’=(2,3)
B’=(4,6)
C’=(4,4)
After scaling
1 2 3 4 5 6 7 8