BLOCK 2 Computer Graphics Ignou
BLOCK 2 Computer Graphics Ignou
BLOCK 2 Computer Graphics Ignou
Structure
1.0 Introduction
1.1 Objectives
1.2 Basic Transformations
1.2.1 Translation
1.2.2 Rotation
1.2.3 Scaling
1.2.4 Shearing
1.3 Composite Transformations
1.3.1 Rotation about a Point
1.3.2 Reflection about a Line
1.4 Homogeneous Coordinate Systems
1.5 3-D Transformations
1.5.1 Transformation for 3-1 Translations
1.5.2 Transformation for 3-D Rotation
1.5.3 Transformation for 3-D Scaling
1.5.4 Transformation for 3-D Shearing
1.5.5 Transformation for 3-D Reflection
1.6 Summary
1.7 Solutions / Answers
Page Nos.
5
5
6
6
9
12
15
20
21
22
27
31
32
32
34
35
35
37
38
1.0 INTRODUCTION
In the previous Block, we have presented approaches for the generation of lines and
polygonal regions. We know that once the objects are created, the different
applications may require variations in these. For example, suppose we have created
the scene of a room. As we move along the room we find the objects position comes
closer to us, it appears bigger even as its orientation changes. Thus we need to alter or
manipulate these objects. Essentially this process is carried out by means of
transformations. Transformation is a process of changing the position of the object or
maybe any combination of these.
The objects are referenced by their coordinates. Changes in orientation, size and shape
are accomplished with geometric transformations that allow us to calculate the new
coordinates. The basic geometric transformations are translation, rotation, scaling and
shearing. The other transformations that are often applied to objects include reflection.
In this Block, we will present transformations to manipulate these geometric 2-D
objects through Translation, and Rotation on the screen. We may like to modify their
shapes either by magnifying or reducing their sizes by means of Scaling
transformation. We can also find similar but new shapes by taking mirror reflection
with respect to a chosen axis of references. Finally, we extend the 2-D transformations
to 3-D cases.
1.1
OBJECTIVES
Transformations
1.2
BASIC TRANSFORMATIONS
Consider the xy-coordinate system on a plane. An object (say Obj) in a plane can be
considered as a set of points. Every object point P has coordinates (x,y), so the object
is the sum total of all its coordinate points (see Figure 1). Let the object be moved to a
new position. All the coordinate points P(x,y) of a new object Obj can be obtained
from the original points P(x,y) by the application of a geometric transformation.
y
Obj
. P (x, y)
Figure 1
1.2.1 Translation
Translation is the process of changing the position of an object. Let an object point
P(x,y)=xI+yJ be moved to P(x,y) by the given translation vector V= txI + tyJ, where
tx and ty is the translation factor in x and y directions, such that
P=P+V.
----------------(1)
In component form, we have
Tv=
x=x+ tx and
y=y+ty
----------------(2)
.P
.P
Obj
x
Figure 2
Obj
As shown in Figure 2, P is the new location of P, after moving tx along x-axis and ty
along y-axis. It is not possible to develop a relation of the form.
P=P.Tv
---------------(3)
H0);
(x/H,y/H)
----------------(4)
Transformations
matrices and the resulting matrix is often referred as the composite transformation
matrix.
We can represent the basic transformations such as rotation, scaling shearing, etc., as
3x3 homogeneous coordinate matrices to make matrix multiplication compatibility
with the matrix of translation. This is accomplished by augmenting the 2x2 matrix
0
a b
a b 0
c d 0
0 0 1
Thus, the new coordinates of a transformed object can be found by multiplying
previous object coordinate matrix with the required transformation matrix. That is
New Object
Coordinate
matrix
Previous object
Coordinate
matrix
Transformation
matrix
1 0 0
0 1 0
tx ty 1
x1
x2
x3
x4
y1
y2
y3
y4
1
1
1
1
0 0 1
1 0 0
5 0 1 . . 0 1 0
5 5 1
2 3 1
0 5 1
2
7
7
2
Thus, A(x1,y1)=(2,3)
B(x2,y2)=(7,3)
C(x3,y3)=(7,8) and D(x4,y4)=(2,8)
3 1
3 1
8 1
8 1
1 0 0
0 1 0
2 3 1
D (0,5)
D (2,8)
C (7,8)
A (2,3)
B (7,3)
C (5,5)
B (5,0)
(0,0)
a) Square before Translation
1.2.2 Rotation
In 2-D rotation, an object is rotated by an angle with respect to the origin. This angle
is assumed to be positive for anticlockwise rotation. There are two cases for 2-D
rotation, case1- rotation about the origin and case2 rotation about an arbitrary point.
If, the rotation is made about an arbitrary point, a set of basic transformation, i.e.,
composite transformation is required. For 3-D rotation involving 3-D objects, we need
to specify both the angle of rotation and the axis of rotation, about which rotation has
to be made. Here, we will consider case1 and in the next section we will consider
case2.
Before starting case-1 or case-2 you must know the relationship between polar
coordinate system and Cartesian system:
Relation between polar coordinate system and Cartesian system
A frequently used non-cartesian system is Polar coordinate system. The following
Figure A shows a polar coordinate reference frame. In polar coordinate system a
coordinate position is specified by r and , where r is a radial distance from the
coordinate origin and is an angular displacements from the horizontal (see
Figure 2A). Positive angular displacements are counter clockwise. Angle is
measured in degrees. One complete counter-clockwise revolution about the origin is
treated as 3600. A relation between Cartesian and polar coordinate system is shown in
Figure 2B.
y-axis
r
r
P(x,y)
x-axis
O
Figure 2A: A polar coordinate reference-frame
Transformations
P (x, y)
P(x,y) = P(r.cos,r.sin)
P(x,y)=P[r.cos(+),rsin(+)]
Figure 3
x= x.cos-y.sin = R
y= xsin+ycos
Thus, we have obtained the new coordinate of point P after the rotation. In matrix
form, the transformation relation between P and P is given by:
cos
sin
(xy)=(x,y)
-sin cos
that is P=P.R
---------(5)
cos sin
-sin cos
0
0
That is Ph=Ph.R ,
10
0
0
1
---------(6)
---------(7)
Where Ph and Ph represents object points, after and before required transformation, in
Homogeneous Coordinates and R is called homogeneous transformation matrix for
anticlockwise Rotation. Thus, Ph, the new coordinates of a transformed object, can
be found by multiplying previous object coordinate matrix, Ph, with the transformation
matrix for Rotation R.
Note that for clockwise rotation we have to put = , thus the rotation matrix R , in
HCS, becomes
cos( ) sin() 0
R-= sin() cos() 0
0
0
1
cos sin 0
sin cos 0
0
0
1
cos450 sin450 0
= sin450 cos450 0
0
0
1
2/2 2/2 0
= 2/2 2/2 0
0
0
1
So the new coordinates ABC of the rotated triangle ABC can be found as:
0 0 1 2 / 2
[ABC]=[ABC]. R45 = 1 1 1 2 / 2
5 2 1 0
2 / 2 0
0
1
0
2 / 2 0 = 0
2
1
0
1
3 2 / 2 7 2 / 2 1
C
B
Figure (a)
11
Transformations
y
C
B
A
Figure (b)
3) A point P(3,3) makes a rotating of 450 about the origin and then translating in the
direction of vector v=5I+6J. Find the new location of P.
1.2.3
Scaling
12
Let P(x,y) be any point of a given object and sx and sy be scaling factors in x and y
directions respectively, then the coordinate of the scaled object can be obtained as:
x=x.sx
y=y.sy
--------(8)
If the scale factor is 0<s<1, then it reduces the size of an object and if it is more then
1, it magnifies the size of the object along an axis.
For example, assume sx >1.
i)
(6,3)
sx =2
(4,2)
(2,1)
(4,2)
(4,1)
(4,1)
(8,1)
ii) Similarly, assume sy >1 and consider (x,y)(x,2.y), i.e., Magnification in ydirection with scale factor sy =2.
(3,3)
(2,2)
(3,6)
sy=2
(4,2)
(2,1)
(2,4)
(4,4)
(2,2)
(4,2)
(4,1)
iii) Consider (x,y)(x.sx,y) where 0< sx = y2 <1 i.e., Compression in x-direction with
scale factor sx=1/2.
(3,3)
(2,2)
(1.5,3)
sy =2
(4,2)
(2,1)
(4,1)
(1,2)
(2,1)
Thus, the general scaling is (x,y) (x.sx,y.sy) i.e., magnifying or compression in both
x and y directions depending on Scale factors sx and sy. We can represent this in
matrix form (2-D Euclidean system) as:
sx
(x,y)= (x,y) 0
0
sy
----(9)
13
Transformations
sy
0
0
0
1
----(10)
that is Ph=Ph.ssx,sy
----(11)
Where Ph and Ph represents object points, before and after required transformation,
in Homogeneous Coordinates and ssx,sy is called transformation matrix for general
scaling with scaling factor sx and sy .
Thus, we have seen any positive value can be assigned to scale factors sx and sy. We
have the following three cases for scaling:
Case 1: If the values of sx and sy are less then 1, then the size of the object will be
reduced.
Case2: If both sx and sy are greater then 1, then the size of the object is enlarged.
Case3: If we have the same scaling factor (i.e. sx=sx=S), then there will be uniform
scaling (either enlargement or compression depending on the value of Sx and Sy) in
both x and y directions.
Example3: Find the new coordinates of a triangle A(0,0),B(1,1),C(5,2) after it has
been (a) magnified to twice its size and (b) reduced to half its size.
Solution: Magnification and reduction can be achieved by a uniform scaling of s
units in both the x and y directions. If, s>1, the scaling produces
magnification. If, s<1, the result is a reduction. The transformation can be
written as: (x,y,1)(s.x,s.y,1). In matrix form this becomes
s 0 0
(x,y,1). 0 s 0 = (s.x,s.y,1)
0 0 1
We can represent the given triangle, shown in Figure (a), in matrix form, using
homogeneous coordinates of the vertices as :
A 0 0 1
B 1 1 1
C 5 2 1
5
4
3
2
B
1
A
O
14
2 0 0
0 2 0
0 0 1
So the new coordinates ABC of the scaled triangle ABC can be found as:
0 0 1
1 1 1
5 2 1
[ABC]=[ABC]. R2,2 =
2 0 0
0 2 0
0 0 1
0 0 1
= 2 2 1
10 4 1
4
3
2
1A
O
2
x
10
1.2.4
1A
Shearing
Shearing transformations are used for modifying the shapes of 2-D or 3-D objects.
The effect of a shear transformation looks like pushing a geometric object in a
direction that is parallel to a coordinate plane (3D) or a coordinate axis (2D). How far
a direction is pushed is determined by its shearing factor.
One familiar example of shear is that observed when the top of a book is moved
relative to the bottom which is fixed on the table.
In case of 2-D shearing, we have two types namely x-shear and y-shear.
In x-shear, one can push in the x-direction, positive or negative, and keep the ydirection unchanged, while in y-shear, one can push in the y-direction and keep the xdirection fixed.
15
Transformations
ay
ay
P(x,y)
P(x,y)
P (x,y)
Figure 4
Thus, the points P(x,y) and P(x,y) have the following relationship:
x' = x + ay
y' = y
= Shx(a)
------(11a)
-------(12)
-------(13)
--------(14)
Where Ph and Ph represents object points, before and after required transformation,
in Homogeneous Coordinates and Shx(a) is called homogeneous transformation matrix
for x-shear with scale parameter a in the x-direction.
Y
P (x,y)
P (x,y)
b.x
P(x, y)
X
Figure 5 (a)
16
Thus, the points P(x,y) and P(x,y) have the following relationship :
x' = x
y' = y+bx
= Shy(b)
----------(15)
----------(16)
---------(17)
---------(18)
Where Ph and Ph represents object points, before and after required transformation,
in Homogeneous Coordinates and Shy (b) is called homogeneous transformation
matrix for y-shear with scale factor b in the y-direction.
xy-shear about the origin
P (x, y)
a.y
P (x, y)
b.x
Figure 5 (b)
= Shxy(a,b)
----------(19)
where ay and bx are shear factors in x and y directions, respectively. The xy-shear
is also called simultaneous shearing or shearing for short.
In matrix form, we have,
1 b
(x,y)=(x,y) a 1
---------(20)
1 b 0
a 1 0
0 0 1
---------(21)
----------(22)
17
Transformations
Where Ph and Ph represent object points, before and after required transformation, in
Homogeneous Coordinates and Shxy(a,b) is called homogeneous transformation matrix
for xy-shear in both x- and y-directions with shearing factors a and b, respectively,
Special case: when we put b=0 in equation (21), we have shearing in x-direction, and
when a=0, we have Shearing in the y-direction, respectively.
Example 4: A square ABCD is given with vertices A(0,0),B(1,0),C(1,1), and D(0,1).
Illustrate the effect of a) x-shear b) y-shear c) xy-shear on the given square, when a=2
and b=3.
Solution: We can represent the given square ABCD, in matrix form, using
homogeneous coordinates of vertices as:
A
B
C
D
0 0
1 0
1 1
0 1
1
1
1
1
1 0 0
2 1 0
0 0 1
So the new coordinates ABCD of the x-sheared object ABCD can be found as:
[ABCD]=[ABCD]. Shx(a)
[ABCD]=
A
B
C
D
0 0
1 0
1 1
0 1
1
1
1
1
1 0 0
0
. 2 1 0 = 1
0 0 1
3
2
0
0
1
1
1
1
1
1
A
B
C
D
0 0
1 0
1 1
0 1
1
1
1
1
1 3 0
. 0 1 0
0 0 1
0
1
1
0
0
3
4
1
1
1
1
1
0
3
4
1
1
1
1
1
A
B
C
D
0 0 1
1 0 1
1 1 1
0 1 1
1 3 0
0
. 2 1 0 = 1
0 0 1
3
2
18
Figure (a) shows the original square, figure (b)-(d) shows shearing in the x, y and
both directions respectively.
Y
Y
C (1,1)
D (2, 1)
C (3,1)
D
A
Figure (a)
Figure (b)
Y
Y
C (1, 4)
D (1, 3)
C (3,4)
B (1, 3)
D
A
O
Figure (c)
B(2, 1)
Figure (d)
1) Tv 1 =T-v
2) R 1 = R-
3) (i) Shx-1(a) =Shx(-a)
(ii) Shy-1(b) =Shx(-b)
(iii) Shxy-1(a,b) =Shx(-a,-b)
4) S-1sx,sy,sz =S1/sx,1/sy,1/sz
5) The transformation for mirror reflection about principal axes do not change after
inversion.
(i) Mx-1 =M-x= Mx
(ii) My-1 =M-y= My
(iii) Mz-1 =M-z= Mz ,
19
Transformations
6) The transformation for rotations made about x,y,z axes have the following
inverse:
(i) R-1x, = Rx,- = RTx,
(ii) R-1y, = Ry,- = RTy,
(iii) R-1z, = Rz,- = RTz,
3) Find the 3x3 homogeneous co-ordinate transformation matrix for each of the
following:
a) Shift an image to the right by 3 units.
b) Shift the image up by 2 units and down 1 units.
c) Move the image down 2/3 units and left 4 units.
.
5) Is a simultaneous shearing the same as the shearing in one direction followed by a
shearing in another direction? Why?
20
In other words we can say that a sequence of the transformation matrices can be
concatenated into a single matrix. This is an effective procedure as it reduces because
instead of applying initial coordinate position of an object to each transformation
matrix, we can obtain the final transformed position of an object by applying
composite matrix to the initial coordinate position of an object. In other words we can
say that a sequence of transformation matrix can be concatenated matrix into a single
matrix. This is an effective procedure as it reduces computation because instead of
applying initial coordinate position of an object to each transformation matrix, we can
obtain the final transformed position of an object by applying composite matrix to the
initial coordinate position of an object.
1.3.1
Given a 2-D point P(x,y), which we want to rotate, with respect to an arbitrary point
A(h,k). Let P(xy) be the result of anticlockwise rotation of point P by angle about
A, which is shown in Figure 6.
P(x, y)
Y
Y
P(x, y)
A(h, k)
Figure 6
Since, the rotation matrix R is defined only with respect to the origin, we need a set
of basic transformations, which constitutes the composite transformation to compute
the rotation about a given arbitrary point A, denoted by R,A. We can determine the
transformation R,A in three steps:
1) Translate the point A(h,k) to the origin O, so that the center of rotation A is at the
origin.
2) Perform the required rotation of degrees about the origin, and
3) Translate the origin back to the original position A(h,k).
Using v=hI+kJ as the translation vector, we have the following sequence of three
transformations:
R,A =T-v. R. Tv
=
1
0 0
0
1 0
h k 1
cos sin 0
sin cos 0
0
0 1
1 0 0
0 1 0
h k 1
cos
sin
0
= sin
cos
0
(1 cos).h+k.sin (1 cos).k h.sin 1
-------(23)
21
Transformations
A x1
[A B C ] = B x2
C x3
y1 1
0 0 1
y2 1 = 1 1 1
5 2 1
y3 1
From equation (23), a rotation matrix RQ, A about a given arbitrary point A (h, k) is:
0
Cos
Sin
Sin
0
Rq , A =
Cos
(1 Cos ). h + k . Sin (1 Cos ). k h . Sin 1
Thus R45 o ,
2 /2
A= 2 / 2
2 / 2 0
2 / 2 0
2 1 1
So the new coordinates [A B C ] of the rotated triangle [ABC] can be found as:
[A B C ] = [ABC] .
R45 o , A =
A
2 1
1
1
B
2 2 1 1
1
C 3 2 1 9 . 2 1 1
2
2 /2
2 / 2
0 0 1
1 1 1 .
5 2 1
2 / 2 0
2 / 2 0 =
2 1 1
9
3
2 1 ), B = 1, 2 2 1 , and C =
2 1,
2 1 . The
2
2
following figure (a) and (b) shows a given triangle, before and after the rotation.
Thus, A = ( 1,
C (5, 2)
B (1, 1)
1
A
4 5
6
Figure (a)
2
1
1
3
4 5
Figure (b)
22
Let the line L be represented by y=mx+c, where m is the slope with respect to the x
axis, and c is the intercept on y-axis, as shown in Figure 7. Let P(x,y) be the
mirror reflection about the line L of point P(x,y).
Y
L
Y = mx + c
(O, C)
L
Figure 7
The transformation about mirror reflection about this line L consists of the following
basic transformations:
1)
2)
3)
4)
5)
Translate the intersection point A(0,c) to the origin, this shifts the line L to L.
Rotate the shifted line L by degrees so that the line L aligns with the x-axis.
Mirror reflection about x-axis.
Rotate the x-axis back by degrees
Translate the origin back to the intercept point (0,c).
1 0 0
0 1 0
0 c 1
cos sin
sin cos
0
0
0
0
1
1 0 0
0 1 0
0 0 1
cos2 sin2
2.cos.sin
0
= 2.sin.cos
sin2 cos2
0
2
2
2.c.sin.cos c.(sin cos )+c 1
where v=0I+cJ
cos sin 0
sin cos 0
0
0
1
1 0 0
0 1 0
0 c 1
----------(24)
Let tan=m, the standard trigonometry yields sin=m/(m2+1) and cos= 1/(m2+1).
Substituting these values for sin and cos in the equation (24), we have:
ML=
0
0
1
------------(25)
Special cases
1) If we put c = 0 and m=tan=0 in the equation (25) then we have the reflection
about the line y = 0 i.e. about x-axis. In matrix form:
1
Mx= 0
0
0
1
0
0
0
1
----------(26)
2) If c = 0 and m=tan= then we have the reflection about the line x=0 i.e. about
y-axis. In matrix form:
1 0 0
My= 0 1 0
---------(27)
0
0 1
23
Transformations
4) To get the mirror reflection about the line y = x, we have to put m=1 and c=0.
In matrix form:
0 1 0
My=x = 1 0 0
-----------(28)
0 0 1
5) Similarly, to get the mirror reflection about the line y = x, we have to put m = 1
and c = 0. In matrix form:
0 1
0
My=-x = 1
0
0
-----------(29)
0
0
1
6) The mirror reflection about the Origin (i.e., an
and passing through the origin).
1
0
Morg =
0 1
0
0
----------(30)
x
mirror
Figure 7(a)
Example 6: Show that two successive reflections about either of the coordinate axes
is equivalent to a single rotation about the coordinate origin.
Solution: Let (x, y) be any object point, as shown in Figure (a). Two successive
reflection of P, either of the coordinate axes, i.e., Reflection about x-axis followed by
reflection about y-axis or vice-versa can be reprosecuted as:
(x, y)
(x, y)
Mx
(x, y)
My
----(i)
A
.P(x, y)
(x, y)
(x, y)
My
(x, y)
Mx
----(ii)
Figure (a)
The effect of (1) and (2) can also be illustrated by the following Figure (b) and
E
Figure (c)
D
P
B
C
P
D
A
E
24
Figure (b)
P
D
E
E
A
A
P
P
B
B
C
Figure (c)
(x, y)
( x, y) = (x, y)
(iii)
0 1
Equation (3) is the required reflection about the origin. Hence, two successive
reflections about either of the coordinate axes is just equivalent to a single rotation
about the coordinate origin.
Example 7: Find the transforation matrix for the reflection about the line y = x.
Solution: The transformation for mirror reflection about the line y = x, consists of the
following three basic transformations.
L
y=x
45
Figure (a)
0 .
1
1 0 0
0 1 0 .
0 0 1
o
o
Sin 45 Cos 45
0
0
0
1
25
Transformations
0
0
1
Cos 90 Sin 90 0
1 0 0
= Sin 90 Cos 90 0 = 0 0 0 = My = x
0
0 0 1
0
1
Cos 45o Sin 45o
0
1
ML= T-v.R-.Mx.R.T-v ,
where v=0I+2J
1 0 0
= 0 1 0
0 4 1
So the new coordinates ABCD of the reflected polygon ABCD can be found
as:
[ABCD]=[ABCD]. ML
=
1
0
1
0
0 1
2 1
0 1
2 1
1 0 0
. 0 1 0 =
0 4 1
1
0
1
0
4
6
4
2
1
1
1
1
where v=2I
=
1 0 0
0 1 0
4 0 1
So the new coordinates ABCD of the reflected polygon ABCD can be found
as:
[ABCD]=[ABCD]. ML
=
1 0
0 2
1 0
0 2
1
1
1
1
1 0 0
0 1 0
4 0 1
5 0 1
4 2 1
3 0 1
4 2 1
26
c) The line y=x+2 has an intercept (0,2) on y-axis and makes an angle of 450 with
the x-axis. So m=tan450=1 and c=2. Thus, the reflection matrix
ML=
0 1 0
1 0 0
2 2 1
0 2
1 0
0 2
1
1
0 1 0
1 0 0 .
2 2 1
4
2
1
2
3
2
1
1
C
O
O
B
Figure (a)
Figure (b)
D
B
C
D
A
O
O
B
Figure (c)
Figure (d)
27
Transformations
Thus, (2,3,6) and (4,6,12) are the same points are represented by different coordinate
triples, i.e., each point has many different Homogeneous Coordinate representation.
2-D Euclidian System
Any point (x,y)
(x,y,H)
Now, we are in the position to construct the matrix form for the translation with the
use of homogeneous coordinates.
For translation transformation (x,y)(x+tx,y+ty) in Euclidian system, where tx and ty
are the translation factor in x and y direction, respectively. Unfortunately, this way of
describing translation does not use a matrix, so it cannot be combined with other
transformations by simple matrix multiplication. Such a combination would be
desirable; for example, we have seen that rotation about an arbitrary point can be done
by a translation, a rotation, and another translation. We would like to be able to
combine these three transformations into a single transformation for the sake of
efficiency and elegance. One way of doing this is to use homogeneous coordinates. In
homogeneous coordinates we use 3x3 matrices instead of 2x2, introducing an
additional dummy coordinate H. Instead of (x,y), each point is represented by a triple
(x,y,H) such that H0; In two dimensions the value of H is usually kept at 1 for
simplicity.
Thus, in HCS (x,y,1) (x+tx,y+ty,1), now, we can express this in matrix form as:
(x,y,1)=(x,y,1)
1 0
0 1
tx ty
0
0
1
The advantage of introducing the matrix form of translation is that it simplifies the
operations on complex objects, i.e., we can now build complex transformations by
multiplying the basic matrix transformations.
In other words, we can say, that a sequence of transformation matrices can be
concatenated into a single matrix. This is an effective procedure as it reduces the
computation because instead of applying initial coordinate position of an object to
each transformation matrix, we can obtain the final transformed position of an object
by applying composite matrix to the initial coordinate position of an object. Matrix
representation is standard method of implementing transformations in computer
graphics.
Thus, from the point of view of matrix multiplication, with the matrix of translation,
the other basic transformations such as scaling, rotation, reflection, etc., can also be
expressed as 3x3 homogeneous coordinate matrices. This can be accomplished by
augmenting the 2x2 matrices with a third row (0,0,x) and a third column. That is
0
0
1
28
a b 0
c d 0
0 0 1
Example 9: Show that the order in which transformations are performed is important
by applying the transformation of the triangle ABC by:
(i) Rotating by 45o about the origin and then translating in the direction of the vector
(1,0), and
(ii) Translating first in the direction of the vector (1,0), and then rotating by 45o about
the origin, where A = (1, 0) B = (0 ,1) and C = (1, 1).
Solution: We can represent the given triangle, as shown in Figure (a), in terms of
Homogeneous coordinates as:
1 0 1
[ABC] = 0 1 1
1 1 1
C (1,1)
A
Figure (a)
Suppose the rotation is made in the counter clockwise direction. Then, the
transformation matrix for rotation, R 45o , in terms of homogeneous coordinate system
is given by:
R 45o
0
0
1 / 2 1 / 2 0
0
0 = 1 / 2 1 / 2 0
0
0 1
1
Tv = 0 1 0 = 0 1 0
t x t y 1
1 0 0
. Tv = 1 / 2 1 / 2 0 . 0 1 0 = 1 / 2 1 / 2 0
0
1
1 0 1
0 1
0 1
= 0 1 1 . 1 / 2 1 / 2 0 =
1
1 1 1
0 1
1 / 2 +1
1 / 2 + 1
1/ 2
1/ 2
2
1
1
(I)
implies that the given triangle A(1,0), B (0, 1) C (1, 1) be transformed into
1
1
1
1
and C 1, 2 , respectively, as shown in
, B
+ 1,
A
+ 1,
2
2
2
2
Figure (b).
29
Transformations
C
A
Figure (b)
Tv . R 45o
1 / 2 1 / 2 0
1 0 0 1 / 2 1 / 2 0
0 1 0 . 1 / 2 1 / 2 0 = 1 / 2 1 / 2 0
1 / 2 1 / 2 1
1 0 1 0
0 1
0 1 1 . 1 / 2 1 / 2 0 = 0
2 / 2 1
1 1 1 1 / 2 1 / 2 1 1 / 2 3 / 2 1
(II)
Thus, in this case, the given triangle A(1,0), B(0, 1) and C(1,1) are transformed into
) (
3
1
,
A 2 / 2, 2 / 2 , B 0, 2 / 2 and C
, respectively, as shown in
2
2
Figure (c).
C
B
Figure (c)
By (I) and (II), we see that the two transformations do not commute.
30
3) Obtain the transformation matrix for mirror reflection with respect to the line
y=ax, where a is a constant.
4) Obtain the mirror reflection of the triangle formed by the vertices A(0,3),B(2,0)
and C(3,2) about the line passing through the points (1,3) and (1, 1).
31
Transformations
[T]=
b
e
h
m
c w
f
x
I
y
n z
(3x3)
(3x1)
--------(31)
(1x3)
(1x1)
The upper left (3x3) sub matrix produces scaling, shearing, rotation and reflection
transformation. The lower left (1x3) sub matrix produces translation, and the upper
right (3x1) sub matrix produces a perspective transformation, which we will study in
the next unit. The final lower right-hand (1x1) sub matrix produces overall scaling.
z
(x + tx, y + ty, z + tz)
P (x, y, z)
v'
P (x, y, z)
y
Figure 8
1
0
0
tx
0
1
0
ty
0
0
1
tz
0
0
0
1
i.e., Ph = Ph.Tv
--------(33)
----------(34)
32
Rotation about z-axis is defined by the xy-plane. Let a 3-D point P(x,y,z) be rotated to
P(x,y,z) with angle of rotation see Figure 9. Since both P and P lies on xy-plane
i.e., z=0 plane their z components remains the same, that is z=z=0.
Z
Y
P(x, y, z)
P(x, y, o)
P(x, y, z)
P(x, y, o)
Figure 9
Figure 10
----------(35)
In matrix form,
cos sin
(xy,z)=(x,y,z) sin cos
0
0
0
0
1
----------(36)
0
0
0
1
----------(37)
---------(38)
33
Transformations
[Rz]=
x= x.cos-y.sin
y= xsin+ycos
z=z
[Rx]=
y= y.cos-z.sin
z= y.sin+z.cos
x= x
--------(39)
1
0
0
0
0 cos sin 0
0 sin cos 0
0
0
0
1
-------(40)
y= y.cos-z.sin
z= y.sin+z.cos
x= x
After cyclic interchange of xyzx
[Ry]=
z= z.cos-x.sin
x= z.sin+x.cos
y= y
-------(41)
cos
0
sin
0
0 sin
1
0
0
cos
0
0
0
0
0
1
-------(42)
34
For any point (x,y,z), we move into (x.sx,y.sy,z.sz), where sx, sy, and sz are the scaling
factors in the x,y, and z-directions respectively.
Thus, scaling with respect to origin is given by:
Ssx,sy,sz =
x= x.sx
y= y.sy
z= z.sz
---------(43)
In matrix form,
(xy,z)=(x,y,z)
sx
0
0
0
sy
0
0
0
sz
---------(44)
sx
0
0
0
0
sy
0
0
0 0
0 0
sz 0
0 1
--------(45)
x=x+a.y+b.z
y=y+c.x+d.z
z=z+e.x+f.y
--------(46)
where a,b,c,d,e and f are the shearing factors in the respective directions.
In terms of HCS, equation (46) becomes
(xy,z,1)=(x,y,z,1)
1 c e
a 1 f
b d 1
0 0 0
0
0
0
1
-------(47)
Note that the off-diagonal terms in the upper left 3x3 sub matrix of the generalized
4x4 transformation matrix in equation (31) produce shear in three dimensions.
35
Transformations
Let P(x,y,z) be the object point, whose mirror reflection is to be obtained about xyplane(or z=0 plane). For the mirror reflection of P about xy-plane, only there is a
change in the sign of z-coordinate, as shown in Figure (11). That is,
Mxy =
x=x
y=y
z=-z
-------(48)
P(x, y, z)
In matrix form,
Z = 0 plane
X
P
P(x, y, z)
Figure 11
(xy,z)=(x,y,z)
1
0
0
0
1
0
0
0
-1
----(49)
(xy,z,1)=(x,y,z,1)
0 0 0
1 0 0
0 -1 0
0
0 1
-----(50)
Similarly, the mirror reflection about yz plane shown in Figure 12 can be represented
as:
Myz =
x=-x
y=y
z=z
-----(51)
Z
P(x, y, z)
P (x, y, z)
X
Figure 12
In matrix form,
(xy,z)=(x,y,z)
1
0
0
0
1
0
0
0
1
------(52)
36
1
0
0
0
0
1
0
0
0 0
0 0
1 0
0 1
------(53)
and similarly, the reflection about xz plane, shown in Figure 13, can be presented as:
x=x
y= y
-------(54)
Mxz =
z=z
In matrix form,
(xy,z)=(x,y,z)
1 0
0 1
0 0
0
0
1
-------(55)
P (x, y, z)
1 0
0 1
0 0
0 0
1.6
0 0
0 0
1 0
0 1
--------(56)
Figure 13
SUMMARY
Transformations
1.7
SOLUTIONS/ANSWERS
1 0 0
(x , y , 1) = (x, y,1) 0 1 0
t x t y 1
The advantage of introducing the matrix form for translation is that we can now
build a complex transformation by multiplying the basic matrix transformation.
This is an effective procedure as it reduces the computations.
2) The translation factor, tx and ty can be obtained from new old coordinates of vertex
C.
tx = 6 1 = 5
ty = 7 1 = 6
The new coordinates [A B C D] = [A B C D] . Tv
A x 1 y1 1
0 0 1
5 6
1 0 0
5 7
B x 2 y 2 1
0 1 1
=
. 0 1 0 =
1 1 1
6 7
C x 3 y 3 1
5 6 1
D x 4 y 4 1
1 0 1
6 6
Thus A = (5, 6), B = (5, 7), C = (6, 7) and D = (6, 6)
1
1
1
Cos 45 o
(x , y,1) = (x, y,1) Sin 45 o
1
(x y ),
=
2
1
2
(x + y, 1) =
Sin 45 o 0
Cos 45 o 0 = (x , y, 1)
0
1
(0, 6 /
1 / 2 1 / 2 0
1 / 2 1 / 2 0
0
0 1
2, 1
Now, this point Pis again translated by tx = 5 and ty = 6. So the final coordinate
P of a given point P, can be obtained as:
1 0 0
(x , y, 1) = (x , y , 1) . 0 1 0
5 6 1
38
1 0 0
6
+ 6, 1
0, 6 / 2,1 . 0 1 0 = 5,
6
5 6 1
Cos Sin
R =
Sin Cos
6
2
+ 6)
Cos( ) Sin ( )
Cos Sin
=
R =
Sin ( ) Cos()
Sin Cos
0
= Identity matrix
1
a 0
,
2) S a,b =
0 b
since
c 0
and S ac,bd =
Sc,d =
0 d
a.c 0
0 b.d
a 0 c 0 a.c 0
.
=
(1)
Sa,b. Sc,d =
b.d
0 b 0 d 0
c 0 a 0
=
.
and Sc,d. Sa,b =
0 d 0 b
c.a 0
(2)
0 d.b
S = 0 1 0
3 0 1
39
Transformations
0
(Sx + 2)
S = 0
(Sy 1)
0
0
0 S=
1
1 0 0 1 0 0
0 1 0 0 1 0 =
0 2 1 0 1 1
1 0 0
0 1 0
0 1 1
S = 0
1
0
4 2 / 3 1
4)
Sx
SSx, Sy =
0
0
cos
and R =
sin
Sy
sin
cos
o cos
.
Sy sin
cos
and R. SSx,Sy =
sin
sin
.
cos
Sx.cos
S y .sin
o cos .Sx
=
Sy S x .Sin
sin
=
cos
Sx
S x .sin
(1)
Sy.cos
Sin .S y
(2)
cos .Sy
5) No, since
and
b
1 o 1 b 1
.
=
Shxy (a, b) =
a 1
(1)
(2)
o
o
Sin 90 Cos 90 1 0
40
0 1 1 0
1 0
Hence, a reflection about the line y = x, is equivalent to a reflection relative to the
x-axis followed by a counter clockwise rotation of 90o.
2) The required single (3 x 3) homogeneous transformation matrix can be obtained
as follows:
a)
b)
T = S2,2 . Ttx-1, ty =
T= S
3
sx + , sy
2
2 0 0
1 0 0
2 0 0
0 2 0 . 0 1 0 = 0 2 0
0 0 1
1 0 1
1 0 1
o
o
3/ 2 0 0 Cos 90 Sin 90 0
. R 90o
3/ 2 0 0 0 1 0 0 3/ 2
= 0 1 0 . 1 0 0 = 1 0
0 0 1 0 0 1 0 0
c)
T = R90o . S
3
Sx + , S y
2
0
0
1
Cos90o Sin90o 0 3/ 2 0 0
= Sin90o Cos90o 0 . 0 1 0
0
0
1 0 0 1
0 1 0 3/ 2 0 0
= 1 0 0 . 0 1 0
0 0 1 0 0 1
0 1 0
= 3/ 2 0 0
0 0 1
T = T 1 1 . R45o = 0
tx , t y +
1
2
2
0 0 1/ 2 1/ 2 0
1 0 . 1/ 2 1/ 2 0
1 1 0
0 1
1/ 2 1/ 2 0
1/ 2 1/ 2 0
0 1
1 2
41
Transformations
y = ax
2m
m2 + 1
m2 1
m2 + 1
2C
m2 + 1
0 where m = tan
1 a 2
2a
2
2
a + 1 a 2 + 1 0
2.a a 1
0 where a = tan = m
M L = M y =ax = 2
a +1 a 2 +1
1
0
4) The equation of the line passing through the points (1,3) and (1, 1) is obtained
as:
y = 2x + 1
(1)
y
P2 (1, 3)
L
L
(0, 1)
C (3, 2)
B (2, 0)
P1 (1, 1)
Figure (a)
If is the angle made by the line (1) with the positive x-axis, then
1
2
tan = 2 Cos =
and Sin
2
5
To obtain the reflection about the line (1), the following sequence of transformations
can be performed:
1) Translate the intersection point (0, 1) to the origin, this shift the line L to L
2) Rotate the shifted line L by o (i.e. clockwise), so that the Laligns with the xaxis.
42
= 0 1 0 . 2 / 5 1 / 5 0 . 0 1 0 . 2 / 5 1 / 5 0 . 0 1 0
0 1 1 0
0
1 0 0 1 0
0 1 0 1 1
3 / 5 4 / 5 0
= 4 / 5 3 / 5 0
4 / 5 2 / 5 1
So the new coordinates ABC of the reflected triangle ABC can be found as:
[A B C] = [ABC] . ML
0 3 1 3 / 5 4 / 5 0
8 / 5 11 / 5
= 2 0 1 . 4 / 5 3 / 5 0 = 2 2
3 2 1 4 / 5 2 / 5 1
1 4
1
1
1
11
Thus, A = 8 / 5,
, B = ( 2, 2) and C = (1, 4), which is shown in Figure (b).
5
Y
C
4
3
2
2 1
X
1
Figure (b)
43
Transformations
Introduction
Objectives
Projections
2.2.1 Parallel Projection
2.2.1.1 Orthographic and Oblique Projections
2.2.1.2 Isometric Projections
2.2.2 Perspective Projections
2.3 Summary
2.4 Solutions/Answers
Page Nos.
44
45
45
47
51
61
65
83
84
2.0 INTRODUCTION
In unit 1, we have discussed the geometric transformations such as Translation,
Rotation, Reflection, Scaling and Shearing. Translation, Rotation and Reflection
transformations are used to manipulate the given object, whereas Scaling and
Shearing transformations are used to modify the shape of an object, either in 2-D or in
3-Dimensional.
A transformation which maps 3-D objects onto 2-D screen, we are going to call it
Projections. We have two types of Projections namely, Perspective projection and
Parallel projection. This categorisation is based on the fact whether rays coming from
the object converge at the centre of projection or not. If, the rays coming from the
object converge at the centre of projection, then this projection is known as
Perspective projection, otherwise it is Parallel projection. In the case of parallel
projection the rays from an object converge at infinity, unlike perspective projection
where the rays from an object converge at a finite distance (called COP).
Parallel projection is further categorised into Orthographic and Oblique projection.
Parallel projection can be categorized according to the angle that the direction of
projection makes with the projection plane If the direction of projection of rays is
perpendicular to the projection plane then this parallel projection is known as
Orthographic projection and if the direction of projection of rays is not perpendicular
to the projection plane then this parallel projection is known as Oblique projection.
The orthographic (perpendicular) projection shows only the front face of the given
object, which includes only two dimensions: length and width. The oblique projection,
on the other hand, shows the front surface and the top surface, which includes three
dimensions: length, width, and height. Therefore, an oblique projection is one way to
show all three dimensions of an object in a single view.
Isometric projection is the most frequently used type of axonometric projection,
which is a method used to show an object in all three dimensions (length, width, and
height) in a single view. Axonometric projection is a form of orthographic projection
in which the projectors are always perpendicular to the plane of projection.
44
Viewing
Transformations
2.1 OBJECTIVES
After going through this unit, you should be able to:
define the projection;
categorize various types of Perspective and Parallel projections;
develop the general transformation matrix for parallel projection;
describe and develop the transformation for Orthographic and oblique parallel
projections;
develop the transformations for multiview (front, right, top, rear, left and bottom
view) projections;
define the foreshortening factor and categorize the oblique projection on the basis
of foreshortening factors;
derive the transformations for general perspective projection;
describe and derive the projection matrix for single-point, two-point and threepoint perspective transformations, and
identify the vanishing points.
2.2 PROJECTIONS
.
Given a 3-D object in a space, Projection can be defined as a mapping of 3-D object
onto 2-D viewing screen. Here, 2-D screen is known as Plane of projection or view
plane, which constitutes the display surface. The mapping is determined by projection
rays called the projectors. Geometric projections of objects are formed by the
intersection of lines (called projectors) with a plane called plane of projection /view
plane. Projectors are lines from an arbitrary point, called the centre of projection
(COP), through each point in an object. Figure 1 shows a mapping of point P(x,y,z)
onto its image P(x,y,z) in the view plane.
y
P(x, y, z)
P(x,y,z)
Projector
z
Figure 1
If, the COP (Center of projection) is located at finite point in the three-space, the
result is a perspective projection. If the COP is located at infinity, all the projectors are
parallel and the result is a parallel projection. Figure 2(a)-(b) shows the difference
between parallel and perspective projections. In Figure 2(a), ABCD is projected to
ABCD on the plane of projection and O is a COP. In the case of parallel
projection the rays from an object converges at infinity, the rays from the object
become parallel and will have a direction called direction of projection.
45
Transformations
Taxonomy of Projection
There are various types of projections according to the view that is desired. The
following Figure 3 shows taxonomy of the families of Perspective and Parallel
Projections. This categorisation is based on whether the rays from the object converge
at COP or not and whether the rays intersect the projection plane perpendicularly or
not. The former condition separates the perspective projection from the parallel
projection and the latter condition separates the Orthographic projection from the
Oblique projection.
46
Viewing
Transformations
Projection
Single-point
Two-point
Three-point
Top
Bottom
Left-Side
Isometric
Cavalier
Diametric
Cabinet
Trimetric
The direction of rays is very important only in the case of Parallel projection. On the
other hand, for Perspective projection, the rays converging at the COP, they do not
have a fixed direction i.e., each ray intersects the projection plane with a different
angle. For Perspective projection the direction of viewing is important as this only
determines the occurrence of a vanishing point.
47
Transformations
View plane
y
d = (d1, d2, d3)
Rays from the object intersect the plane before passing through COP. In parallel
projection, image points are found as the intersection of view plane with a projector
(rays) drawn from the object point and having a fixed direction.(see Figure 5).
Direction of projection
d
P1 (x,y,z)
P,(x,y,z)
P2
P2
z
Parallel rays from the object may be perpendicular or may not be perpendicular to the
projection plane. If the direction of projection d=(d1,d2,d3) of the rays is
perpendicular to the projection plane (or d has the same direction as the view plane
normal N), we have Orthographic projection otherwise Oblique projection.
Orthographic projection is further divided into Multiview projection and axonometric
projection, depending on whether the direction of projection of rays is parallel to any
of the principal axes or not. If the direction of projection is parallel to any of the
principal axes then this produces the front, top and side views of a given object, also
referred to as multiview drawing (see Figure 8).
Axonometric projections are orthographic projection in which the direction of
projection is not parallel to any of the 3 principle axes. Oblique projections are nonorthographic parallel projections i.e., if the direction of projection d=(d1,d2,d3) is not
perpendicular to the projection plane then the parallel projection is called an Oblique
projection.
48
Viewing
Transformations
x ' = x
y ' = y
z ' = 0
In matrix form:
0
Ppar,z =
0
0 0 0
1 0 0
------------------------------(1)
0 0 0
0 0 1
Thus, if P(x,y,z) be any object point in space, then projected point P(xyz) can be
obtained as:
0
(x,y,z, 1) = (x, y, z, 1)
0
0 0 0
1 0 0
0 0 0
0 0 1
Ph =Ph.Ppar,z
------------------------------(2)
------------------------------(3)
Example1: Derive the general transformation of parallel projection onto the xy-plane
in the direction of projection d=aI+bJ+cK.
Solution: The general transformation of parallel projection onto the xy-plane in the
direction of projection d=aI+bJ+cK, is derived as follows(see Figure a):
Let P(x,y,z) be an object point, projected to P(x,y,z) onto the z=0 plane.
From Figure (a) we see that the vectors d and PP have the same direction.
This means that
PP=k.d , comparing components, we have:
x-x=k.a
y-y=k.b
z-z=k.c
0
x
y
P (x, y, 0)
Figure (a)
49
Transformations
0
1
1
0
(x,y,z1) = (x, y, z, 1)
a/c b/c
0
0
0
0
0
0
0
0
------------------------------(4)
That is, Ph =Ph.Ppar,z , where Ppar,z is the parallel projection with the direction of
projection d along the unit vector k.
Example 2: Derive the general transformation for parallel projection onto a given
view plane, where the direction of projection d=aI+bJ+cK is along the normal
N=n1I+n2J+n3K with the reference point R0(x0,y0,z0).
Solution: The general transformation for parallel projection onto the xy-plane in the
direction of projection Figure (b)
v = a I + bJ + ck, denoted by P par, V, N, Ro, consists of the following steps:
1) Translate the view reference point Ro of the view plane to the origin, by T-Ro
2) Perform an alignment transformation An so that the view normal vector N of the
view points in the direction K of the normal to the xy-plane. The direction of
projection vector V is transformed to new vector V = AnV.
3) Project onto the xy-plane using P par, v
4) Align k back to N, using An.
5) Translate the origin back to Ro, by TRo
z
k
View plane
V = aI +bJ +ck
P(x,y,z)
R0 (x0, y0, z0)
P(x,y,z)
Figure (b)
So
Ppar, V, N, Ro = TRo AN1 . Ppar, v. An. TRo
50
1
0
0
x0
0
1
0
y0
0
0
1
z0
0
0
n1
N
n 1n 2
N
n3
n2
N
0
n1n 3
n2
n3
N
0
a
c
a
c
0
b
c
0
0
0
|N|
n1n2
|N|
n1n3
| N|
n3
n2
|N|
0
n2
|N|
n2
|N|
n3
|N|
0
Viewing
Transformations
0
0
1
0
x0
y0
0 0
1 0
z0 1
0
where =
d1 an1
an2
P par, V, N, R0 =
an3
ad 0
bn1
cn1
d1 bn 2
cn2
bn3
d1 cn3
bd 0
c.do
0
---------------------------(5)
0
d1
Where d0 = n1 x0 + n2 y0 + n3 z0 and
d1 = n1a + n2b + n3c
Note: Alignment transformation, An, refer any book for computer graphic.
51
Transformations
Orthographic projections are projections onto one of the coordinate planes x=0, y=0or
z=0. The matrix for orthographic projection onto the z=0 plane (i.e. xy-plane) is:
0
Ppar,z =
0
0
1
0
0
0
0
0
0
0
------------------------------(6)
0
Note that the z-column (third column) in this matrix is all zeros. That is for
orthographic projection onto the z=0 plane, the z-coordinates of a position vector is
set to zero. Similarly, we can also obtain the matrices for orthographic projection onto
the x=0 and y=0 planes as:
0
Ppar,x =
0
0
1
0
0
0
0
1
0
0
------------------------------(7)
0
0
0
0
0
0
0
1
0
0
------------------------------(8)
0
and
0
Ppar,y =
0
For example, consider the object given in Figure 6(a). The orthographic projections of
this object onto the x=0, y=0 and z=0 planes from COP at infinity on the +x-, +y- and
+z-axes are shown in Figure 7 (b)-(d).
y
x
x
z
Figure 7(a)
Figure 7(b)
Figure 7(c)
52
Figure 7(d)
Viewing
Transformations
Front view
Right-side view
Top-view
Rear view
Left-side view
Bottom view
The front, right-side and top views are obtained by projection onto the z=0, x=0 and
y=0 planes from COP at infinity on the +z-, +x-, and +y-axes.
The rear, left-side and bottom view projections are obtained by projection onto the
z=0, x=0, y=0 planes from COP at infinity on the z-, -x and y-axes(see Figure 8).
All six views are normally not required to convey the shape of an object. The front,
top and right-side views are most frequently used.
The direction of projection of rays is shown by arrows in Figure 9.
+y
Top
z
rear
Left-side
right-side
front
53
Transformations
The projection matrices for the front, the right-side and top views are given by:
Pfront = Ppar,z=diag(1,1,0,1)
Pright = Ppar,x=diag(0,1,1,1)
Ptop = Ppar,y=diag(1,0,1,1)
It is important to note that the other remaining views can be obtained by combinations
of reflection, rotation and translation followed by projection onto the z=0 plane from
the COP at infinity on the +z-axis. For example: the rear view is obtained by
reflection through the z=0 plane, followed by projection onto the z=0 plane.
Prear=Mxy. Ppar,z
0
=
0
0 0
1 0
0 1
0 0
0
0
0
0
0
1
0
0
0
0
0
0
0
1 0
0
0 1
=
0
0 0
0 0
1
0
0
0
0
0
-------------------------(9)
0
Similarly, the left-side view is obtained by rotation about the y-axis by +900, followed
by projection onto the z=0 plane.
Pleft=[Ry] 900.Ppar,z
cos 90
0
=
sin 90
0 sin 90
1
0
0 cos 90
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
=
0
0
1
0
1
0
0
0
0
0
0
0
------------------(10)
0
And the bottom view is obtained by rotation about the x-axis by -900, followed by
projection onto the z=0 plane.
Pbottom=[Rx] 900.Ppar,z
0
0
1
0
0
0
0 1 0
0 0 1
0 0 0
1 0 0
0
0
0
0
0 1 0
0 0 0
=
0 0 1
1 0 0
0
0
0
0
0
-----------(11)
0
Example 3: Show all the six views of a given object shown in following Figure. The
vertices of the object are A(4,0,0), B(4,4,0), C(4,4,8), D(4, 0, 4), E (0,0,0), F(0,4,0),
G(0,4,8), H(0,0,4).
Solution: We can represent the given object in terms of Homogeneous-coordinates of
its vertices as:
A 4 0 0 1
B
F
B 4 4 0 1
C 4 4 8 1
C
G
D 4 0 4 1
V= [ABCDEFGH] =
E 0 0 0 1
A
x
F 0 4 0 1
E
G 0 4 8 1
H 0 0 4 1
H
54
D
Figure (c)
(1) If we are viewing from the front, then the new coordinate of a given object can be
found as:
Viewing
Transformations
A'
B'
C'
D'
E'
F'
G'
H'
x '1
x '2
x '3
x '4
x '5
x '6
x '7
x '8
1
1
1
=
1
1
1
1
y '1
y '2
y '3
y '4
y '5
y '6
y '7
y '8
4
4
0
0
0
0
1
1 1
1 0
.
1 0
4 8 1 0
4 8 1
0 4 1
0
4
4
0
0
0
0
8
4
0
A' 4
B' 4
0 0 C' 4
0 0 D' 4
=
0 0 E' 0
0 1 F' 0
G' 0
H' 0
0
1
0
0
0
4
4
0
0
4
4
0
0
0
0
0
0
0
0
0
1
1
1
1
1
D
Figure d
A
B
C
D
Pn,x = V. Pright =
E
F
G
H
4
4
4
0
0
0
0
4
4
0
0
4
4
0
1
1
1
.
1
1
1
1
0
0
8
4
0
0
0
4
0
0
0
1
0
0
A' 0
B' 0
0 0 C' 0
0 0 D 0
=
1 0 E' 0
0 1 F' 0
G' 0
H' 0
0
4
4
0
0
4
4
0
0
0
8
4
0
0
8
4
1
1
1
1
1
1
1
z
A
Figure e
55
Transformations
4
4
4
0
0
G 0
H 0
A
B
C
D
Pn,y = Pn. Ptop =
E
F
0
4
4
0
0
4
4
0
0
0
8
4
0
0
8
4
1
1
1 1
1 0
.
1 0
1 0
1
0
0
0
0
A' 4
B' 4
0 0 C' 4
0 0 D' 4
=
1 0 E' 0
0 1 F' 0
G' 0
H' 0
0
0
0
0
0
0
0
0
0
0
8
4
0
0
8
4
1
1
1
1
1
1
1
x
F
Figure f
Similarly we can also find out the other side views like, rear left-side and bottom
using equation 1, 2, 3
56
Viewing
Transformations
3) In orthographic projection
a) Rays intersect the projection plane.
b) The parallel rays intersect the view plane not perpendicularly.
c) The parallel rays intersect the view plane perpendicularly.
d) none of these
Oblique projection
If the direction of projection d=(d1,d2,d3) of the rays is not perpendicular to the view
plane(or d does not have the same direction as the view plane normal N), then the
parallel projection is called an Oblique projection (see Figure 10).
y
Direction of projection
Direction of projection
d
d = (d1 , d 2 , d 3 )
view plane
A
B
view plane
z
N
x
In oblique projection only the faces of the object parallel to the view plane are shown
at their true size and shape, angles and lengths are preserved for these faces only.
Faces not parallel to the view plane are discarded.
In Oblique projection the line perpendicular to the projection plane are foreshortened
(shorter in length of actual lines) by the direction of projection of rays. The direction
of projection of rays determines the amount of foreshortening. The change in length of
the projected line (due to the direction of projection of rays) is measured in terms of
foreshortening factor, f.
Foreshortening factors w.r.t. a given direction
Let AB and CD are two given line segments and direction of projection d=(d1,d2,d3).
Also assumed that ABCDd . Under parallel projection, let AB and CD be
projected to AB and CD, respectively.
Observation:
i) ABCD will be true, i.e. Parallel lines are projected to parallel lines, under
parallel projection.
ii) |AB| |AB| |CD| |CD| must be true, under parallel projection.
This ratio (projected length of a line to its true length) is called the foreshortening
factor w.r.t. a given direction.
57
Transformations
In order to develop the transformation for the oblique projection, consider the
Figure 10. This figure shows an oblique projection of the point A (0, 0, 1) to position
A(x,y,0) on the view plane (z=0 plane). The direction of projection d=(d1,d2,d3).
Oblique projections (to xy-plane) can be specified by a number f and an angle . The
number f, known as foreshortening factor, indicates the ratio of projected length
OAof a line to its true length. Any line L perpendicular to the xy-plane will be
foreshortened after projection.
is the angle which the projected line OA(of a given line L perpendicular to xyplane) makes with the positive x-axis.
The line OA is projected to OA. The length of the projected line from the origin
=|OA|
z
A (0, 0, 1)
d = (d1, d2, d3)
y'
y
x'
A = (x, y, 0)
0
1
1
0
Pcav =
1/ 2 1/ 2
0
0
0
0
0
0
0
0
Pcab =
Viewing
Transformations
0 0
0 0
3 / 4 1/ 4 0 0
0
0 0 1
1
0
0
1
0
1
0
0
0
G 1
H 1
A
B
C
D
vertices as:V = [A B C D E F G H] =
E
F
0
0
1
1
1
0
0
1
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
i) To draw the cavalier projection, we find the image coordinates of a given unit cube
as follows:
P = V. Pcav =
A 0
B 1
C 1
D 0
0
0
1
1
E 0 1
F 0 0
G 1 0
H 1 1
A'
0
0
1
0
B'
1
1
C'
0
0 0
0
1
D'
1
0 0
=
.
2
1 1 1 / 2 1 / 2 0 0
E' 2 / 2 (1 +
2
1 1 0
0
0 1
F' 2 / 2
2/2
1 1
G' (1 + 2 / 2
2/2
1 1
H' (1 + 2 / 2 (1 + 2 / 2
0
0
0
0
1
1
1 1
1 0
0 1
0 1
0 1
0
0
0
0
0
H
C
F
A
B
1
Figure 11(a)
59
Transformations
To determine projection matrix for oblique projection, we need to find the direction
vector d. Since vector PPand vector d have the same direction. Thus, PP=d
Thus, x 0=d1= f.cos
y 0=d2= f.sin
z1=d3
As z=0 on the xy-plane, d3 = 1,
Since, Oblique projection is a special case of parallel projection, thus, we can
transform the general transformation of parallel projection for Oblique projection as
follows:
POblique =
d /d
1 3
0
1
d2 / d3
0
0
0
0
0
0 1
0 0
=
0 f . cos
0 0
0
1
f . sin
0
0
0
0
0
0
-----------------(12)
0
Where, f=foreshortening factor, i.e., the projected length of the z-axis unit vector.
If is the angle
Between the Oblique projectors and the plane of projection then,
1/f=tan () , i.e., f= cot() ------------- (13)
=angle between the projected line with the positive x-axis.
Special cases:
1) If f=0, then cot ()=0 that is =900 , then we have an Orthographic projection.
2) If f=1, the edge perpendicular to projection plane are not foreshortened, then
=cot-1 (1)=450 and this Oblique projection is called Cavalier projection.
3) If f=1/2 (the foreshortening is half of unit vector), then =cot-1 (1/2)=63.4350 and
this Oblique projection is called Cabinet projection.
Note: The common values of are 30 and 45. the values of (180 ) is also
acceptable.
Figure 12: Oblique projections for f=1,7/8,3/4,5/8,1/2, with =450 (from left to right)
Example4: Find the transformation matrix for a) cavalier projection with =450 , and
b) cabinet projection with =300 c) Draw the projection of unit cube for
each transformation.
Solution: We know that cavalier and cabinet projections are a special case of an
oblique projection. The transformation matrix for oblique projection is:
60
0
Pobligue =
f .cos
0
1
f .sin
0
Viewing
Transformations
0
1
0
0
0
0
(ii) To draw the cabinet projection, we find the image coordinates of a unit cube as:
0
3/4
3/4
(1 + 3 / 4)
(1 + 3 / 4)
A'
B'
C'
P V. Pcab =
D'
E'
F'
G'
H'
0 0 1
0 0 1
1
1
0
0 1
5/ 4 0
1/ 4 0
1/ 4 0
5/ 4 0
y
E
H
C
D
F
G
B
x
2
Figure (g)
Transformations
Figure13 shows a cube projected by isometric projection. The cube is angled so that
all of its surfaces make the same angle with the plane of projection. As a result, the
length of each of the edges shown in the projection is somewhat shorter than the
actual length of the edge on the object itself. This reduction is called foreshortening.
Since, all of the surfaces make the angle with the plane of projection, the edges
foreshorten in the same ratio. Therefore, one scale can be used for the entire layout;
hence, the term isometric which literally means the same scale.
d=(d1,d2,d3)
X
Y
Figure 13
Since, the projection, we are looking for is an isometric projection => orthographic
projection, i.e, the plane of projection, should be perpendicular to d, so d = n = (1,1,1).
Also, we assume that the plane of projection is passing through the origin.
We know that the equation of a plane passing through reference point
R(x0,y0,z0) and having a normal N = (n1,n2,n3) is: (x x0).n1 + (y y0).n2 +
-------------------------(14)
(z z0).n3=0
62
1 3 2 3 1 3 0
(x, y, z, 1) = (x, y, z, 1)
1 3 1 3 2 3 0
0
0
0
1
Viewing
Transformations
Note: We can also verify this Isometric transformation matrix by checking all the
foreshortening factors, i.e., to check whether all the foreshortening factors (fx, fy, fz)
are equal or not. Consider the points A,B and C on the coordinate axes (see Figure14).
(0, 1, 0)
(0, 1, 0)
x
z
Figure 14
C
i)
(0, 0, 1)
(2 / 3) 2 +(-1/3)2 +(-1/3)2 =
2 / 3 = fx
------------(16)
ii) Take OB, where O = (0,0,0) and B (0,1,0). Suppose O is projected to O and B is
projected to B. Thus by using equation (15), we have O=(0,0,0) and
B= (-1/3,2/3,-1/3).
So |OB| =
(1 / 3) 2 +(2/3)2 +(-1/3)2 =
2 / 3 = fy
-------------(17)
iii) Take OC, where O=(0,0,0) and C(0,0,1). Suppose O is projected to O and C is
projected to C
Thus, by using equation(15), we have O=(0,0,0) and C=(-1/3,-1/3,2/3).
So |OC|=(-1/3)2 +(-1/3)2 +(2/3)2 = 2/3=fz
--------------(18)
8
10
Figure (h)
63
B
Transformations
A 10
B 10
C 10
D 10
V = [A B C D E F G H] =
E 0
F 0
G 0
H 0
0 0 1
8 0 1
8 6 1
8 6 1
0 0 1
8 0 1
8 6 1
0 6 1
10 8 0 1
10 8 6 1 2 1 1 0
10 0 6 1 1 2 1 0
=
P = V. PISO =
.
0 0 0 1 1 1 2 0
0 8 0 1 0
0
0 3
0 8 6 1
0 0 6 1
A' 20 10 10 3
1
6.66 3.33 3.33
B' 12
18 3
8
2.66 6.0
1
4 .0
2
6 3
2.0
0
0
1
C' 6
2 3
4.66 5.33 0.66`
1
D' 14 16
=
0
0
0
3
0
0 1
E' 0
16 8
3
1.33 1
F' 8
2.66 5.33
4.66 3.33
4
3
1.33 1
G' 14 10
3
4.0
1
H' 6 6 12
2.0 2.0
Thus, by using this matrix, we can draw an isometric view of a given cuboids.
64
Viewing
Transformations
4) Show that for Isometric projection the foreshortening factor along x, y and z-axes
must be 2 / 3 , i.e. fx = fy = fz = 2 / 3
5)
Consider a parallel projection with the plane of projection having the normal
(1,0,1) and passing through the origin O(0,0,0) and having a direction of
projection d = (1,0,0). Is it orthographic projection? Explain your answer with
reason.
6)
Compute the cavalier and cabinet projections with angles of 450 and 300
respectively of a pyramid with a square base of side 4 positioned at the origin in
the xy-plane with a height of 10 along the z-axis.
A
Transformations
Object
Center of
Projection
B
m
-Z
-y
Projection Plane
L2
E
Center of
Projection
Projectors
L1
Figure 15
Figure 16
The infinite lines AB and PQ will be projected to the lines AB and PQ respectively
on the plane of projection. That is all points of the line AB is projected to all points of
the line AB. Similarly all points of the line PQ is projected to all points of the line
PQ. But AB and PQ intersect at M and M is the projection of some point on the
line AB as well as on PQ, but AB PQ, which implies that M is the projection of
point at infinity where AB and PQ meet. In this case M is called a Vanishing point.
A Perspective projection can have at most 3 Principle Vanishing points and at least
one Principle vanishing point.
To understand the effects of a perspective transformation, consider the Figure 17.
This figure shows the perspective transformation on z=0 plane of a given line AB
which is parallel to the z-axis. The A*B* is the projected line of the given line AB in
the z=0 plane. Let a centre of projection be at (0,0,-d) on the z-axis. The Figure (A)
shows that the line AB intersects the z=0 plane at the same point as the line AB. It
also intersects the z-axis at z=+d. It means the perspective transformation has
transformed the intersection point.
Z
B
Initial line
Vanishing Point
A
B
A
B*
A*
Projection plane
d
X
Center of
projection
66
Figure 17
Viewing
Transformations
P (x, y, z)
P(x,y, z)
E (0, 0 d)
z = 0 plane
Figure 18
The parametric equation of a line EP, starting from E and passing through P is:
E+t(P-E) 0<t<
=(0,0,-d)+t[(x,y,z)-(0,0,-d)]
=(0,0,-d)+t(x,y,z+d)
=[t.x, t.y, -d+t.(z+d)]
Point P is obtained, when t=t*
That is, P=(x,y,z) =[t*.x, t*.y, -d+t*.(z+d)]
Since P lies on Z=0 plane implies -d+t*.(z+d)=0 must be true, that is t*=d/(z+d) is
true.
Thus x=t*.x=x.d/(z+d)
y=t*.y=y.d/(z+d)
z=-d+t*(z+d)=0
thus P=( x.d/(z+d), y.d/(z+d), 0)
=(x/((z/d)+1),y/((z/d)+1),0)
in terms of Homogeneous coordinate system P=(x,y,0,(z/d)+1). ---------(5)
The above equation can be written in matrix form as:
0
P(x,y,z,1)=(x,y,z,1)
0
1 0 0
0 0 1/ d
0 0 1
0 0
= [x,y,0,(z/d)+1]
------------(1)
-----------------
(2)
Where Pper,z in equation (4.6) represents the single point perspective transformation
on z-axis.
The Ordinary coordinates are:
[x,y,z,1]=[x/(r.z+1),y/(r.z+1),0,1] where r=1/d
---------------- (3)
67
Transformations
Vanishing Point
The vanishing point is that point at which parallel lines appear to converge and vanish.
A practical example is a long straight railroad track.
To illustrate this concept, consider the Figure 17 which shows a perspective
transformation onto z=0 plane. The Figure17 shows a Projected line A*B* of given
line AB parallel to the z-axis. The center of projection is at (0,0,-d) and z=0 be the
projection plane.
Consider the perspective transformation of the point at infinity on the +z-axis, i.e.,
[0,0,1,0]
0
0
1 0 0
= (0,0,0,1/d) -------------- (4)
0 0 1/ d
0 0 1
0 0
In order to derive the single point perspective transformations along x and y-axes, we
construct Figures (19) and (20) similar to Figure 18, but with the corresponding
COPs at E(-d,0,0) and E(0,-d,0) on the negative x and y-axes respectively.
y
x
P (x,y,z)
P (x,y,z)
P(x,y,z)
P(x,y,z)
x E (d, 0, 0)
E (d, 0, 0)
Figure 19
y
Figure 20
The parametric equation of a line EP, starting from E and passing through P is:
E+t(P-E) 0<t<
=(-d,0,0)+t[(x,y,z)-(-d,0,0)]
=(-d,0,0)+t[x+d,y,z]
=[-d+t.(x+d), t.y, t.z]
Point P is obtained, when t=t*
That is, P=(x,y,z) =[-d+t*.(x+d), t*.y, t*.z]
Since, P lies on X=0 plane implies -d+t*.(x+d)=0 must be true, that is t*=d/(x+d) is
true.
68
Viewing
Transformations
Thus, x=-d+t*(x+d)=0
y=t*.y=y.d/(x+d)
z=t*.z=z.d/(x+d)
thus P=( 0, y.d/(z+d), z.d/(x+d))
=(0,y/((z/d)+1), z/((x/d)+1))
in terms of Homogeneous coordinate system P=(0,y,z,(x/d)+1).
The above equation can be written in matrix form as:
0
P(x,y,z,1)=(x,y,z,1)
0
0 0 1/ d
1 0 0
=[0,y,z,(x/d)+1]
0 1 0
0 0 1
=[0,y/((z/d)+1), z/((x/d)+1),1] -------- (5)
0
P(x,y,z,1)=(x,y,z,1)
0
0 0 1/ d
=[x,0,z,(y/d)+1]
0 1 0
0 0 1
0 0
=[x/((y/d)+1),0, z/((y/d)+1),1]
That is, Ph = Ph.Pper,y -----------------------------(7)
Where Pper,y in equation (5) represents the single point perspective transformation
w.r.t. y-axis.
Thus, the ordinary coordinates(projected point P of a given point P) of a single point
perspective transformation w.r.t. y-axis is:
(x,y,z,1)=[x/((y/d)+1),0, z/((y/d)+1),1] has a center of projection at [0,-d,0,1] and a
vanishing point located on the y-axis at [0,0,0,1].
Example 6: Obtain a transformation matrix for perspective projection for a given
object projected onto x=3 plane as viewed from (5,0,0).
Solution: Plane of projection: x = 3 (given)
Let P (x, y, z) be any point in the space. We know the
Parametric equation of a line AB, starting from A and passing
69
Transformations
through B is
y
Projection plane
P (x,y,z)
P(x,yz)
x
3
E (5, 0, 0)
x = 3 plane
Figure i
2
x5
2.y 2.z
P = (x, y, z) = 3,
,
x 5 x 5
3 x 15 2. y 2.z
,
,
x5 x 5 x5
3 x 15 2. y 2.z
,
,
,1
x5 x5 x5
P = (x, y, z, 1) =
--------------(1)
In Matrix form:
0 0 1
3
0
2 0 0
(x, y, z, 1) = (x, y, z, 1)
-------------- (2)
0
2 0 0
15 0 0 5
70
Thus, equation (2) is the required transformation matrix for perspective view from
(5, 0, 0).
Viewing
Transformations
Example 7: Consider the line segment AB in 3D parallel to the z-axis with end points
A ( 5,4,2) and B (5,-6,18). Perform a perspective projection on the X=0
plane, where the eye is placed at (10,0,10).
Solution: Let P (x, y, z) be any point in the space.
The parametric equation of a line starting from E and passing through P is:
E + t. (P E), o < t < 1.
= (10,0,10) + t. [(x, y, z) (10, 0, 10)]
= (10, 0,10) + t [(x 10)], y (z 10)]
= (t. (x 10) + 10, t. y, t (z 10) + 10)
Assume point P can be obtained, when t = t*
P = (x, y, z) = (t* (x 10) + 10, t*.y, t*. (z 10) + 10)
x=0
plane
p (x, y, z)
P (x, y, z)
x
z
E (10,0,10)
Figure j
= t* (x 10) + 10 = 0
= t* =
10
x 10
= P = (x, y, z) = 0,
,
+ 10
x 10
x 10
x 10
x 10
y
x
z
x
,1 = (0, y, x z,
P = (x, y, z, 1) = 0,
1)
,
x
10
x
1
1
10
10
71
Transformations
In Matrix form
0
0
(x, y, z, 1) = (x, y, z, 1)
0
0
1
0
0
1
0
1
0
1 / 10
0
1
1
------------------(1)
This equation (1) is the required perspective transformation, which gives a coordinates
of a projected point P' (x, y, z) onto the x = 0 plane, when a point p (x, y, z) is
viewed from E (10, 0, 10)
Now, for the given points A (5, 4, 2) and B (5, 6, 18), A and B are their projection
on the x = 0 plane.
Then from Equation (1).
0
0
A = (x1 y1, z1, 1) = ( 5, 4, 2, 1).
0
0
1
0
0
1 1 / 10
0
0
1
0
0 1
5
1)
10
15
= (0, 4, 7,
)
10
(0, 4, 7,
40 70
, , 1)
15 15
Hence x1 = 0 ; y1 = 2.67 ;
similarly
z1 = 4.67
0
0
B = (x2, y2, z2, 1) = (5, 6, 18, 1) .
0
0 1 1 / 10
1
0
0
0 1
0
0
0 1
z2 = 26
Example 8: Consider the line segment AB in Figure k, parallel to the z-axis with end
points A (3, 2, 4) and B (3, 2, 8). Perform a perspective projection onto the z = 0 plane
from the center of projection at E (0, 0, 2). Also find out the vanishing point.
72
Viewing
Transformations
Vanishing Point
(0,0,2)
A
B
A
d=2
B*
A*
d=2
E (0,0, 2)
Figure k
Solution. We know that (from Equation (1)), the center of single point perspective
transformation: of a point P (x, y, z) onto z = 0 plane, where center of projection is at
(0, 0, d) is given by:
0
1 0 0
0 1 0
0
(x, y, z, 1) = (x, y, z, 1) .
0 0 0 1 / d
1
0 0 0
Pn = Pn. Pper,z ------------------------(I)
A*
B*
A*
B*
1
0.6
0.667
0.4
1
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0 0.5
0 1
Transformations
Example 9: Perform a perspective projection onto the z = 0 plane of the unit cube,
shown in Figure (l) from the cop at E (0, 0, 10) on the z-axis.
G
C
z
Figure (l)
1
0
(x,, y, z, 1) = (x, y, z, 1)
0
0
1
0
0
Pn = P. Pper, z
0
0
0
0
-----------(I)
0 1/ d
0
1
--------------- (II)
0
1
0
=
0
1
1
74
0
0
1
1
0
0
1
1
1
1
1
1
0
0
0
0
1
1
1
1
.
1
1
1
1
0
0
1
0
0
0
0
0
0
0 0.1
0
1
0
1
0
V =
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
0 0 1
0.9 A' 0
0 0 1
1 F' 1
1
0 1
1 G' 1
1
0 1
1 H' 0
Viewing
Transformations
2) Consider a cube given in example 4, the cube can be centered on the z-axis by
translating it
1
units in the x y directions perform a single point perspective
2
3) A unit cube is placed at the origin such that its 3-edges are lying along the x, y
and z-axes. The cube is rotated about the y-axis by 30. Obtain the perspective
projection of the cube viewed from (80, 0, 60) on the z = 0 plane.
The 2-point perspective projection can be obtained by rotating about one of the
principal axis only and projecting on X=0 (or Y=0 or Z=0) plane. To discuss the
phenomenon practically consider an example for 3-point perspective projection (given
below) some can be done for 2-point aspect.
75
Transformations
Example 10: Find the principal vanishing points, when the object is first rotated w.r.t.
the y-axis by 30 and x-axis by 45, and projected onto z = 0 plane, with the center
of projection being (0, 0, 5).
Solution: Rotation about the y-axis with angle of rotation
= ( 30) is
cos(30) 0 sin( 30)
[Ry] = [Ry] = 30 =
0
1
0
3 2 0 1/ 2
= 0
1
0
1 / 2 0
3 2
0
0
1
1
1
[Rx] = [Rx]45 = 0
2
2
1
1
0
2
2
3/2 0
1
[Ry].[Rx] = 0
1 / 2 0
1/ 2
0 .
3 / 2
3 / 2 1 / 2 2
= 0
1/ 2
1 / 2 3 / 2 2
0
0
1
0 1 / 2 1 / 2
0 1 / 2 1 / 2
1/ 2 2
1 / 2 -----------------(1)
3 / 2 2
For any point p (x, y, z) from the object, the Equation of the ray starting from E and
passing through the point P is:
E + t (P E), t > 0
i.e.
(0, 0, 5) + t [(x, y, z) (0, 0, 5)]
= (0, 0, 5) + t (x, y, z + 5)
= (t.x, t. y, 5 + t (z + 5)
for this point to be lie on z = 0 plane, we have:
5 + t (z + 5) = 0
t=
5
z +5
P = (x, y, z) =
76
0 0 0
5 0 0
-------------(2)
0 0 1
0 0 5
3 / 2 1/ 2 2
0
1/ 2
[Ry]. [Rx].[P] =
1 2 3 / 2 2
0
0
5 3
0
=
5
2
0
5
2 2
5
2
5 3
2 2
0
0
0
0
0
1/ 2 2
1/ 2
3/2 2
0
1
2 2
1
2
3
2 2
5
5
0
0
.
0
0
5
0
0
0
0
0
0
0
0
1
Viewing
Transformations
----------------(3)
Let (x, y, z) be projected, under the combined transformation (3) to (x, y, z), then
5 3
0
(x, y, z, 1) = (x, y, z, 1)
5
2
0
5
2 2
5
2
5 3
2 2
0
0
0
0
0
2 2
1
2
3
2 2
5
5 3
5
.x .z
2
2
= x =
x
3.z
y
+
+
+ 5
2 2
2 2 2
and
5
5
5 3
.x +
.y
.z
2 2
2
2 2
y =
-----------(4)
x
y
3
+
+
.z + 5
2 2
2 2 2
By considering first row of the matrix (Equation (3)), we can claim that the principal
vanishing point (w.r.t) the x-axis) will be:
i.e.,
5 3 5
2 , 2 2 ,0
1
1
2 2 2 2
(5 6 , 5, 0)
-------------------(I)
In order to varify our claim, consider the line segments AB, CD, which are parallel to
the x-axis, where A = (0, 0, 0), B = (1, 0, 0), C = (1, 1, 0), D = (0, 1, 0)
If A, B, C, D are the projections of A, B, C, D, respectively, under the projection
matrix (3), then
77
Transformations
5
3
, 2 2 ,0
A = (0, 0, 0), B =
1
1
+5
+5
2 2
2 2
5
5
5 3
2 2
2
2
C =
,
,0
1 + 1 + 5 1 + 1 + 5
2 2
2
2
2 2
5/ 2
,0
D = 0,
1 + 5
2
5 6
5
,
,0 ,
A = (0,0,0) , B = 1 + 10 2 1 + 10 2
,0 and
3 + 10 2 3 + 10 2
5
D = 0,
,0
1+ 5 2
C =
5 6
,0
1 + 10 2 1 + 10 2
5 6
i.e. (0, 0, 0) + t
,0
1 + 10 2 1 + 10 2
5t 6
5.t
=
,
we will verify that the vanishing point (I) lies on this line:
i.e.
5t 6
5.t
,
,0 = (5 6 , 5,0)
1 + 10 2 1 + 10 2
and
5.t. 6
1 + 10 2
5t
1 + 10 2
=5 6
=5
-----------------(5)
78
i.e.
5 6
5
=
,
,0 + s
3 + 10 2 3 + 10 2
5 6
5
5
,0
,
0
0,
1 + 5 2 3 + 10 2 3 + 10 2
Viewing
Transformations
5 6
5
5
,0 + s
,
,0 and
3 + 10 2 1 + 5 2 3 + 10 2
3 + 10 2 3 + 10 2
5 6
5 6 5.s. 6
5.s.(2 + 5 2)
5
,
+
,0 , but
3 + 10 2 3 + 10 2 3 + 10 2 (1 + 5 2 )(3 + 10 2 )
(1 s)
3 + 10 2
3 + 10 2
s (2 + 5 2 )
1 +
,0 = (5 6 , 5, 0)
(1 + 5 2 )
(1 s ) = 5 6
3 + 10 2
s (2 + 5 2 )
5
1 +
=5
and
3 + 10 2
(1 + 5 2 )
------------(6)
From the 2nd Row of the matrix (Equation (3)), the principal vanishing point w.r.t
y-axis will be:
1
5
0,
in homogeneous system.
,0,
2
2
------------------------(II)
From the 3rd row of matrix equation (3), we claim that the principal vanishing point
5 5 3
w.r.t z-axis will be: ,
,0,
2
2 2
3
in Homogeneous system.
2 2
79
Transformations
5 3
(5 / 2) 2 2
5 2
,0 =
,
,5,
3
3
2 2
2 2
------------------(III)
p(x,y,z)
p'(x,y,z)
0 (0, 0, 0)
Figure 21
We know that the equation of the projection plane passing through a reference point
R0 and having a normal vector N=n1I+n2J+n3K is given by PR0.N=0, that is
(x-x0,y-y0,z-z0).( n1,n2,n3)=0 i.e. n1.( x-x0)+ n2.( y-y0)+ n3.( z-z0)=0 ---------( )
since P(x,y,z) lies on this plane, thus we have: n1.( x-x0)+ n2.( y-y0)+ n3.( z-z0)=0
After substituting x=.x ; y=.y ; z=.z, we have :
=(n1.x0+ n2.y0+ n3.z0)/(n1.x+ n2.y+ n3.z) = d0/(n1.x+ n2.y+ n3.z)
This projection transformation cannot be represented as a 3x3 matrix transformation.
However, by using the homogeneous coordinate representation for 3D, we can write
this projection transformation as:
Pper,N,Ro=
d0
0
0
0
0
d0
0
0
0 n1
0 n2
d0 n3
0 0
Thus, the projected point Ph(x,y,z,1) of given point Ph(x, y, z, 1) can be obtained as
80
d0
0
Ph = Ph. Pper,N, Ro = [x, y, z, 1]
0
0
d0
0
0
d0
n1
n2
n3
Viewing
Transformations
-----------------(16)
z
-------------(17)
z
R0(x0, y0, z0)
N = (n1, n2, n3)
p(x,y,z)
p'(x,y,z)
c (a,b,c)
Figure 22
We know that the projection plane passing through a reference point R0(x0,y0,z0) and
having a normal vector N= n1I+n2J+n3K, satisfies the following equation:
n1.(x-x0)+n2.(y-y0)+n3.(z-z0)=0
Since P(x,y,z) lies on this plane, we have:
n1.(x-x0)+n2.(y-y0)+n3.(z-z0)=0
Substituting the value of x, y and z, we have:
= (n1.(x0-a)+n2.(y0-b)+n3.(z0-c))/( n1.(x-a)+n2.(y-b)+n3.(z-c))
=((n1.x0+n2.y0+n3.z0)-(n1.a+n2.b+n3.c))/(n1.(x-a)+n2.(y-b)+n3.(z-c))
=(d0-d1)/(n1.(x-a)+n2.(y-b)+n3.(z-c))
=d/(n1.(x-a)+n2.(y-b)+n3.(z-c))
Here, d=d0-d1= (n1.x0+n2.y0+n3.z0)- (n1.a+n2.b+n3.c) represents perpendicular
distance from COP, C to the projection plane.
In order to find out the general perspective transformation matrix, we have to proceed
as follows:
Translate COP, C(a,b,c) to the origin. Now, R0=(x0-a,y0-b,z0-c) becomes the
reference point of the translated plane.(but Normal vector will remain same).
Apply the general perspective transformation Pper,N,Ro
81
Transformations
1
0
0
0
0
1
a b c
0
0
0
0
n
1
d
0
0
d
n2
n3
0
0
n1.b
n1.c
n1
d + n1.a
d + n2 .b
n2 .c
n2
n2 .a
=
n .a
n3 .b
d + n3 .c n3
3
a.d
b.d 0
c.d 0 d1
0
0
0
0 0 0
1 0 0
0 1 0
b c 1
------------ (18)
Example 11: Obtain the perspective transformation onto z = 2 Plane, where the
center of projection is at (0, 0, 18).
Solution: Here centre of projection, C (a, b, c) = (0, 0, 18)
(n1, n2, n3) = (0, 0, 1)
d + n 2 .b
n 2 .c
n2
n 2 .a
n .a
n3 .b
d + n3 .c n 3
3
a.d
b.d 0
c.d 0 d 1
0
0
0
0
0
0
20
20
0
20
0
0
0
20
0
=
0
2 1
2
0
0
0
2
0
36 18
0
0
1
Example 12: Find the perspective transformation matrix on to z = 5 plane, when the
c.o.p is at origin.
Solution. Since z = 5 is parallel to z = 0 plane, the normal is the same as the unit
vecter k.
we know the general perspective transformation, when cop is at origin is given by:
d0
0
0
0
d0
0
0
d0
n1 4 0
n2 0 4
=
n3 0 0
0 0 0
Viewing
Transformations
0 0
0 0
4 1
0 0
7.0 800
5.3 7.3
0
0
0
0
2.8
4.5
2.0
3.0
2.3 SUMMARY
83
Transformations
2.4 SOLUTIONS/ANSWERS
Check Your Progress 1
1) Consider a following Figure m, where a given line AB is projected to A B on a
projection plane.
A
Projector
<
B
Center of projection
Figure m
Plane of projection
84
Viewing
Transformations
y
d = (d1,d2,d3)
Figure n
The Categorisation of parallel and perspective projection is based on the fact whether
coming from the object converge at the cop or not. If the rays coming from the object
converges at the centre of projection, then this projection is known as perspective
projection, otherwise parallel projection.
Parallel projection can be categorized into orthographic and Oblique projection.
A parallel projection can be categorized according to the angle that the direction of
projection d makes with the view plane. If d is r to the view plane, then this parallel
projection is known as orthographic, otherwise Oblique projection.
Orthographic projection is further subdivided into multiview view plane parallel to the
principal axes)
Axonometric projection (view plane not to the principal axes).
Oblique projection is further subdivided into cavalier
and canbinet and if f = then cabinet projection.
Projection
Parallel
Perspective
Single-point
Two-point
Three-point
Orthographic
Multiview
Figure o
Isometric
Oblique
Axonometric Cavalier
Dimetric
Trimetric
Cabinet
85
Transformations
3) C
Check Your Progress 2
1) C
2) We know that, the parallel projections can be categorized according to the angle
that the direction of projection d = (d1, d2, d3) makes with the projection plane.
Thus, if direction of projection d is r to the projection plane then we have
orthographic projection and if the d is not r to the projection plane then we have
oblique projection.
3) The ratio of projected length of a given line to its true length is called the
foreshortening factor w.r.t. a given direction.
Let AB is any given line segment
r
Also assume AB || a .
Then Under parallel projection, AB is projected to AB; The change in the length
of projected line is measured in terms of foreshortening factor. f.
f=
| A' B' |
| AB |
Isometric
Diametric
Trimetric
When all foreshortening factors along the x-, y- and z-axes are equal, i.e., fx = fy =
fz, then we have Isometric projection, i.e., the direction of projection makes equal
angle with all the positive sides of x, y, and z-axes, respectively.
Similarly, if any two foreshortening factors are equal, i.e., fx = fy or fy = fz or fx = fz
then, we have Diametric projection. If all the foreshortening factors are unequal d
makes unequal angles with x, y, and z-axes/, then we have Trimetric projection.
4) Refer 2. 3. 1. 2 Isometric projection.
5) For orthographic projection, Normal vector N should be parallel to the direction
of projection vecter, d .
i.e.
d = k N where k is a constant.
(-1, 0, 0) = k(1, 0, -1)
This is not possible
The transformation matrix for cavalier and cabinet projections are given by:
1
0
Pcav =
f.cos
86
0
1
f.sin
0
0
0
0
0
0
0
1
0
0
1
=
0
cos 45 sin 45
1
0
0
0
0
0
0
0
0
1
0
0
1
=
0
1/ 2 1/ 2
1
0
0
0
0
0
0
0
0
-----1)
0
1
0
&Pcab=
f.cos
0
1
f.sin
0
0
0
0
0
1
0
0
0
= 1
.
sin
30
0
2
1
0
0 0 1
0
0 0
0
1
=
1
. cos 30 0 0 0.43 0.25
2
0
0
0 1 0
0
1
0
0
0
0
0
0
---(2)
0
Viewing
Transformations
y
E
z
o
x
Figure p
C
z
The parametric equation of the ray, starting from E and passing through p is:
x
p (x, y, z)
p'(x,y,z)
COP
E (0, 0, 0)
z = d plane
y
Figure q
E + t (P E), t > 0
= (0, 0, 0) + t [(x, y, z) (0, 0, 0)]
= (t.x, t. y, t. z)
87
Transformations
t=
d
must be true.
z
P = (x, y, z) =
,
, d in homogenous Coordinates , , d,1
z
z
z z
0 0 0
d 0 0
0 d 1
0 0 0
2) Since the cube is first translated by 0.5 units in the x and y-directions, to get the
centred cube on the z-axis.
0.5 0.5
0 0
0 0
1 0
0 1
----------(1)
0
0
0 0 1 / d
0 0 1
0 0
1 0
----------(2)
Pper,z =
1
0
0
0
0 0 0.1
0 0
1
0 0
1 0
0.5 0.5
88
0
0
0
0 0.1
0
1
0
1
= 0.1
d
Thus, the projected points of the centred cube V = [ABCDEFGH] will be:
0
1
0
[V] = [V]. [T] =
0
1
1
0.5
0.5
0.5
0.5
=
0.5
0.5
0.5
0.5
0 1 1
0 1 1
.
1 1 1
0
1
1 1 1
0
1
.
0
0
0 0 1
0 0 1
0.5 0.5
1 0 1
1 0 1
0.5 0 0.9
A' 0.56
0.5 0 0.9
B' 0.56
0.5 0 0.9
C' 0.56
0.5 0 0.9
D' 0.56
=
0.5 0 1
E' 0.5
0.5 0 1
F' 0.5
0.5 0 1
G' 0.5
0.5 0 1
H' 0.5
0.56
0.56
0.56
0.56
0.5
0.5
0.5
0.5
Viewing
Transformations
0
0
0
0 0.1
0
1
0
0 1
0 1
0 1
0 1
0 1
0 1
0 1
0 1
3) A unit cube is placed at the origin such that its 3-edges are lying along the x,y,
and z-axes. The cube is rotated about the y-axis by 30. Obtain the perspective
projection of the cube viewed from (80, 0, 60) on the z= 0 plane.
3) Rotation of a cube by 30 along y-axis,
H
C
E
(0,0,0)
B
A
z
cos 30
0
[Ry]30 =
sin 30
Figure r
0 sin 30 0
1
0
0
0 cos 30 0
0
0
1
89
Transformations
3/2 0
0
1/ 2
0.86
1 / 2 0
0
0
0
=
0.5
3 / 2 0
0
1
0
0 0.5 0
1
0
0
0 8.6 0
0
0
1
Let p (x, y, z) be any point of a cube in a space and p (x, y, z) is its projected point
onto z = 0 plane.
The pametric equation of a line, starting from E (80, 0, 60) and passing through P (x,
y, z) is:
E + t ( P E), 0 < t .
= (80, 0, 60) + t [(x, y, z) (80, 0, 60)]
= (80, 0, 60) + t[ (x 80), y, (z 60)]
= [t (x 80) + 80, t.y, t. (z 60) + 60]
Assume point P can be obtained, when t = t*
P = (x, y, z) = [t* (x 80) + 80, t*.y, t* (z 60) + 60]
Since point p lies on z = 0 plane, so
60
z 60
60.x + 80.z 60. y
,
,0
p = (x, y, z) =
z 60
z 60
t* (z 60) + 60 = 0 t* =
P (x, y, z, 1) =
,
,0,1
z 60
z 60
0
0
0
0
------------(1)
0
1
0 60
0
0
Pn = Pn. Ppar, z
-------------(2)
Since a given cube is rotated about y-axis by 30, so the final projected point p (of a
cube on z = 0 plane) can be obtained as follows:
Pn = Pn. [Ry]30. Ppar, z
0.86
0
(x, y, z, 1) = (x, y, z, 1) .
0.5
0
0
91.9
0
60
(x, y, z, 1) = (x, y, z, 1)
38.8
0
0
0
0 0.5 0 60
0
60
1
0
0 0
.
0 0.86 0
80
0
0
0
1 0
0
0
0
0
1
0 60
0
0
0 0.5
0
-------------(3)
0 0.86
0 60
0
Pn = P. Ppar, z, 30
This equation (3) is the required perspective transformation. Which gives a
coordinates of a projected point P (x, y, z) onto the z = 0 plane, when a point P (x,
y, z) is viewed from E (80, 0, 60).
90
Thus, all the projected points of a given cube can be obtained as follows:
A 0
B 1
C 1
D 1
P = V. Ppar, z, 30 =
E 0
F 0
G 1
H 0
A'
B'
C'
D'
E'
F'
G'
H'
38.8
129.7
129.7
38.8
0
90.9
90.9
0
0
60
60
0
0
60
60
0 59.14
0 59.64
0 59.64
0 60.86
=
0 60.0
60.5
0
60.5
0
60.0
0
0 1 1
0 1 1
1 1 1
1 1 1
1 1 1
0 0 1
0 0 1
1 0 1
0
90.9
0
60
38.8
0
0
0
0
A' 0.72
0
B' 2.17
C' 2.17 1.01
0
F' 1.50
1
H' 0
Viewing
Transformations
0 0.5
0
0
0 0.86
0 60
0 1
0 1
0 1
0 1
0 0
0 1
0 1
0 1
From Rows one, two and three from equation matrix (I), the vanishing point w.r.t.
x, y and z axis, will be:
Cx = (3.1, 2.0, 0)
Cy = (0, 4.56, 0)
Cz = (3.5, 4.0, 0)
2) From the given V.P., we can obtain the corresponding center of projections. Since
vanishing points: Vx = 5, Vy= 5 and Vz = 5, hence center of projections is at:
Cx = 5, Cy = 5 and Cz = 5
1/d1 =
1
1 1
1
1
=
= 0.2
= 0.2,
= = 0.2 and
5
d2 5
5
d3
0 0
1 0
0 1
0 0
0.2
0.2
0.2
------------(I)
Thus by multiplying v = [ABCDEFGH] with projection matrix (I), we can obtain the
transformed vertices of a given cube.
91