Beruflich Dokumente
Kultur Dokumente
INTRODUCTION
Transformation is repositioning or resizing an object. Transformation includes any kind
of restructuring of an object which can be positioning or rotating or scaling of the object.
BASIC TRANSFORMATIONS
y y/
and T= tx P (x, y )
ty
B) Rotation Fig-5.1
Rotation refers to changing the position of an object along a Translating a point
circular path. This transformation is applied to an object by from point P to
repositioning it along a circular path on xy-plane. To get point P/.
rotation, we specify a rotation angle θ and the position (xr, yr) of the rotation point (or
pivot point) about which the object is to be rotated. Positive value of rotation angle
defines anti-clockwise (or counterclockwise) rotations about the rotation (or pivot) point
and negative value of rotation angle defines clockwise rotation. The rotation can also be
treated as a rotation about a rotation axis which is perpendicular to xy-plane and passes
through the pivot point.
If we consider the position of pivot point, there will be following two cases
Case-I Pivot point is at the coordinate origin
Consider Fig-5.2. Here origin O is the pivot point. r is the distance between O and B(x,
y).Now OB line rotates an angle θ anticlockwise and the point B moves to point B/ whose
coordinate is (x/,y/). Using standard trigonometric identities, we can express the
transformation equation for rotating a point at position (x, y) through an angle θ about the
origin as:
x/=xcosθ – ysinθ, y/=xsinθ + ycosθ ------------------------ 5.2
Equation 5.2 can be represented in matrix format, with the column vector representations
5.1(a) for coordinate positions, as follows
P/=R . P -------------------------- 5.2(a)
Where the rotation matrix R is
R= cosθ -sinθ
sinθ cosθ
B/(x/, y/)
Line OB in fig 5.2 and line AB in fig 5.3 makes an angle φ with the X-axis.
C) Scaling
A scaling transformation alters the size of an object. This operation can be carried out for
polygons by multiplying the coordinate values (x, y) of each vertex by scaling factors sx
and sy to produce the transformed coordinates(x/, y/)
x/=x . sx, y/=y . sy ----------------------------------- 5.4
Scaling factors sx scales objects in the x-direction, while sy scales in the y-direction. The
transformation equations 5.4 can also be represented in the matrix form as follows:
x/ = sx 0 x
y/ 0 sy y
or
P/ = S . P ------------------------------- 5.5
Where S is the 2 X 2 scaling matrix.
Any positive value can be assigned to the scaling factors sx and sy. Values less than 1
reduce the size of the object and value greater than 1 produce an enlargement. Value 1 for
sx and sy leaves the size of object unchanged. If the value of sx and sy be same, a uniform
scaling is produced.
O(0, 0) O(0, 0)
Fig-5.4 Fig-5.5
/ / /
Turning a rectangle OABC into another rectangle OA B C (fig-5.4) with scaling factors
sx=2 and sy=2 and OAB/C/(fig-5.5) with scaling factors sx=2 and sy=1.
OTHER TRANSFORMATIONS
Translation, Rotation, Scaling, these basic transformations are used in most graphics
packages. But there are few additional transformations that are useful in certain
applications. Two such transformations are
A) Reflection Y
Reflected Original
B) Shear position Position
A) Reflection
A reflection is a transformation that produces a
mirror image of an object. The mirror image for a
two dimensional reflection is generated relative
to an axis of reflection by rotating the object 1800 X
about the reflection axis. Reflection axis can be a
Fig-5.6
line on xy-plane or perpendicular to the xy-plane.
Now consider these two cases: i) If reflection axis is Reflection of an object
a line on xy-plane- The rotation path of the object about the y-axis
about reflection axis is in a plane perpendicular to
the xy-plane.
ii) If reflection axis is a line perpendicular to the xy-plane-The rotation path is the xy-
plane.
Y
Y Y Y
Original
Position
X P
X
Reflected
position
X X
Fig-5.11 Fig-5.12
A unit square(fig-5.11) is converted to a parallelogram (fig-5.12) using the x direction
shear matrix with shx=1.
b) Shear transformation along y-axis Transformation
An y-direction shear relative to the y-axis is produced with the transformation matrix.
1 0
shy 1
Fig-5.13
A unit square(fig-5.11) is converted to
a parallelogram (fig-5.13) using the y
direction share matrix with shy=1.
Where (x, y) is the coordinate of initial point (original point) and (x/, y/) is the coordinate
of the transformed point (final position).
Transformation can be applied on an object by changing the value of a, b, c, d of matrix
T. The following table show different transformations on a point P for different value of
a, b, c, d:
x/ y/ = a b 0 0
c d
P/=P+T
P
where
P= x P/= x/
P
y x2 y/
1 1
and
Rotation –
P/=R . P
P
Scaling –
P/=S . P
P
COMPOSITE TRANSFORMATION
Consider the following three problems fig 5.14 (a), (b), (c), (d)
1. Translate the point A (1,2) of triangle ABC to (3, 5)
2. Rotate it 900 counter clockwise about point A
3. Translate point A to origin O (0, 0)
We can easily solve these three problems individually. But if we want to apply these
three sequentially on the triangle, the combined transformation is called composite
transformation.
Here
for problem-1
tx=3-1[(x-coordinate of the final position) – (x-coordinate of the initial point)]=2
and
ty=5-2 [(y-coordinate of the final position) – (y-coordinate of the initial point)]=3
therefore, transformation matrix is
C (4, 13)
y y
C (2,10)
A (3, 5) B (6, 5)
A (1, 2) B (4,2)
x x
O(0, 0) O(0, 0)
y y
B
C 900
B
A (3, 5)
C
x
O
x
O(0, 0) A (0, 0)
For problem-3
tx=0-3=-3
and
ty=0-5=-5
Now we have to derive the composite transformation matrix if the above mentioned three
transformations (problem1, 2, 3) are applied sequentially on the triangle. We can get this
composite transformation matrix by multiplying three transformation matrices of
equation (A), (B), (C).
Therefore the composite transformation matrix is
T(2, 3) . R(900) . T(-3, -5)
This is the general approach of getting composite matrix from individual transformations.