Page 75 - DCAP504_Computer Graphics
P. 75
Computer Graphics
Here,
S x 0
The scaling matrix is used to perform the scaling transformation on the object. Sx and Sy are
0 y S
the scaling factors. All the point coordinates of the object have to be multiplied with the scaling matrix
to scale the object.
When performing matrix multiplication we need to make sure that the number of
columns in the first matrix is equal to number of rows in the second matrix.
Let A and B are two 2X2 matrices, i.e. two rows and two columns,
a b
A=
c d
p q
B=
m n
As you can see the number of columns in matrix A is equal to number of rows in matrix
B. Therefore, matrix multiplication can be carried out.
a b p q
A*B=
c d m n
.
p.a + m q . a + n
b
.
b
A*B=
d
d
.
p . c + m q . c + . n
The resultant matrix is also a 2X2 matrix.
If matrix A is a 2X2 matrix and B is a 2X1 matrix the matrix multiplication is carried out
as shown,
a b
A=
c d
p
B=
q
As you can see the number of columns in matrix A is equal to number of rows in matrix
B. Therefore, matrix multiplication can be carried out.
a b p
A*B=
c d q
p.a + q
b
.
A*B=
d
.
p . c + q
The resultant matrix after multiplication is a 2X1 matrix.
Consider a scaling transformation that shrinks the object in X and Y directions
uniformly by a factor 2.
This means that the scaling factors Sx and Sy are 0.5. Therefore the scaling
matrix is written as,
50. 0
0 0. 5
The figure 6.3 shows a rectangle object that is scaled by a factor 0.5 in X and Y
directions of the 2-D space. The four points of the rectangle object (0, 0), (2, 0),
(0, 2) and (2, 2) are multiplied individually with the scaling matrix to scale the
rectangle. The point coordinate values of the rectangle after multiplying with
the scaling matrix are (0, 0), (1, 0), (0, 1) and (1, 1). As you can see the rectangle
after scaling is uniformly scaled on all sides as shown in figure 6.4.
68 LOVELY PROFESSIONAL UNIVERSITY