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

Computer Graphics III

This document discusses two-dimensional transformations in computer graphics, including translation, rotation, scaling, reflection, shear, and homogeneous coordinates. It provides the mathematical definitions and equations for each transformation. Transformations are used to reposition and modify graphics on the screen. Translation moves an object by adding offsets, rotation rotates an object by an angle, and scaling enlarges or shrinks dimensions by multiplying coordinates. Reflection produces a mirror image, and shear slants the shape. Homogeneous coordinates allow representing transformations with matrix multiplications.

Uploaded by

Akhil Sudheer
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)
34 views

Computer Graphics III

This document discusses two-dimensional transformations in computer graphics, including translation, rotation, scaling, reflection, shear, and homogeneous coordinates. It provides the mathematical definitions and equations for each transformation. Transformations are used to reposition and modify graphics on the screen. Translation moves an object by adding offsets, rotation rotates an object by an angle, and scaling enlarges or shrinks dimensions by multiplying coordinates. Reflection produces a mirror image, and shear slants the shape. Homogeneous coordinates allow representing transformations with matrix multiplications.

Uploaded by

Akhil Sudheer
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/ 24

Computer Graphics

Unit III
Two-Dimensional Transformation,
Translation,
Rotation,
Scaling,
Reflection,
Shear,
Homogeneous Coordinates
• Graphics: Visual images or a designs on some
surface, such as a wall, canvas, screen, paper, or
stone to inform, illustrate, or entertain.

• 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.
Two-Dimensional Transformation

• 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.
Translation

• A translation moves an object to a different position


on the screen. You can translate a point in 2D by
adding translation coordinate (tx, ty) to the original
coordinate X,Y to get the new coordinate X’ , Y’
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
Rotation

• 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.
Rotation
• 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’ (X′,Y′).

• Using standard trigonometric the original


coordinate of point P(X,Y) can be represented as −
Rotation
• Same way we can represent coordinate of the
point P’ (X′,Y′)′ as −

• Representing the above equation in matrix form,

OR

P’ = P . R // Where R is the rotation matrix


Rotation
• The rotation angle can be positive and negative.
- For positive angle rotation,

- For negative angle rotation


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.
Scaling
Before Scaling After Scaling
Scaling
• Let us assume that the original coordinates are X, Y
the scaling factors are (SX, SY), and the produced
coordinates are 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 −

OR
P’ = P . S // Where S is the scaling matrix
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.


Reflection
The following figures show reflections with respect to X
and Y axes, and about the origin respectively.
Reflection
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.
Shear
• 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.
Shear
• X-Shear :

• The transformation matrix for X-Shear can be


represented as −
Shear
• 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.
Shear
• Y-Shear :

• The Y-Shear can be represented in matrix from as −


Homogeneous Coordinates :
• To combine any three transformations into a
single transformation, homogeneous
coordinates are used. we can represent the
point by 3 numbers instead of 2 numbers, which
is called Homogenous Coordinate system.
Homogeneous Coordinates :
• In this system, we can represent all the
transformation equations in matrix
multiplication. Here two-dimensional
coordinate positions (x, y) are represented by
triple-coordinates.
• Example : Each two-dimensional coordinates
(x,y) is represented with homogeneous
coordinates
(x, y, 1).
• Following are matrix for two-dimensional
transformation in homogeneous coordinate:
• Following are matrix for two-dimensional
transformation in homogeneous coordinate:

You might also like