0% found this document useful (0 votes)
68 views16 pages

2D Transformations in Computer Graphics

Uploaded by

ishvandana19
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)
68 views16 pages

2D Transformations in Computer Graphics

Uploaded by

ishvandana19
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

Computer Graphics

2D Transformation
Mrs. G. Pauline Pershyl
Lecturer
BCA Department
The American College
Transformation
 Transformation means changing some graphics
into something else by applying rules. We can have
various types of transformations such as
translation, scaling up or down, rotation, shearing,
etc. When a transformation takes place on a 2D
plane, it is called 2D transformation.
 Transformations play an important role in
computer graphics to reposition the graphics on the
screen and change their size or orientation.
2D Transformation in Computer Graphics
 2D Transformations take place in a two dimensional plane.
 Transformations are helpful in changing the position, size,
orientation, shape etc of the object
Transformation Techniques-
 In computer graphics, various transformation techniques are-
2D Translation in Computer Graphics
 In Computer graphics,2D Translation is a process of moving an
object from one position to another in a two dimensional plane.
Consider a point object O has to be moved from one position to
another in a 2D plane.
Let-
 Initial coordinates of the object O = (Xold, Yold)
 New coordinates of the object O after translation = (Xnew, Ynew)
 Translation vector or Shift vector = (Tx, Ty)
 Given a Translation vector (Tx, Ty)-
 Tx defines the distance the Xold coordinate has to be moved.
 Ty defines the distance the Yold coordinate has to be moved.
 This translation is achieved by adding the translation
coordinates to the old coordinates of the object as-
 Xnew = Xold + Tx (This denotes translation towards X axis)
 Ynew = Yold + Ty (This denotes translation towards Y axis)
 In Matrix form, the above translation equations may be
represented as-
2D Rotation in Computer Graphics
 In Computer graphics, 2D Rotation is a process of
rotating an object with respect to an angle in a two
dimensional plane.
 Consider a point object O has to be rotated from one
angle to another in a 2D plane.
Let-
 Initial coordinates of the object O = (Xold, Yold)
 Initial angle of the object O with respect to origin = Φ
 Rotation angle = θ
 New coordinates of the object O after rotation = (Xnew,
Ynew)
This rotation is achieved by using the following rotation equations-
•Xnew = Xold x cosθ – Yold x sinθ
•Ynew = Xold x sinθ + Yold x cosθ

In Matrix form, the above rotation equations may be represented as-


2D Scaling in Computer Graphics
 Scaling may be used to increase or reduce the size of object.
 Scaling subjects the coordinate points of the original object
to change.
 Scaling factor determines whether the object size is to be
increased or reduced.
 If scaling factor > 1, then the object size is increased.
 If scaling factor < 1, then the object size is reduced.
 Consider a point object O has to be scaled in a 2D plane
Let-
Initial coordinates of the object O = (Xold, Yold)
Scaling factor for X-axis = Sx
Scaling factor for Y-axis = Sy
New coordinates of the object O after scaling = (Xnew, Ynew)

This scaling is achieved by using the following scaling equations-


Xnew = Xold x Sx
Ynew = Yold x Sy

In Matrix form, the above scaling equations may be represented


as-
2D Reflection in Computer Graphics

 Reflection is a kind of rotation where the angle of rotation is


180 degree.
 The reflected object is always formed on the other side of
mirror.
 The size of reflected object is same as the size of original
object
Consider a point object O has to be reflected in a 2D plane.

Let-
Initial coordinates of the object O = (Xold, Yold)
New coordinates of the reflected object O after reflection = (Xnew, Ynew)

Reflection On X-Axis:

This reflection is achieved by using the following reflection equations-


Xnew = Xold
Ynew = -Yold

In Matrix form, the above reflection equations may be represented as-


Reflection On Y-Axis:

This reflection is achieved by using the following reflection


equations-
Xnew = -Xold
Ynew = Yold

In Matrix form, the above reflection equations may be


represented as-
2D Shearing in Computer Graphics

 In Computer graphics, 2D Shearing is an ideal technique to


change the shape of an existing object in a two dimensional
plane
 In a two dimensional plane, the object size can be changed
along X direction as well as Y direction.
 So, there are two versions of shearing-
Consider a point object O has to be sheared in a 2D plane.
Let-
Initial coordinates of the object O = (Xold, Yold)
Shearing parameter towards X direction = Shx
Shearing parameter towards Y direction = Shy
New coordinates of the object O after shearing = (Xnew, Ynew)

Shearing in X Axis-
Shearing in X axis is achieved by using the following shearing equations-
Xnew = Xold + Shx x Yold
Ynew = Yold

In Matrix form, the above shearing equations may be represented as-


Shearing in Y Axis-

Shearing in Y axis is achieved by using the following


shearing equations-
Xnew = Xold
Ynew = Yold + Shy x Xold

In Matrix form, the above shearing equations may be


represented as-
Thank you

You might also like