0% found this document useful (0 votes)
73 views39 pages

Unit 3 Transformation

The document discusses various 2D geometric transformations including translation, rotation, scaling, reflection, shearing, and their matrix representations. It also covers topics like homogeneous coordinates, composite transformations, windowing, viewports and the process of viewing transformation.

Uploaded by

Shambhavi Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views39 pages

Unit 3 Transformation

The document discusses various 2D geometric transformations including translation, rotation, scaling, reflection, shearing, and their matrix representations. It also covers topics like homogeneous coordinates, composite transformations, windowing, viewports and the process of viewing transformation.

Uploaded by

Shambhavi Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

GEOMETRIC TRANSFORMATIONS

Shubhangi Krishna
TRANSFORMATION
 Transformation means changing some graphics by
applying rules.
 All graphics systems allow the programmer to define
picture that include a variety of transformation.
 For example, the programmer is able to magnify the
picture so that it appears clearly, reduce it, to make it
visible or rotate it so that it can be seen in different angles.
 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.
2 D TRANSFORMATION
 There are three types of transformations :
 Translation
 Rotation
 Scaling
TRANSLATION
 It is a process of repositioning of an object, in a straight
line path from one co-ordinate 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’):
 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.

 It is possible to represent the translation equations as a


single matrix equation by using column vectors to
represent co-ordinate positions and the translation vector:
ROTATION
 In rotation, we rotate the object at particular angle θ (theta)
from its origin. A two dimensional rotation is applied to an
object by repositioning it along a circular path in XY plane.
 To generate a solution, we specify a rotation angle θ and
the position of the rotation point about which the objet is to
be rotated.
 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’).
 Here r is the constant distance of the point from origin,
angle Ф is the original angular position of the point from the
horizontal and θ is the rotation angle.

 Using standard trigonometric equations we can express


transformed coordinates in terms of above angles:

 x’ =rcos(Ф+ θ )=rcos Ф cos θ - rsin Ф sin θ


 y’ =rsin(Ф+ θ )=rcos Ф sin θ - rsin Ф cos θ
 It is important to note that positive values for rotation
values define counter clockwise rotations about rotation
point and negative values rotate objects in the clockwise
sense.
TYPES OF ROTATION
 The positive value of the pivot point (rotation angle) rotates
an object in a counter-clockwise (anti-clockwise)
direction.
 The negative value of the pivot point (rotation angle)
rotates an object in a clockwise direction.
 NOTE: When the object is rotated, then every point of the
object is rotated by the same angle.
 Straight Line: Straight Line is rotated by the endpoints
with the same angle and redrawing the line between new
endpoints.
 Polygon: Polygon is rotated by shifting every vertex using
the same rotational angle.
 Curved Lines: Curved Lines are rotated by repositioning
of all points and drawing of the curve at new positions.
 Circle: It can be obtained by center position by the
specified angle.
 Ellipse: Its rotation can be obtained by rotating major and
minor axis of an ellipse by the desired angle.
ROTATION OF Q IN ROTATION OF P IN
CLOCKWISE DIRECTION ANTI-CLOCKWISE DIRECTION
SCALING
 A scaling transformation changes the size of an object.
 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.
 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:

 Any positive values are valid for scaling factors for S X,


SY .Values less than 1 reduce the size of objects, and
greater than 1 produce enlarged object.

 For both SX, SY equal to 1 will have no effect on the size


of object.

 For uniform scaling, it is necessary to assign same values


to SX, and SY. Unequal values for SX, SY result in a
differential scaling.
REFLECTION
 It is a transformation which produces a mirror image of an
object.
 The mirror image can be either about x-axis or y-axis.
 The object is rotated by180°.
 Following are the types of reflection:
 Reflection about the x-axis:
 Reflection about y axis:

 Reflection about line y=x:

 Reflection about origin:


SHEARING
 It is transformation which changes the shape of object. The
sliding of layers of object occur. The shear can be in one
direction or in two directions.
 Shearing in the X-direction: In this horizontal shearing
sliding of layers occur.
 The homogeneous matrix for shearing in the x-direction is
shown below:
 Shearing in the Y-direction: Here shearing is done by
sliding along vertical or y-axis

 Shearing in X-Y directions: Here layers will slide in both x


as well as y direction.
 The sliding will be in horizontal as well as vertical direction.
The shape of the object will be distorted. The matrix of shear
in both directions is given by:
MATRIX REPRESENTATION
HOMOGENOUS COORDINATES
 The rotation of a point, straight line or an entire image on
