More info

Thursday, 6 March 2014

Computer Graphics Notes - Lab 17 2-D GEOMETRIC TRANSFORMATION

Introduction

Almost all graphics systems allow the programmer to define picture that include a variety of transformations. For example, the programmer is able to magnify a picture so that detail appears more clearly, or reduce it so that more of the picture is visible. The programmer is also able to rotate the picture so that he can see it in different angles.

Two Dimensional transformations

In this section, we describe the general procedures for applying translation, rotation, and scaling parameters to reposition and resize the two dimensional objects.

Translation


Translation is a process of changing the position of an object in a straight-line path from on location to another.



We can translate a two dimensional point by adding translation distances, tx and ty, to the original coordinate position (x, y) to move the point to a new position (x', y'), as shown in the figure below

x' = x + tx
y' = y + ty

The translation distance pair (tx, ty) is called a translation vector or shift vector. It is possible to express the translation equations as a single matrix equation by using column vectors to represent coordinate positions and translation vector :
                x                 x'                   tx
P =                   P' =                T =
                y                 y'                   ty

This allows us to write the two dimensional translation equations in the matrix form : P' = P + T
Example
Translate a polygon with coordinates A (2, 5), B(7, 10) and C(10, 2) by 3 units in x direction and 4 units in y direction.



Rotation
A two dimensional rotation is applied to an object by repositioning it along a circular path in the xy plane. To generate a rotation, we specify a rotation angle 0 and the position of the rotation point about which the object is to be rotated.

No comments:

Post a Comment