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

2d Transformation

Detail about 2d transformation

Uploaded by

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

2d Transformation

Detail about 2d transformation

Uploaded by

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

2-D 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,
reflection, shearing, etc.
 When a transformation takes place on a 2D plane, it is called 2D
transformation.
 Transformation of image can be used directly by using many
applications programs and graphics subroutines.
 Transformations play an important role in computer graphics to
reposition the graphics on the screen and change their size or
orientation.
2-D Translation

A translation moves an object to a different position on the screen.


You can translate a point in 2D by adding translation coordinate (t x,
ty) to the original coordinate X, Y to get the new coordinate X I YI ,
2-D Translation

From the above figure, you can write that −


X’ = X + tx
Y’ = Y + ty
The pair (tx, ty) is called the translation vector or shift vector. The
above equations can also be represented using the column vectors.

We can write it as −
P’ = P + T
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.
Rotation
In rotation, we rotate the object at particular angle θ 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 θ. After rotating it
to a new location, you will get a new point P’
Rotation
Using standard trigonometric the original coordinate of point P(X,Y)
can be represented as

Y……………(ii)
Same way we can represent the point P’ (X’ Y’ )
=r.
=r.cos.
Substituting the value from equation (i) and (ii) we get,
…………………(iii)
Rotation
And
=r
=rcos

By representing above equations in matrix, we get

OR,
P’=
Where R is rotation matrix
Rotation
For AntiClockwise(+ve) rotation , the rotation matrix

For Clockwise rotation(-ve) , the rotation matrix


=
Scaling
 To change 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.
 For X and Y coordinate, scaling factors (Sx, Sy),
The produced Coordinates X’ and Y’ are,
X’= X.Sx and Y’= Y.Sy
 In matrix form,
Shearing
 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. For X and Y
coordinate, scaling factors (Sx, Sy),
Shearing
 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.
Shearing
 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.

You might also like