0% found this document useful (0 votes)
222 views11 pages

2D Transformation PDF

This document discusses 2D transformations in computer graphics. It describes several types of 2D transformations including translation, rotation, scaling, reflection, shearing, and dilation. It provides the mathematical formulas to perform each transformation and explains how they can be represented using matrix multiplication. Multiple transformations can be combined through matrix multiplication to achieve complex, composite transformations.

Uploaded by

bassam lateef
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)
222 views11 pages

2D Transformation PDF

This document discusses 2D transformations in computer graphics. It describes several types of 2D transformations including translation, rotation, scaling, reflection, shearing, and dilation. It provides the mathematical formulas to perform each transformation and explains how they can be represented using matrix multiplication. Multiple transformations can be combined through matrix multiplication to achieve complex, composite transformations.

Uploaded by

bassam lateef
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/ 11

‫جامعة واسط‬

‫كلية علوم الحاسوب وتكنولوجيا المعلومات‬


‫قسم الحاسوب‬
‫المرحلة الثانية‬
‫تقرير حول‬

‫‪2D Transformation‬‬
‫مقدم لألستاذ‬
‫مهند هالل‬
‫اعداد الطالب‬
‫ماهر عصام علي‬

‫‪2019-2020‬‬
‫الكورس االول‬
Introduction

In Computer graphics,
Transformation is a process of modifying and re-positioning the existing graphics.
• 2D Transformations take place in a two dimensional plane.
• Transformations are helpful in changing the position, size, orientation, shape etc
of the object.

One of the most common and important tasks in computer graphics is to transform
the coordinates ( position, orientation, and size ) of either objects within the graphical
scene or the camera that is viewing the scene. It is also frequently necessary to
transform coordinates from one coordinate system to another, ( e.g. world
coordinates to viewpoint coordinates to screen coordinates. ) All of these
transformations can be efficiently and succintly handled using some simple matrix
representations, which we will see can be particularly useful for combining multiple
transformations into a single composite transform matrix.

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.

Transformation Techniques
In computer graphics, various transformation techniques are-
Rotation in 2D
point (X,Y) is to be rotated about the origin by angle theta to location (X',Y')

X' = X * cos(theta) - Y * sin(theta)


Y' = X * sin(theta) + Y *cos(theta)

note that this does involve sin and cos which are much more costly than addition or
multiplication

or P' = R * P where

_ _
P' = | X' |
| Y' |
- -
_ _
R = | cos(theta) -sin(theta) |
| sin(theta) cos(theta) |
- -
we will discuss about 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 = (T x, 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-

• The homogeneous coordinates representation of (X, Y) is (X, Y, 1).


• Through this representation, all the transformations can be performed using matrix
/ vector multiplications.

The above translation matrix may be represented as a 3 x 3 matrix as-


Types of Transformations
Within the rigid and non-rigid categories, there are four main types of
transformations that we'll learn today. Three of them fall in the rigid transformation
category, and one is a non-rigid transformation.

1. Rotation: rotating an object about a fixed point without changing its size
or shape

2. Translation: moving an object in space without changing its size, shape


or orientation

3. Dilation: expanding or contracting an object without changing its shape


or orientation
4. Reflection: flipping an object across a line without changing its size or
shape

Scaling
To change the size of an object, scaling transformation is used. In the scaling
process, you either expand or compress the dimensions of the object. Scaling can
be achieved by multiplying the original coordinates of the object with the scaling
factor to get the desired result.
Let us assume that the original coordinates are X,YX,Y, the scaling factors are (SX,
SY), and the produced coordinates are X′,Y′X′,Y′. This can be mathematically
represented as shown below −
X' = X . SX and Y' = Y . SY
The scaling factor SX, SY scales the object in X and Y direction respectively. The
above equations can also be represented in matrix form as below −
(X′Y′)=(XY)[Sx00Sy](X′Y′)=(XY)[Sx00Sy]
OR
P’ = P . S
Where S is the scaling matrix. The scaling process is shown in the following figure.
Composition of 2D Transformations
There are many situations in which the final transformation of a point is a
combination of several ( often many ) individual transformations. For example, the
position of the finger of a robot might be a function of the rotation of the robots hand,
arm, and torso, as well as the position of the robot on the railroad train and the
position of the train in the world, and the rotation of the planet around the sun, and .
If we provide values less than 1 to the scaling factor S, then we can reduce the size
of the object. If we provide values greater than 1, then we can increase the size of
the object.

Reflection
Reflection is the mirror image of original object. In other words, we can say
that it is a rotation operation with 180°. In reflection transformation, the size of the
object does not change.
The following figures show reflections with respect to X and Y axes, and about the
origin respectively.
Shear
A transformation that slants the shape of an object is called the shear
transformation. There are two shear transformations X-Shear and 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.
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.

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

➢ Andy Johnson's CS 488 Course Notes, Lecture 5


➢ Foley, Van Dam, Feiner, and Hughes, "Computer Graphics - Principles and
Practice", Chapter 5
➢ https://www.gatevidyalay.com/2d-transformation-in-computer-graphics-
translation-examples/
➢ https://www.tutorialspoint.com/computer_graphics/2d_transformation.htm
➢ https://study.com/academy/lesson/transformations-in-math-definition-
graph-quiz.html

You might also like