Adobe Scan Jan 12, 2021
Adobe Scan Jan 12, 2021
1 0
X Y 1 = [XY1]x| 0 1
7,
0 0
Here matrix 01 0is called the translation matrix.
TT 1
Matrix Representation and Homogeneous Coordinates
The composite transformation (i.e.
can be carried out conveniently
carrying out two or more transformations at a time)
by using matrix representation of transformation
A concept of
homogeneous co-ordinates is used. Every point having routines
be represented in matrix form as coordinates (x, y) can
[X, Y, W1. Here W represents a parameter which defines
class of transformation. The
representation of a coordinate in matrix
called homogeneous coordinates. as shown above is
3.9.2 Scaling
This routine is used to
enlarge the object or make it small.
The basic equations are
X X. S
Y Y.S,
where S, and S, are the scaling factor in x and
image, the value of scaling factor will be y direction respectively. To
greater than one and to diminish an
enlarge an
value of scaling factor will be less than image, the
one.
S 0
Scaling matrix will be 0
Computer Graphics
109
|1 0 S, o 01 [1 0 01 S, 0 0
0 1 0 x0 S 0 x0 10 0
Sy 0
-0 -h100 1J L» » 1] a-S,)x (-S,)% 1
3.9.3 Rotation
Ratation of any point is effective with respect to some fixed point. We assume anticlockwise
rotation as positive and clockwise rotation as negative. Refer Fig. 3.13.
P'(x, y)
Px,y)
= r lcos 6 cos o -
sin 0 sin o|
= (r cos o) cos 6 - (r sin ) sin 0
2.121 0.707
Concatenating the matrix [T,] and (R] we have resultant matrix R as -2.121 0.707
IR) -6.363 2.121
=
IT} R
10 0 0.866 Now X Y 1]= X Y 1x R
-0.5
113
7.07 +2.121)
. = 2.121 2121 6.363, .707
= -25.452. 9.898)
Reflecti trix is given by IR] = 0 10
(5, 2) is
Similarly, the final position of point
00
1] [5 =
2 1 x[R
point (8, 4) i
n ce to find coordnates ol
point P i.e. r, y) about
y-axis
The final position of
1= )
[8 4 1 x[R]
3.9.4 Refiection
1 = x0 1
of an object. Reflection is
0 1
to obtain mirror image
By using this routine, it is possible
always carried out about an axis
called axis of reflections. d Reflection Matrix when the Axis
of Reflection is the Line Passing Through
If the axis of reflection is z-axis then
the r-coordinate of
the
point remains unchange Origin
when the axis of reflection is y-axis Refer Fig. 3.16.
the y-coordinate
Similarly
flips (changes sign).
while remains the same while the r-coordinate changes its e equation of the line passing through origin is y
the y-coordinate of the reflection the slope (m tan 8). =
where m is
mx,
sign. should be taken:
of Point P about r-axis
is P (Refer Fig. 3.14) The following steps
Reflection About z-axis: Reflection R o t a t e the line that 1s axis of reflection y = m,
in clockwise direction by angle 8 = tan-(m) to
P allign it with x-axis. Rotation matrix is given by
A A =
A=0 -1
0
Reflection matrix is given by
(3) Now the line is rotated by angle 8 in counter-clockwise direction so that original
position of line is restored.
y), then X Y 1] =
X Y 1] x
[R
Hence if after reflection, coordinates are (x,
Reflection About y-axis (Refer Fig. 3.15) cos Sin6
A = |-sin cose
0 0
,) The resultant reflection matrix [R} is obtained by concatenating [A,), [A,], lA,l as
is a mx +c (i.e. equation
Liney
The Reflection Matrix when Axis of Reflection
=
114 115
is obtained. cos (-71.56)
about this axis sin (-71.56) 0
(3) Next, reflection inclination.
4) The line is
rotated back to
its original
position.
R -sin (-71.56) cos(-71.56) 0
translated back to its original
(6) The line is concatenating the above five transformati.. 0
is obtained by
The resultant matrix d reflection about x-axis. Let RJ
matrices. represent the reflection matrix,
then
matrix when the axis of reflection is line y = 2x,
10 0
EXAMPLE 3.6. Find the reflection
involved
Solution: Following steps are
clockwio
2r has to be rotated by
an angle 0 tan (2) 63.43°, in
=
=
1
(1) The line y =
The reflection of any point say P2, 3) can now be obtained. Let (xr,
of point of reflection, then
y) be the coordinates
1 12 3 1 x
IR
EXAMPLE 3.7. Find the reflection matrix when axis
of reflection is y 3x + 2. =
Fig.3.17.
Fundamentals of CAD/CAM
Computer Graphics
116
Similarly
117
3.9.5 Shear of an object or an image.
distortat11on
transformation produces
A shearing 3.18.
There a r e two types
of shear. Refer Fig. x'2 2 =18 10 11
10 0
(1) x-direction shear.
x
0 1
o
(2) y-direction shear. will. 2 3 1
will change while the y-coordinate vill remain
1] = [10
13
the x - c o o r d i n a t e
In x-direction shear, factor in
x - d i r e c t i o n then the
basic equations are x2 2) = (10, 13)
is the shearing
s a m e . IfSh, * +
Sh, x y
1 9.9. A line having end
EXAM in direction. Find (2, 2) and (5, 5) is
the x-coordinate will remain 5 units
y-dirn the
transformation matrixsealed by 2 units
and the final
in a
x-direction and
the y-coordinate will change whilebasic equations are #ion : The transtormation matrix is given coordinates of the line.
In y-direction shear, then the by
factor in y-direction
s a m e . IfSh, is the shearing
S O 2 0 01
1 y +x x
Sh,
IS =
0 s, 0=0 5 0
0
1 lo o
1
Tot the new coordinates be
(1 y1) and
(r'2 2) corresponding to (2, 2) and (5, 5) then:
''1 1 =l y 1] x [S]
2 0 0
1 1 =12 2 1x 0 5
0 1
y-Direction shear
x-Direction shear
' 1 1 =[4 10 1
Fig. 3.18. x1 y =(4, 10)
is translated by 2 units in
end points (3, 5) and (8, 10) Similarly
EXAMPLE 3.8. A line having translation matrix and position of
end
2 0 00
Find the
z-direction and 3 units in y-direction.
points after translation operation. y'2 1 =
[5 5 1]x |0 5 0
matrix in given by 00 1|
Solution: The translation
0
0 1 [10 25 1
0 1
=
1 0 2
I7=0 1 0 = 0 1 0
25)
Hence lx2 2)= (10, anticlockwise
45° in
2 3 1 5) (10, 10) is
rotated by
line having end points (4, the final c o o r d i n a t e s of the line
be EXAMPLE 3.10. A and
and (x,', y^) and (x2, Y2) matrix
Find the transformation
the end points of the line initially airection.
If (x,Y1) & (r2, Y2) are
then transformation matrix is given by
translation Solution The sin45 0
the n e w coordinates after :
cos 45°
1) [7] sin 0
,y, 1 =
k, y, x cos6
0 = - s i n 45° cos
45 0
0 0 R = -sin 0 cos 0 0
0 0
x s1 1] =[3 5 1) x
931 .707
.707
.707
707 0
1]
x, , =
[5 8 1]
0
yl= (5, 8)
thlen
harshtin
1y, t2
ore
r t