0% found this document useful (0 votes)
52 views8 pages

2D Transformations in Computer Graphics

Uploaded by

Akash Kr
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)
52 views8 pages

2D Transformations in Computer Graphics

Uploaded by

Akash Kr
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

2D TRANSFORMATION & VIEWING:

2D 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.

What is 2d Transformation in Computer Graphics?


2d Transformation in Computer Graphics is utilized to modify the position, orientation, or
size of objects within a two-dimensional space. These transformations involve applying
mathematical operations to the coordinates of points or vertices in order to achieve the desired
changes.

These transformations can be applied in a sequence to achieve more complex effects. For
example, a combination of translation, rotation, and scaling operations can be used to animate an
object’s movement, rotation, and resizing in a 2D animation.

The various 2d Transformation in Computer Graphics examples include object manipulation,


computer-aided design (CAD), image processing, and graphical user interfaces (GUIs). By
manipulating the position, orientation, and size of objects within a 2D space, these
transformations enable a wide range of visual effects and graphical applications.

The fundamental geometrical 2d Transformation in Computer Graphics include:

 Rotation
 Translation
 Scaling

The derived geometrical 2d Transformation in Computer Graphics are:

 Reflection
 Shearing
Homogenous Coordinates:
To perform a sequence of transformation such as translation followed by rotation and scaling, we
need to follow a sequential process −
• Translate the coordinates,
• Rotate the translated coordinates, and then
• Scale the rotated coordinates to complete the composite transformation.

To shorten this process, we have to use 3×3 transformation matrix instead of 2×2 transformation
matrix. To convert a 2×2 matrix to 3×3 matrix, we have to add an extra dummy coordinate W.

In this way, we can represent the point by 3 numbers instead of 2 numbers, which is called
Homogenous Coordinate system. In this system, we can represent all the transformation
equations in matrix multiplication. Any Cartesian point P(X, Y) can be converted to homogenous
coordinates by P’ (Xh, Yh, h).

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’).

From the above figure, you can write that −

X’ = X + tx
Y’ = Y + ty
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.
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 –
Where R is the rotation matrix
Scaling:
2D Scaling in Computer Graphics involves resizing objects or coordinate systems in a 2D plane.
It allows us to change the size of each point in the object or coordinate system by applying
scaling factors in the x and y directions.

To perform 2D scaling, we utilize scaling factors: sx for the x-axis and sy for the y-axis. These
factors determine how much each coordinate should be scaled along its respective axis.

If the scaling factor (SX and SY) is greater than 1, the object is enlarged and moves away from
the origin. A scaling factor of 1 leaves the object unchanged, while a scaling factor less than 1
shrinks the object and moves it closer to the origin.

The equations for scaling are X’ = X * SX and Y’ = Y * SY, where X and Y are the original
coordinates of a point, and X’ and Y’ are the scaled coordinates after the transformation.

These equations can also be represented in matrix form as:

OR

P’ = P . S

The scaling process is depicted using the scaling matrix S in the given figure:

The scaling process is depicted using the scaling matrix S in the given figure:
2D Reflection in Computer Graphics
2D reflection is a transformation technique that involves flipping or mirroring an object or
coordinate system across a specific axis in a 2D plane. It allows us to change the orientation of
each point in the object or coordinate system in relation to the reflection axis.

The figures depict the X and Y axes and the origin:


2D Shearing in Computer Graphics
2D Shearing transformation slants or distorts an object or coordinate system along either the x-
axis or y-axis in a 2D plane. It involves shifting the position of points in a specific direction based
on their original coordinates.

To shear the given image along the x-axis, we use the shearing parameter sh x.
The shearing matrix along with the y-axis is:

To shear the provided image along the Y-axis, we utilize the shearing parameter shy.

The equation is now:

Y’= [Link] + Y

X’ = X

The shearing matrix along with the x-axis is:

Common questions

Powered by AI

The rotation matrix in 2D graphics transformations facilitates rotating an object's coordinates around the origin by a specified angle θ. Mathematically, it is employed as a transformation matrix applied to the original coordinates (X, Y), resulting in new coordinates (X', Y') that describe the object's new position after rotation. The matrix encompasses trigonometric functions to calculate these changes based on θ .

Rotation in 2D graphics involves rotating an object around a specific point (usually the origin) by a certain angle θ, altering the angular orientation relative to the axes. Translation, however, shifts an object's position by adding translation coordinates to its original coordinates, moving it to a different location without changing its orientation .

Scaling factors in 2D graphics affect the size and position of an object differently. If the scaling factors SX and SY are greater than 1, the object enlarges and moves away from the origin. If they are equal to 1, the object's size remains unchanged, and if less than 1, the object shrinks and moves closer to the origin .

2D transformations in GUIs enhance user experience by allowing components to be interactively manipulated, ensuring dynamic and responsive layouts. By employing transformations like translation and scaling, GUIs cater to various screen sizes and resolutions, while rotation and reflection are often used for visual effects, enhancing the aesthetic and functional appeal of interfaces .

Sequential transformations in applications like animation or CAD offer precise control over how objects are rendered or animated. This allows complex effects like rotating and scaling during motion. Such a series of transformations applied in sequence, and expressed through matrix multiplication, streamlines processing and ensures smooth transitions and modifications, creating visually dynamic and interactive elements .

Mathematical operations in 2D transformation aid in developing flexible graphical applications by providing precise control over how objects are manipulated in space. These operations facilitate scalable, translatable, and rotatable graphics, enhancing the capability of applications to dynamically respond to user input or system changes, crucial for UI flexibility and complex animations .

Shearing in 2D graphics vertically or horizontally shifts parts of an object's geometry. For shearing along the x-axis, a shearing parameter shx is applied, and the shearing matrix adjusts the x-coordinates according to their y-values. This slants the object horizontally. Similarly, shearing along the y-axis uses shy, adjusting the y-coordinates based on x-values. This alters an object's angles without changing areas or lengths of parallel lines, distorting its shape .

Reflection in 2D graphics flips an object over a specified axis (x or y), altering each point's position relative to that axis. Using a reflection matrix, the original coordinates are inverted across the axis, mirroring the object in a plane. This changes the object's orientation, effectively creating an image that is symmetrical over the reflection axis .

A combination of translation, rotation, and scaling is crucial for complex effects in 2D transformations as these operations address distinct aspects of an object's modification: position (translation), orientation (rotation), and size (scaling). When combined, they allow for comprehensive changes that animate or transform objects dynamically in applications such as simulations or interactive graphics .

Homogeneous coordinates simplify multiple transformations in 2D graphics by allowing translation, rotation, and scaling to be combined into a single matrix operation. This is achieved by converting a 2D transformation into a 3×3 matrix, where an extra dummy coordinate (W) is added. As a result, the sequence of transformations can be represented through matrix multiplication, hence eliminating the need to apply each separately. This makes the transformations more efficient to compute and manage .

You might also like