the screen, about a point other than origin, is achieved by
first moving the image until the point of rotation occupies
the origin, then performing rotation, then finally moving the
image to its original position.
 A translation may be done by adding or subtracting to each
point, the amount, by which picture is required to be
shifted. Translation of point by the change of coordinate
cannot be combined with other transformation by using
simple matrix application.
 Such a combination is essential if we wish to rotate an
image about a point other than origin by translation,
rotation again translation.
 To combine these three transformations into a single
transformation, homogeneous coordinates are used.
 In homogeneous coordinate system, two-dimensional
coordinate positions (x, y) are represented by triple-
coordinates.
 Homogeneous coordinates are generally used in design
and construction applications.
 Here we perform translations, rotations, scaling to fit the
picture into proper position.
MATRIX REPRESENTATION OF HOMOGENEOUS
COORDINATE
COMPOSITE TRANSFORMATION:
 A number of transformations or sequence of
transformations can be combined into single one called as
composition.

 The resulting matrix is called as composite matrix. The


process of combining is called as concatenation.

 Suppose we want to perform rotation about an arbitrary


point, then we can perform it by the sequence of three
transformations:
 Translation
 Rotation/Scaling
 Reverse Translation
 The ordering sequence of these numbers of
transformations must not be changed.

 If a matrix is represented in column form, then the


composite transformation is performed by multiplying
matrix in order from right to left side.

 The output obtained from the previous matrix is multiplied


with the new coming matrix.
WINDOWING & VIEWPORT
 The process of selecting & viewing the picture with
different views is called windowing.
 The process which divides element of the picture into its
visible and invisible portions, allowing invisible portion to
be discarded is called clipping.
 A picture is stored in computer memory using any
convenient Cartesian coordinate system, referred as world
coordinate system.(WCS).
 But when a picture is to be displayed on a display device, it
is measured in physical device coordinate system (PDCS).
 Hence displaying an image of a picture involves mapping
of the coordinates of the points and lines that form the
picture into appropriate physical coordinate where the
image is to be displayed .
 This mapping is achieved with the use of coordinate
transformation known as viewing transformation.
 It is also known as window to view or windowing
transformation.
WINDOW

 The method of selecting and enlarging a portion of a


drawing is called windowing.
 The area chosen for this display is called a window.
 The window is selected by world-coordinate.
 Sometimes we are interested in some portion of the object
and not in full object.
 So we will decide on an imaginary box.
 This box will enclose desired or interested area of the
object. Such an imaginary box is called a window.
VIEWING TRANSFORMATION IN SEVERAL
STEPS:
VIEWING TRANSFORMATION IN SEVERAL
STEPS:
 First, we construct the scene in world coordinate using the
output primitives and attributes.
 To obtain a particular orientation, we can set up a 2-D
viewing coordinate system in the window coordinate plane
and define a window in viewing coordinates system.
 Once the viewing frame is established, are then transform
description in world coordinates to viewing coordinates.
VIEWING TRANSFORMATION IN SEVERAL
STEPS:
 Once the viewing frame is established, are then transform
description in world coordinates to viewing coordinates.
 Then, we define viewport in normalized coordinates (range
from 0 to 1) and map the viewing coordinates description
of the scene to normalized coordinates.
 At the final step, all parts of the picture that (i.e., outside
the viewport are dipped, and the contents are transferred
to device coordinates).
VIEWPORT
 An area on a display device to which a window is mapped
is called a viewport.
 A viewport is a polygon viewing region in computer
graphics.
 The viewport is an area expressed in rendering-device-
specific coordinates, e.g. pixels for screen coordinates, in
which the objects of interest are going to be rendered.
 A viewport defines in normalized coordinates a rectangular
area on the display device where the image of the data
appears.
WINDOW TO VIEWPORT TRANSFORMATION:
 Window-to-Viewport transformation is the process of
transforming a two-dimensional, world-coordinate scene to
device coordinates.
 In particular, objects inside the world or clipping window
are mapped to the viewport. The viewport is displayed in
the interface window on the screen.
 In other words, the clipping window is used to select the
part of the scene that is to be displayed. The viewport then
positions the scene on the output device.
WINDOW TO VIEWPORT TRANSFORMATION:
WORKSTATION TRANSFORMATION
 The object together with its window is translated until the
lower left corner of the window is at the origin.
 Object and window are scaled until the window has
dimension of the viewport.
 Translate the viewport to its correct position on the
screen.

You might also like