Chapter - Three
Chapter - Three
TRANSFORMATION
1
Two-Dimensional Transformation
Transformation means a change in either position ,size, shape or
orientation of any graphical object
1. Translation
2. Scaling
3. Rotation
4. Reflection
2
5. Shearing
1. Translation
x’ = x + and y’ = y +
P’ = P + T
Where P = , P’ = and T = => translation matrix
B’(5,
7)
B(3,
4)
A’(4,
2)
A(2,-
1)
5
2. Scaling
A scaling transformation changes the size of an object
al angl e
origin e d rect
ec t a ngl Scale
r 8
3. Rotation
To generate a rotation ,we have to specify a rotation angle θ and the
position ( , ) of the rotation point about which the object is to be
rotated .
Positive values for the rotation angle define counterclockwise
rotation about the pivot point and negative values rotate objects in
the clockwise direction.
Let us discuss about the rotation of a point P(x,y) when the point is at
the origin (0,0)
Suppose P is a point having coordinate (x,y) is rotated with in an angle 9
Cont’d …
Ø is the original angular position of the point P from the horizontal (x-
axis).
The polar coordinates of P can be expressed as :
x=r
y= r
Similarly, the polar coordinates of P’ can be expressed as :
x’ = r = r ∙ => x -y
y’ = r = + r ∙ => y + x
= =
11
Homogeneous Coordinate System
To obtain square matrices an additional row was added to the matrix
and an additional coordinate, the w-coordinate, was added to the
vector for a point.
In this way a point in 2D space is expressed in three-dimensional
homogeneous coordinates.
This technique of representing a point in a space whose dimension is
one greater than that of the point is called homogeneous
representation.
It provides a consistent, uniform way of handling affine
transformations
12
Cont’d …
If we use homogeneous coordinates, the geometric
transformations given above can be represented using only a
matrix pre-multiplication.
A composite transformation can then be represented by a
product of the corresponding matrices.
Cartesian Homogeneous
( x, y )
( xh, yh, h), h 0
a b
, ( a, b, c ), c 0
c c
14
Homogeneous Coordinate
Representation
1. Translation of :
=
2. Scaling
= or P’ = S(, ).P
3. Rotation
= or P’ = R().P
15
4. Reflection
It is a transformation that produces a mirror image of an
object
Y
Original position
2 3
2’ 3’
Reflected
position
X
1’ 16
Cont’d …
17
Reflection about the y-axis
Reflection about y-axis is accomplished with transformation matrix is
as follows:
2 2’
3 1 1’ 3’
X’= - x , y ’= y
18
Reflection about the x-axis
Reflection about x-axis is accomplished with transformation matrix is
as follows:
x’= -y , y ’= -x
20
21
Example
22
5. Shearing
A transformation that slants the shape of an object is called the
shear transformation.
There are two shear transformations X-Shear and Y-Shear.
One shifts X coordinates values and other shifts Y coordinate values.
However; in both the cases only one coordinate changes its
coordinates and other preserves its values.
Shearing is also termed as Skewing.
5.1 X-Shearing
The X-Shear preserves the Y coordinate and changes are made to X
coordinates, which causes the vertical lines to tilt right or left.
Transformation matrix
, where = shearing factor
Transforms coordinate
x’= x+ ∙ y andposition
y ’= as: 23
y
Cont’d …
5.2 Y-Shearing
The Y-Shear preserves the X coordinates and changes the Y coordinates which
causes the horizontal lines to transform into lines which slopes up or down as shown
in the following figure.
25