What is Transformation in Computer Graphics?

By Priyanshu Vaish|Updated : May 11th, 2022

In this article, we will learn about the transformation 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. There are three basic rigid transformations: reflections, rotations, and translations. There is a fourth common transformation called dilation.

Table of Content

What is Transformation?

Transformation means a change in the orientation, size, and shape of the object. They are used to position the object, change the object's shape, and even change how something is viewed. Transformation plays a major role in computer graphics, repositioning the graphics on the screen and changing their size or orientation. There is basic geometrical transformation such as:

  • Translation
  • Scaling
  • Rotation

The derived geometrical transformation is:

  • Reflection
  • Shearing

2D Translation in Computer Graphics

The translation is repositioning an object along a straight-line path from one coordinate location to another coordinate location.

The translation is the rigid body transformation that saves an object without deformation. A translation moves to a different position on the screen.


From the above figure, we can write that:

X’ = X + tx

Y’ = Y + ty

The pair (tx, ty) is called the shift vector or translation vector. The above equations may be represented using the column vectors.

P=[X]/[Y]     p' = [X′]/[Y′]     T = [tx]/[ty]

We can also write it as:

P’ = P + T

2D Rotation in Computer Graphics

It is the transformation that is used to reposition one object along the circular path in the XY plane. We specify a rotation angle θ and the portion of the rotation point(pivot point) A and B about which the object is being rotated to generate a rotation.

Suppose you want to rotate it at the angle θ. After rotating it to the new location, you will get a new point P' A′, B′.

Using standard trigonometric, the original coordinate of points P A and B can be represented as −



Similarly we can represent point P’ A′,B′ as −

A′ = rcos(ϕ+θ) = rcosϕcosθ−rsinϕsinθ…(iii)

B′ = rsin(ϕ+θ) = rcosϕsinθ+rsinϕcosθ…(iv)

Substituting equations (i) & (ii) in equations (iii) & (iv), respectively, we will get

A′ = xcosθ−ysinθ

B′ = xsinθ+ycosθ

Representing the above equation in matrix form,

P′ = P . R

Where R is the rotation matrix

The rotation angle will be positive or negative. For the positive rotation angle, we may use the above rotation matrix. However, for negative angle rotation, the matrix will change as shown below:


2D Scaling in Computer Graphics

Scaling is the transformation that is used to change the object's size. The operation is carried out by multiplying the coordinate value(X, Y) with Sx and Sy scaling factors.

Scaling is performed about the origin as

if scale > 1 then enlarges the object and moves it away from the origin.

If scale  = 1, then leaves the object the same.

If scale < 1, then shrink/reduce the object and move it towards its origin.

Therefore the equation for scaling is given by:

X' = X . SX and Y' = Y . SY

The scaling factor SX and SY scale the object in the X and Y direction, respectively. The above equations may also be represented in matrix form as below:


P’ = P . S

The following figure shows the scaling process where S is the scaling matrix.

2D Reflection in Computer Graphics

Reflection is the mirror image of the original object. In other words, we will say that it is the rotation operation with 180°. In reflection transformation, the object's size does not change.

The following figures reflect the X and Y axes and the origin, respectively.

2D Shearing in Computer Graphics

Shearing is the transformation used to change the shape of an existing object in the 2D plane. The size of the object changes along the X direction as well as the Y direction. Shearing along the X-axis is as follows:

Suppose we want to shear the below image along the x-axis with the shearing parameter shx, which is:

The equation is as follows:

X'= X + Y.shx

Y' = X

The shearing matrix along the X-axis is as follows:

Shearing along the Y-axis is as follows:

Suppose we want to shear the below image along the Y-axis with the shearing parameter shy, which is:

The equation is as follows:

Y'= X.shy + Y

X' = X

The shearing matrix along the X-axis is as follows:



write a comment

FAQs on Transformation in Computer Graphics

  • Transformation is a process of modifying and repositioning the existing graphics. 2D Transformations take place in a two-dimensional plane. Transformations help change the object's position, size, orientation, shape, etc.

  • The types of 2D transformations in computer graphics are provided below.

    • Translation: The translation transformation shifts a node from one place to another along with one of the axes relative to its initial position.
    • Rotation: The rotation transformation moves the node around a specified pivot point of the scene.
    • Scaling
    • Shearing
    • Multiple Transformations.
  • The process for translation in 3D is similar to 2D translation. A translation moves the object into a different position on the screen. A transformation that slants the object's shape is called the shear transformation. Like in 2D shear, we can shear an object along the X-axis, Y-axis, or Z-axis in 3D.

  • There are two different categories of the transformations:

    1. The rigid transformation does not change the shape or size of the preimage.
    2. The non-rigid transformation will change the size but not the shape of the preimage.
  • In 2D, the origin of a body moves by translation t in its original reference frame and rotates by angle R=R(θ). The transformation that converts positional coordinates from the new coordinate frame to the original coordinate frame is given by


Follow us for latest updates