Extensive Study of 2d Transformations in Computer Graphics

DOI : 10.17577/IJERTV8IS050398
Download Full-Text PDF Cite this Publication

Text Only Version

 

Extensive Study of 2d Transformations in Computer Graphics

Ankur Rana

Assistant Professor, Department of Computer Science

Quantum University, Roorkee, India

Sandhya Samant

Assistant Professor, Department of Computer Science

Quantum University, Roorkee, India

Abhishek Agarwal Assistant Professor, Department of Mathematics

Quantum University, Roorkee , India

Abstract:- This research paper gives a comprehensive overview of various 2D Transformations in Computer Graphics. 2D graphics uses a two dimensional representation of the real world objects, stored as images in the computer for being manipulated and rendered. Transformation, in graphics, is the process of manipulation of images. Majorly, it is used to reposition the image (Translation), to change its size (Scaling) or orientation (Rotation) and also to get the mirror image (Reflection).

Translation

Transformation

Scaling

Scaling

 

Shearing

Shearing

 

Roatation Reflection

Figure 1 Types of Transformation

Keywords: 2D Graphics, Objects, Images, Transformation, Translation, Scaling, Rotation, Reflection etc.

I. INTRODUCTION

Computer graphics is the field of computer science which deals with creation, storing, displaying and manipulation of images. It is concerned with digitally synthesizing and manipulating visual contents. An image is the 2D representation of a 3D object. Images, on screen, are made up of pixels, which is the smallest addressable unit of display.

Computer graphics is generally categorized into Interactive and Non-interactive graphics. Interactive Computer Graphics is a two way communication between the computer and user, where the image on the screen is controlled by giving signals or instructions to the computer through an input device, Whereas Non-Interactive Computer Graphics is a passive system in which the user does not have any command or control over the image. Here the image is a product of already stored program and is operated by the instructions according to the program and not the user.

Example of Interactive system is Flight Simulator and the example of Non-Interactive system is screen savers.

  1. . TRANSFORMATION

    Transformation is the process of changing the original coordinates of the image with the new coordinates by applying different mathematical functions.[1]

    1. Translation: Translation is the transformation that moves every point by certain distance in horizontal and vertical directions[2]. This movement is based on translation factors tx and ty where, tx is the horizontal movement and ty is the vertical movement.

      Let the point P be defined by (x,y) coordinates, then the new coordinates (x,y) after translation[3] will be:

      x = x+ tx y = y+ ty

      Figure 2 Translation

      Figure 2 shows the translation applied on alphabet F.

      Furthermore, the equation of translation can be explained using matrix, where the representation of the operation will be:

      x 1 0 tx x

      [y] = [0 1 ty].[y]

      1 0 0 1 1

      Figure 3 Translation Matrix

    2. Scaling: Scaling is the transformation in which we resize the object. It refers to enlargement or shrinking of the object. Scaling depends on the scaling factors Sx and Sy where Sx and Sy are the scaling in horizontal and vertical directions respectively.

    Let the point P be defined by (x,y) coordinates, then the new coordinates (x,y) after scaling will be:

    x = x . Sx y = y . Sy

    Figure 4 Scaling

    Figure 3 shows the scaling applied on alphabet F.

    Scaling can be categorized into uniform and non-uniform scaling. If Sx = Sy then it is Uniform Scaling and if Sx Sy then it is Non-uniform Scaling.

    Furthermore, the matrix representation of the above operation can be given as under:

    Figure 6 shows the operation of Rotation.

    Furthermore, we can also represent the rotation on angle with the given matrix:

    x cos sin 0 x [y]=[sin cos 0].[y] 1 0 0 1 1

    Figure 7 Rotation Matrix

    4. Reflection: Reflection is the transformation that produces the mirror image of an object. The mirror image of the object is produced with respect to the reflection axis by rotating the object at 180 degrees along the reflection axis. The axis of reflection can be anywhere in the x-y plane.

    If x-axis is the axis of reflection then the new coordinates after reflection will be:

    X = X and Y = -Y,

    If y-axis is the axis of reflection then the new coordinates after reflection will be:

    X = -X and Y = Y,

    If both x-axis and y-axis are the axis of reflection then the new coordinates will be:

    X = -X and Y = -Y.

    x sx 0 0 x

    [y]=[ 0 sy 0].[y]

    1 0 0 1 1

    Figure 5 Scaling Matrix

    1. Rotation: Rotation is the transformation in which we rotate each point through the origin (0,0). Every point is rotated through the same angle, which is known as the angle of rotation[4]. The unit of this angle can either be in degrees or in radians. If the angle of rotation is then it is taken positive for counter clockwise direction and negative for clockwise direction. The equation for the new coordinates of the point after rotation is:

      X = x cos() y sin () Y = y cos () + x sin ()

      Figure 8 Reflection

      Figure 8 shows the reflection when both x-axis and y-axis are the axis of reflection.

      x 1 0 0 x

      [y]=[0 1 0].[y]

      1 0 0 1 1

      Figure 9 Reflection Matrix (about x axis)

      x 1 0 0 x

      [y]=[ 0 1 0].[y]

      1 0 0 0 1

      Figure 10 Reflection Matrix (about y axis)

      x 1 0 0 x

      [y]=[ 0 1 0].[y]

      1 0 0 1 1

      Figure 11 Reflection Matrix (about xy axis)

      Figure 6 Rotation

      5. Shearing: Shearing is the transformation that produces the distortion of the object. In other words we can also say that shearing tilts the object. If the shearing is horizontal then it will tilt the object towards the left (negative shear) or right (positive shear). Whereas the vertical shear tilts the object up or down.

      Figure 11 Shearing

      Figure 9 shows an example of horizontal shear.

      The equation for horizontal shear applied to a point (x,y), to obtain new coordinates (X,Y) is given by:

      X = x + b.y and Y = y, Where b is shearing factor.

      Whereas the equation for vertical shear with shearing factor c is given by:

      X = x and Y = c . x + y

      The matrix for X shear can be represented as:

      1 0 0
      Xsh=[shx 1 0]
      0 0 1

      Figure 12 Horizontal Shearing

      Similarly, the matrix for vertical shearing can be represented as:

      1 shy 0

      Ysh=[0 1 0]

      0 0 1

      Figure 13 Vertical Shearing

  2. . CONCLUSION

Here in this paper we have discussed various transformations along with their matrix representations. Among the transformation we have discussed, Translation, Rotation, Reflection and their combinations are the rigid transformations because in these transformations the pre-image and image are of same size and shape (congruent). Scaling and Shearing are not rigid transformations because they produce images with different size or shape.

IV. REFERENCES

    1. Ms.A.J.Rajeswari Joe, Dr.N.Rama, Scaling Transform Methods Advanced Computing : An International Journal ( ACIJ ), Vol.4,

      No.2, March 2013

    2. David J.EckHobart and William Smith, Introdution to Computer Graphics Version 1.2, January 2018
    3. Kartik, Seth Jai Parkash Mukand Lal. A Descriptive Study of 2D Graphics Transformations, ISSN(Online): 2320-9801ISSN (Print): 2320-9798 International Journal of Innovative Research in Computer and Communication Engineering
    4. Manoj Kumar Srivastav Champdani Adarsh Sharmik Vidyamandir, 3, R. B. S. Road, Champdani, transformation of an Object in Computer Graphics: A Case Study of Mathematical Matrix Theory (Elixir International Journal

Leave a Reply