Computational Geometry (Math-1)
Computational Geometry (Math-1)
GE O M E T R Y
for
[MTC - 231]
Second Year B.Sc. (Computer Science)
Mathematics - Paper I, Semester - III
New Syllabus as per CBCS Pattern Credit - 2
June 2020
M. D. Bhagat R. S. Bhamare
Ex-Head Dept. of Mathematics Ex-Head of P.G. Dept. of Mathematics
Tuljaram Chaturchand College New Arts, Science & Commerce College
Baramati (Dist. Pune) Ahmednagar
Dr. S. G. Purane
Assistant Professor & HOD of Mathematics
PES's Jamkhed Mahavidyalaya
Jamkhed, Ahmednagar 413 201
Price ` 245.00
N5543
Computational Geometry ISBN 978-93-90506-63-7
First Edition : January 2021
© : Authors
The text of this publication, or any part thereof, should not be reproduced or transmitted in any form or stored in any computer
storage system or device for distribution including photocopy, recording, taping or information retrieval system or reproduced on any disc,
tape, perforated media or other information storage device etc., without the written permission of Authors with whom the rights are
reserved. Breach of this condition is liable for legal action.
Every effort has been made to avoid errors or omissions in this publication. In spite of this, errors may have crept in. Any mistake, error
or discrepancy so noted and shall be brought to our notice shall be taken care of in the next edition. It is notified that neither the publisher
nor the authors or seller shall be responsible for any damage or loss of action to any one, of any kind, in any manner, therefrom.
Published By : Polyplate Printed By :
NIRALI PRAKASHAN YOGIRAJ PRINTERS AND BINDERS
Abhyudaya Pragati, 1312, Shivaji Nagar, Works: Sr. No. 10\1,Ghule Industrial Estate,
Off J.M. Road, PUNE – 411005 Nanded Village Road,
Tel - (020) 25512336/37/39, Fax - (020) 25511379 TAL-HAVELI, DIT-PUNE 411041.
Email : [email protected] Mobile - 9850046517, 9404225254
☞ DISTRIBUTION CENTRES
PUNE
Nirali Prakashan : 119, Budhwar Peth, Jogeshwari Mandir Lane, Pune 411002, Maharashtra
(For orders within Pune) Tel : (020) 2445 2044, 66022708, Fax : (020) 2445 1538; Mobile : 9657703145
Email : [email protected], [email protected]
Nirali Prakashan : S. No. 28/27, Dhyari, Near Pari Company, Pune 411041
(For orders outside Pune) Tel : (020) 24690204 Fax : (020) 24690316; Mobile : 9657703143
Email : [email protected], [email protected]
MUMBAI
Nirali Prakashan : 385, S.V.P. Road, Rasdhara Co-op. Hsg. Society Ltd.,
Girgaum, Mumbai 400004, Maharashtra; Mobile : 9320129587
Tel : (022) 2385 6339 / 2386 9976, Fax : (022) 2386 9976
Email : [email protected]
☞ DISTRIBUTION BRANCHES
JALGAON
Nirali Prakashan : 34, V. V. Golani Market, Navi Peth, Jalgaon 425001,
Maharashtra, Tel : (0257) 222 0395, Mob : 94234 91860
KOLHAPUR
Nirali Prakashan : New Mahadvar Road, Kedar Plaza, 1st Floor Opp. IDBI Bank, Kolhapur 416 012,
Maharashtra. Mob : 9850046155; Email : [email protected]
NAGPUR
Nirali Prakashan : Above Maratha Mandir, Shop No. 3, First Floor,
Rani Jhanshi Square, Sitabuldi, Nagpur 440012, Maharashtra
Tel : (0712) 254 7129; Email : [email protected]
DELHI
Nirali Prakashan : Room. No. 2 Ground Floor, 4575/15 Omkar Tower,
Agarwal Road, Darya Ganj, New Delhi - 110002.
Mob : 9555778814 / 9818561840 - Email : [email protected]
BENGALURU
Nirali Prakashan : Maitri Ground Floor, Jaya Apartments, No. 99, 6th Cross, 6th Main,
Malleswaram, Bangaluru 560 003, Karnataka. Mob : +91 9449043034
Email: [email protected]
Other Branches : Hyderabad, Chennai
Note: Every possible effort has been made to avoid errors or omissions in this book. In spite this, errors may have crept in. Any type of error
or mistake so noted, and shall be brought to our notice, shall be taken care of in the next edition. It is notified that neither the publisher, nor
the author or book seller shall be responsible for any damage or loss of action to any one of any kind, in any manner, therefrom. The reader
must cross check all the facts and contents with original Government notification or publications.
[email protected] | www.pragationline.com
Also find us on www.facebook.com/niralibooks
Preface …
We have great pleasure in presenting this text book on COMPUTTIONAL GEOMETRY to
the students of S.Y.B.Sc. Computer Science Semester - IV, Mathematics Paper - I. This book is
written strictly according to the new revised syllabus of Savitribai Phule Pune University to be
implemented from June 2020.
We have taken utmost care to present the matter systematically and with proper flow of
mathematical concepts. We begin the Chapter by Introduction and at the end the Summary
of the Chapter is provided. We have added one significant feature: "Think Over It" in this
new edition. Here, we have posed questions of simple, difficult and intuitive type in nature. It
is expected that the students should think over it and try to find the answers. This will assess
the understanding of the knowledge of the Chapter.
The book contains good number of solved problems and the number of graded
problems in the exercises.
We are thankful to Shri Dineshbhai Furia, Shri Jignesh Furia, Mrs. Anagha Medhekar
(Proof Reading and Co-ordination), Mr. Ilyas Shaikh, Mrs. Anjali Mule (Figure Drawing) and
the staff of Nirali Prakashan for the great efforts that they have taken to publish the book in
time.
We welcome the valuable suggestions from our colleagues’ and readers for the
improvement of the book.
PUNE AUTHORS
JANUARY 2021
✍✍✍
Syllabus …
1. Two Dimensional Transformations (12 Lectures)
1.1 Introduction.
1.2 Representation of points.
1.3 Transformations and matrices.
1.4 Transformation of points.
1.5 Transformation of straight lines
1.6 Mid-point Transformation
1.7 Transformation of parallel lines
1.8 Transformation of intersecting lines
1.5 Transformation: rotations, reflections, scaling, shearing.
1.6 Combined transformations.
1.7 Transformation of a unit square.
1.8 Solid body transformations.
1.9 Translations and homogeneous co-ordinates.
1.10 Rotation about an arbitrary point.
1.11 Reflection through an arbitrary line.
2. Three Dimensional Transformations (08 Lectures)
2.1 Introduction.
2.2 Three dimensional – Scaling, shearing, rotation, reflection, translation.
2.3 Multiple transformations.
2.4 Rotation about – an axis parallel to co-ordinate axes, an arbitrary line
2.5 Reflection through – co-ordinate planes, planes parallel to co-ordinate planes, an
arbitrary plane
3. Projection (08 Lectures)
3.1 Orthographic projections.
3.2 Axonometric projections.
3.3 Oblique projections
3.4 Single point perspective projection
4. Plane and Space Curves (08 Lectures)
4.1 Introduction.
4.2 Curve representation.
4.3 Parametric curves.
4.4 Parametric representation of a circle and generation of circle.
4.5 Bezier Curves – Introduction, definition, properties (without proof),
Curve fitting (up to n = 3), equation of the curve in matrix form (upto n = 3)
✍✍✍
Contents
Contents …
1. Two Dimensional Transformations 1.1 – 1.64
✍✍✍
Chapter 1…
Two-Dimensional Transformations
Charle’s Hermites (1822-1901 A.D.) : At first he was Professor of
mathematics in Sarbonne University. He left this place and joined in
the same post in Ecole Polytechnic. He was very much influenced
by Jacob's line. He wrote book on Theory of Functions and in 1873
1 1 1
A.D. he proved that e = 1 + + + … is an incommensurable
1! 2! 3!
number.
Further he wrote on elliptic functions, Modular functions Theta
functions, Theory of numbers and Invariants Theory, Hermitian
Numbers and Hermitian Form which made him immortal in
Charle’s Hermites
mathematics.
1.1 Introduction
Computational Geometry is a part of discrete mathematics that studies computational
problems related to geometrical objects. The areas which use computational geometry are
computer graphics, scientific calculations, computer games and robotics etc.
The representation and transformation of points and lines are the fundamentals of
mathematics underlying the computer graphics. The objects are represented graphically by using
the points and the lines joining term. The visual representation of an object needs scaling,
translation, rotation, shearing etc. We shall discuss them one-by-one in this chapter.
In 2-dimensional geometry, a point is represented by its co-ordinates viz. abscissa and the
ordinate. Thus, if P is a point with co-ordinates x and y, we write P(x, y).
(1.1)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.2 Two-Dimensional Trans. …
1.2
1.2 Transformation of Points
Let P be a point whose co-ordinates are x and y, so that the matrix formed by them is 1 × 2
matrix [X] = [x y].
If [T] =
a b is a general 2 × 2 transformation matrix, then multiplication of [X] by [T] leads
c d
to
[X] [T] = [x y]
a b
c d
= [ax + cy bx + dy]
* *
= [x y ]
Thus, under the transformation T a point P with co-ordinates x and y is transformed to a point
*
P with co-ordinates
*
x = ax + cy and
*
y = bx + dy
Now depending upon the nature of values of the elements of [T], we have the following
different cases.
First Case :
Suppose a = d = 1 and b = c = 0.
[X] [T] = [x y]
a 0
0 1
* *
∴ [X] [T] = [ax y] = [x y ]
*
Here x = ax suggests that a scale change is produced in the x-component of the position
vector of a point P. The effect of this transformation is shown in Fig. 1.1 below.
Y
P P*
O
X
Fig. 1.1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.3 Two-Dimensional Trans. …
Third Case :
Suppose b = c = 0. Then,
[X] [T] = [x y]
a 0
0 d
* *
= [ax dy] = [x y ]
* *
Here, x = ax and y = dy means there is a scale change in the x-component as well as in
y-component of the position vector of a point P. It is shown in Fig. 1.2.
y
P'
P
x
0
Fig. 1.2
We note that if a ≠ d, then the scale changes in x and y components are different.
If a = d > 1, then equal enlargement occurs in both components while if 0 < a = d < 1, then
equal compression occurs in both components of a position vector.
Fourth case :
If b = c = 0, d = 1 and a = – 1, then
–1 0
[ x y ] = [ –x y ] = [ x* y* ]
0 1
This leads to the reflection through y-axis.
If b = c = 0, a = 1, d = – 1, then
1 0
[ x y ] = [ x –y ] = [ x* y* ]
0 –1
This leads to the reflection in through x-axis.
If b = c = 0, a < 0, d < 0, taking a = d = – 1, we have
–1 0
[ x y ] = [ –x –y ] = [ x* y* ]
0 –1
This means a reflection through origin has occurred. These three reflections are shown in the
following Fig. 1.3 (a), (b) and (c).
y y y y y
P
P* PP* P P P
0 x
x x
0 0
x x
0 0 P* P* P*
(a) (a) (b) (b) (c)
(a) Reflection through y-axis (b) Reflection through x-axis (c) Reflection through origin
Fig. 1.3
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.4 Two-Dimensional Trans. …
Fifth case :
Suppose a = d = 1 and c = 0. In this case,
1 b
[ x y ] = [ x bx + y ] = [ x* y* ]
0 1
The effect is that x co-ordinate remains the same and y* is a linear combination of x and
y. This effect is called shear. This transformation produces a shear proportional to the x
co-ordinate.
Again, if a = d = 1, b = 0, then
1 0
[ x y ] = [ x + cy y ] = [ x* y* ]
c 1
Under this shear transformation y co-ordinate remains the same y* = y and x* = x + cy. It
produces a shear proportional to the y co-ordinate.
The two types of shear transformation are as shown in the following Fig. 1.4.
y*, y y*, y
P*
x* = x + cy
cy
P P*
P y
bx +
y* =
bx
x, x* x, x*
0 0
(a) (b)
Fig. 1.4
Finally, we note that there is no any effect of 2 × 2 general transformation on origin.
a b
[ 0 0 ] = [ 0 0 ]
c d
This means origin is invarient under general transformation.
3 1
If [T] = is the transformation matrix, then
1 2
[1 2] [T] = [1 2]
3 1 = [5 5]
1 2
Also, [2 0] [T] = [2 0]
3 1 = [6 2]
1 2
Thus, under the transformation [T], the point A with position vector [1 2] is transformed to
a point A* with position vector [5 5] and a point B with position vector [2 0] is transformed to a
point B* with position vector [6 2].
The above two transformations are written in more compact form as below :
1 2 3 1 5 5
= This is shown in the following Fig. 1.5.
2 0 1 2 6 2
y
5 A*
4
3
A
2 B*
1
B
x
0 1 2 3 4 5 6
Fig. 1.5
We observe that the length as well as orientation of AB is changed.
1.4 Mid-
Mid-point Transformation
When a line L joining the points A [x1 y1] and B [x2 y2] is transformed into a line L* joining A*
[x* y*] and B* [x* y*] under [T], it is clear that the points A and A* correspond and also B and B*
1 1 2 2
correspond. In fact there is a one-one correspondence between the points of line L and those of
L*.
We shall now prove that the mid-point of AB corresponds to the mid-point of A*B*.
y*, y
B*
B
M*
M
A A*
x, x*
0
Fig. 1.6
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.6 Two-Dimensional Trans. …
As shown in the Fig. 1.6 the line AB is transformed into line A*B* under the transformation
a b * * * *
[T] =
c d [ ] [ ]
; where A [x1 y1], B [x2 y2], A* x1 y1 and B* x2 y2 .
A x1 y1 a b
[ T ] =
B x2 y2 c d
ax1 + cy1 bx1 + dy1
=
ax2 + cy2 bx2 + dy2
x* y* A*
1 1 =
=
* * B*
x2 y2
x* + x* y* + y*
The mid-point M* of A*B* is M* 1 2 1 2
2 2
ax1 + cy1 + ax2 + cy2 bx1 + dy1 + bx2 + dy2
∴ M* ... (1)
2 2
x1 + x2 y1 + y2
Now, the mid-point M of AB is M .
2 2
Therefore, under the transformation T it will be transformed to
x1 + x2 y1 + y2 a b
[M] [T] = 2
2 c d
x1 + x2 y1 + y2 x1 + x2 y1 + y2
= a 2 + x 2 b1 2 + d 2
ax1 + ax2 + cy1 + cy2 bx1 + bx2 + dy1 + dy2
= ... (2)
2 2
From (1) and (2) we see that [M] [T] = [M*].
In general, if a point P divides AB in the ratio λ : 1, then under the transformation [T] it will be
transformed into a point P* that divides A*B* in the same ratio λ : 1. Hence, there is a one-one
correspondence between the points on AB and the points on A*B*.
This is shown as below in Fig. 1.7.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.7 Two-Dimensional Trans. …
y, y*
B
B*
A*
A
x, x*
0
Fig. 1.7
Illustrative Example
2 1
Example 1.1 : Let A [0 1], B [2 2] and T = be the transformation matrix. Let P divides
5 4
AB in the ratio 4 : 3.
(a) Find [A*] = [A] [T] , [B*] = [B] [T].
(b) Find [P*] = [P] [T].
(c) Verify that P and P* correspond.
A 0 1 2 1 5 4
Solution : (a) [ T ]= =
B 2 2 5 4 14 10
A*
=
B*
∴ A* is the point [ 5 4 ] and B* is the point [ 14 10 ].
(b) The point P [x y] divides AB in the ratio 4 : 3.
Therefore, by section formula we have,
(4) (2) + (3) (0) 8
x = = and
4+3 7
(4) (2) + (3) (1) 11
y = =
4+3 7
8 11 2 1 = 71 52
Now, [P] [T] =
7 7 5 4 7 7
71 52 .
So P* is the point
7 7
(c) A point [ x* y* ] which divides the join of A*B* in the ratio 4 : 3, has co-ordinates
(4) (14) + (3) (5) 71
x* = =
4+3 7
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.8 Two-Dimensional Trans. …
] = *
71 52
Thus, the point [ x* y*
7 7 is P .
1.5 Transformation of Parallel Lines
The effect of 2 × 2 transformation matrix on a pair of parallel lines is another pair of parallel
lines.
y*, y
D D*
B B*
C A C* A*
x, x*
0
Fig. 1.8
As shown in the Fig. 1.8, AB, CD is a given pair of parallel lines. If [A] = [x1 y1] and [B] = [x2 y2],
y2 – y1
then AB and CD being parallel, they have the same slope m = .
x2 – x1
a b
If [T] = is the transformation matrix, then
c d
A x1 y1 a b
[T] =
B x2 y2 c d
ax1 + cy1 bx1 + dy1
=
ax2 + cy2 bx2 + dy2
x* y* A*
1 1 =
=
* * B*
x2 y2
The slope of line A*B* is
* *
y2 – y1 (bx2 + dy2) – (bx1 + dy1)
m* = * *
=
(ax2 + cy2) – (ax1 + cy1)
x2 – x1
y2 – y1
b+d
x2 – x1
∴ m* =
y2 – y1
a+c
x2 – x1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.9 Two-Dimensional Trans. …
b + dm
∴ m* =
a + cm
This shows that m* is independent of x1, y1, x2, y2. Also m, a, b, c, d are the same for AB and
CD. Hence, it immediately follows that m* is the same for A*B* and C*D*.
Thus, parallel lines are transformed onto parallel lines. It is clear that under 2 × 2
transformation matrix, parallelogram gets transformed onto other parallelogram.
(b) We find the value of h* so that the equation y = mx + h is transformed to the equation
But, [ x y ][ T ] = [ x* y* ] implies
a b
[ x y ] = [ x* y* ]
c d
∴ [ ax + cy bx + dy ] = [ x* y* ]
∴ x* = ax + cy and y* = bx + dy
bx + dy =
b + dm (ax + cy) + h*
a + cm
The point (0, h) lies on the line y = mx + h.
∴ 0 + dh =
b + dm (0 + ch) + h*
a + cm
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.10 Two-Dimensional Trans. …
∴ h* = dh –
b + dm (ch)
a + cm
∴ h* = h d –
c (b + dm)
(a + cm)
∴ h* = h
ad – bc
a + cm
Theorem 2 Let the intersecting lines y = m1x + h1 and y = m2 x + h2 be transformed under the
a b
transformation matrix [ T ] = to
c d
* *
y* = m1 x* + h1
* *
and y* = m2 x* + h2 respectively
Then,
(a) the transformed lines are intersecting.
(b) the point of intersection of original pair of lines is transformed to the point of
intersection of new pair of lines, under the transformation matrix [ T ].
Proof : (a) The lines y = m1x + h1 ... (1)
and y = m2 x + h2 ... (2)
are intersecting. Therefore, their slopes are different; m1 ≠ m2.
To find the point of intersection of (1) and (2) we write these equations in matrix form as
below.
– m1x + y = h1
– m2 x + y = h2
–m1 –m2
∴ [ x y ] = [h1 h2]
1 1
–1
–m1 –m2
∴ [x y] = [ h1 h2 ]
1 1
1 m2
] m2 – m1
1
∴ [x y] = [ h1 h2
–1 –m1
1
∴ [x y] =
m2 – m1 [
h1 – h2 h1m2 – h2 m1 ] ‡ m2 – m1 ≠ 0
h1 – h2 h1m2 – h2 m1
∴ [x y] = m –m ... (3)
2 1 m2 – m1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.11 Two-Dimensional Trans. …
* *
Now, the line y = m1x + h1 is transformed to y* = m1 x* + h1 ... (4)
* b + dm1
where, m1 =
a + cm1
* ad – bc
h1 = h 1
and
a + cm1
* *
Also the line y = m2 x + h2 is transformed to y* = m2 x* + h2 ... (5)
* b + dm2
where, m2 =
a + cm2
* ad – bc
h2 = h 2
and
a + cm2
* * * * * *
h1 – h2 h1 m2 – h2 m1
Now, we note that just like (3); if * *
and * *
exist then
m2 – m1 m2 – m1
h* – h* h* m* – h* m*
1 2 1 2 2 1 will be the point of intersection of lines given by (4) and (5).
m –m
* * *
m2 – m1
*
2 1
ad – bc – h ad – bc
h1
* *
h1 – h2 a + cm1 2 a + cm2
* *
=
b + dm2 b + dm1
m2 – m1 –
a + cm2 a + cm1
a (h1 – h2) + c (h1m2 – h2 m1)
=
m2 – m1
It exists since m2 – m1 ≠ 0.
* * * *
h1 m2 – h2 m1 b (h1 – h2) + d (h1m2 – h2 m1)
Also * *
= exists since m2 – m1 ≠ 0.
m2 – m1
m2 – m1
Thus, the lines given by (4) and (5) are intersecting and their point of intersection is
a (h1 – h2) + c (h1m2 – h2 m1) b (h1 – h2) + d (h1m2 – h2 m1)
... (6)
m2 – m1 m2 – m1
(b) Now, consider the transformation of the point of intersection of (1) and (2) under [T].
h1 – h2 h1m2 – h2 m1 a b
m –m
2 1 m2 – m1 c d
a (h1 – h2) + c (h1m2 – h2 m1) b (h1 – h2) + d (h1m2 – h2 m1)
= ... (7)
m2 – m1 m2 – m1
The results (6) and (7) imply that the point of intersection of lines (1) and (2) is transformed to
the point of intersection of lines (4) and (5).
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.12 Two-Dimensional Trans. …
Illustrative Examples
Example 1.2 : A line segment joining A [4 9] and B [−2 1] is scaled uniformly by factor 2.
What is the mid-point of the transformed line segment ? (March 2006)
Solution : The uniform scaling by a factor 2 is governed by the transformation matrix
2 0
[T] =
0 2
We know that under the general transformation matrix, the mid-point of line segment AB is
transformed onto the mid-point of the transformed line segment A*B*.
] is M i.e.
4–2 9+1
The mid-point M of segment AB; where A [ 4 9 ] and B [ –2 1
2 2
M[ 1 5 ].
2 0
∴ M* = [M] [T] = [ 1 5 ] = [ 2 10 ]
0 2
1 3
Example 1.3 : If a 2 × 2 transformation matrix [T] = is used to transform the line
–2 2
passing through the points A
3 – 1 and B [0 1]., find the equation of the resulting line.
2
(April 2005)
h* = h
ad – bc = 1 × (1) (2) – (3) (–2) = 4
a + cm 1
1 + (–2) –
2
The equation of the transformed line is
y* = x* + 4
Example 1.4 : If the line y = 2x + 1 is transformed by the 2 × 2 transformation matrix
4 2
[T] = , then find the equation of the transformed line.
–1 3
a b
Solution : We know that under the transformation matrix [T] = , the line y = mx + h
c d
is transformed to the line y* = m*x* + h*;
where, m* =
b + dm
and h* = h
ad – bc .
a + cm a + cm
Now [ T ] =
4 2
–1 3
a = 4, b = 2, c = –1, d = 3.
Also y = 2x + 1 ⇒ m = 2, h = 1.
b + dm 2 + (3) (2) 8
∴ m* = = = = 4
a + cm 4 + (–1) (2) 2
h* = h
ad – bc = 1 × (4) (3) – (2) (–1) = 7
a + cm 4 + (–1) (2)
Therefore, equation of the transformed line is
y* = m*x* + h*
i.e. y* = 4x* + 7
y*
P
y
q
f
x, x*
0 x*
x
Fig. 1.9
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.14 Two-Dimensional Trans. …
As shown in the Fig. 1.9, the position vector OP of the point P is such that OP = r and
∠ XOP = φ. Then the point P [x y] is given by
x = r cos φ and y = r sin φ ... (1)
Let us rotate OP about the origin O through an angle θ so that the point P is transformed to
P*.
Reflection :
y, y*
5
4
3 P [x y]
2
1
x, x*
0 1 2 3 4 5 6 7
P* [x* y*]
Fig. 1.10
As shown in the figure, the mirror image of the point P [ x y ] in x-axis is the point
P* [ x* y* ] . Thus P* is reflection of P in x-axis. Here we see that the x co-ordinate of P and P* is
the same; while the y co-ordinate y of P* is equal in magnitude but opposite in sign to the y co-
ordinate of P.
1 0
The above transformation is achieved by the transformation matrix [T] = .
0 –1
The reflection of a point P [x y] in y-axis, in the line y = x and in the line y = – x is shown
below in Fig. 1.11.
y, y*
P*[- 4, 2.4] 3 P[4, 2.4]
2
1
x, x*
-5 - 4 -3 -2 -1 0 1 2 3 4 5 6 7
–1 0
Fig. 1.11 : Reflection in y-axis ; [ T ] =
0 1
y, y*
7 x
=
y
6
P* [2, 5]
5
4
3
2 P [5, 2]
1
x, x*
0 1 2 3 4 5 6
0 1
Fig. 1.12 : Reflection in the line y = x; [ T ] =
1 0
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.16 Two-Dimensional Trans. …
y, y*
y
7
=
-x
6
P [-2, 5]
5
4
3
2
P* [-5, 2]
1
x, x*
-6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6
0 –1
Fig. 1.13 : Reflection in the line y = – x; [ T ] =
–1 0
Illustration : Consider a triangle ABC with vertices A [2 1], B [3 2.5] and C [4 2]. We shall
find reflection of this triangle in (a) x-axis, (b) y-axis, (c) the line y = x and (d) line y = – x.
(a) The transformation matrix for reflection in x-axis is
1 0
[T] =
0 –1
A
A 2 1
1 0 2 –1 1
C 4 2 4 –2 C 1
y, y*
3
B
2 C
1 A
x, x*
0 1 2 3 4
A1
C1
B1
Fig. 1.14
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.17 Two-Dimensional Trans. …
A 2 1
–1 0
We have, B [T] = 3 2.5 0
1
C 4 2
A
–2 1 2
= –3 2.5 = B 2
–4 2 C 2
y, y*
3
B2 B
C2 2 C
A2 1 A
x, x*
-4 -3 -2 -1 0 1 2 3 4
Fig. 1.15
0 1
(c) The transformation matrix for reflection in the line y = x is [T] = .
1 0
A
A 2 1
0 1 1 2 3
C 4 2 2 4 C 3
y, y*
C3
4
x
y=
3 B3
B
2 A3
C
1
A
x, x*
0 1 2 3 4 5
Fig. 1.16
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.18 Two-Dimensional Trans. …
0 –1
(d) The transformation matrix for reflection in the line y = – x is [T] = .
–1 0
A 2 1
0 –1
We have, B [T] = 3 2.5 –1
0
C 4 2
A
–1 –2 4
= –2.5 –3 = B . 4
–2 –4 C 4
y, y*
3
B
y
=
–×
2 C
1 A
x, x*
-4 -3 -2 -1 0 1 2 3 4
A4 -1
B4 -2
C4
-3
-4
Fig. 1.17
Each of the four transformation matrices which produce reflection in x-axis, y-axis, the line y =
x and the line y = – x, have their determinant equal to –1. The reflection produced by such a
matrix is called pure reflection. The successive application of two pure reflection transformations
about lines passing through origin is equivalent to a pure rotation about the origin.
In the illustration which we have discussed above the points A [2 1], B [3 2.5] and C [4 2] are
vertices of a triangle ABC. Its reflection in the line y = – x is a triangle A4B4C4 where A4 [ –1 –2 ],
B4 [ –2.5 –3 ] and C4 [ –2 –4 ].
Now the reflection of triangle A4B4C4 in x-axis will be a triangle PQR where, P [ –1 2 ],
Q [ –2.5 3 ] and R [ –2 4 ].
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.19 Two-Dimensional Trans. …
The same result is obtained by rotating the triangle ABC, about the point origin; through
angle θ = 90o.
–1 2
P
= –2.5 3 = Q
–2 4 R
Scaling and Shearing :
a b
We have already seen in the beginning that if [T] = is the transformation matrix, then
c d
the scaling effect is governed by the entries a and d on the main diagonal of [T] while the shearing
effect is governed by the entries b and c on the second diagonal of [T].
3 0
If a = d = 3, b = c = 0, then the effect of [T] = on the vertices of a triangle ABC is
0 3
that 3 times enlargement i.e. uniform scaling occurs about the origin. This is shown in the Fig. 1.18
below.
y, y*
B*
B C*
A*
A
C
x, x*
0
Fig. 1.18
We have A [2 1], B [2 2] and C [4 1].
A 2 1
3 0 6 3
B [T] = 2 2
0
=
3
6 6
C 4 1 12 3
A
*
= B*
C*
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.20 Two-Dimensional Trans. …
7 0
7
On the other hand if a = , b = 2, c = d = 0, then the effect of matrix [T] =
2 on the
2
0 2
same triangle ABC is as shown below in Fig. 1.19, where there is a distortion due to non-uniform
scale factors.
y**, y
B**
B
A** C**
A C
x**, x
0
Fig. 1.19
As before here we have
A 2 1
72 0
= 7 2
B [T] = 2 2
7 4
C 4 1 0 2 14 2
A
**
= B**
C**
The above discussion about uniform scaling and distortion suggests that there is an apparent
translation of the transformed triangles. We note that the position vectors are scaled and not the
points; with respect to the origin.
If the centroid of the figure is at the origin, then pure scaling without apparent translation
takes place.
Consider a triangle PQR where P [1 2], Q [1 −1] and R [−2 −1]. The centroid of this angle is
at the origin.
P 1 2
3 0 3 6
Now, Q [T] = 1 –1
0
=
3
3 –3
R –2 –1 –6 –3
P
*
= Q*
R*
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.21 Two-Dimensional Trans. …
P*
x, x*
0
R Q
R* Q*
Illustrative Example
Example 1.5 : Apply each of the following transformations on the point A [2 −4].
(a) Scaling in x co-ordinate by factor 3.
(b) Scaling in y co-ordinate by factor 2.
(c) Scaling in x and y co-ordinates by factors 3 and 2 respectively.
(d) Shearing in y-direction by 4 units.
(e) Shearing in x and y directions by 2 and 5 units respectively.
Solution : If [ T ] denotes the transformation matrix, then we have
[ A ] [ T ] = [ A*]
(a) A transformation matrix for scaling in x co-ordinate by a factor 3 is
[T] =
3 0
0 1
3 0
∴ [A][T] = [ 2 –4 ]
0 2
= [ 6 –8 ] = [A*]
(d) The transformation matrix for shearing in y-direction by 4 units is
1 4
[T] =
0 1
1 4
∴ [A][T] = [ 2 –4 ]
0 1
= [ 2 4 ]
(e) The transformation matrix for shearing in x and y directions by 2 and 5 units respectively
is
1 5
[T] =
2 1
1 5
∴ [A][T] = [ 2 –4 ]
2 1
= [ –6 6 ]
1.8 Combined Transformations
Transformations
The shape and the position of a curve in two dimensions or a surface in three dimensions is
controlled by performing matrix operations on the position vectors of the points. In general, to
obtain a desired orientation of original figure we need to perform two or more transformations.
Suppose, we perform successively three transformations on a point P [x y].
Let [T1], [T2] and [T3] be the respective transformations.
[P][T] = [ x y ][T] = [ x* y* ]
The matrix [T] is the combined transformation matrix. It is called as concatenated
transformation matrix. While finding the concatenated transformation matrix, the order in which
the operations are performed, that order is to be maintained. The reason is that the matrix
multiplication is not commutative.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.23 Two-Dimensional Trans. …
Illustrative Example
Example 1.6 : Find the combined transformation matrix for the following sequence of
transformations.
Solution : The transformation matrix for scaling in x and y co-ordinates by factors –1 and 2
respectively is
–1 0
[T1] =
0 2
The transformation matrix for reflection through x-axis is
1 0
[T2] =
0 –1
The transformation matrix for rotation about the origin, through an angle θ = 270o is
cos θ sin θ
[T3] =
–sin θ cos θ
cos 270o sin 270o 0 –1
= =
–sin 270o cos 270o 1 0
If [T] denotes the combined transformation matrix, then
[T] = [T1] [T2] [T3]
–1 0 1 0 0 –1
∴ [T] =
0 2 0 –1 1 0
–1 0 0 –1
∴ [T] =
0 2 –1 0
0 1
∴ [T] =
–2 0
If this transformation is applied on P [ 2 –3 ], then
0 1
[P] [T] = [ 2 –3 ] = [ 6 2 ]
–2 0
∴ P* is [ 6 2 ].
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.24 Two-Dimensional Trans. …
y
a+c
S B*
b
C B C*
R
c
b+d
d
A*
b
x O* a c
O x*
A P Q
Fig. 1.21
As shown in the first figure, above, OABC is a unit square with O [0 0], A [1 0], B [1 1] and
C [0 1].
a b
Then under the transformation matrix [T] = , the unit square OABC is transformed to
c d
parallelogram O*A*B*C*.
O 0 0
A [T] =
1 0 a b
B 1 1 c d
C 0 1
O*
0 0
a b A*
b+d
= =
a+c B*
c d C*
We note that the terms a and d on the main diagonal of [T] act as scale factors. Also the terms
b and c on the second diagonal cause a shearing of the initial square in y and x directions
respectively. Thus, the general 2 × 2 matrix produces a combination of shearing and scaling.
Now, we find the area of the parallelogram O*A*B*C*.
Area (~ O*A*B*C*) = Area ( ~ O*QB*S) – Area (∆ O*PA*)
– Area (~ PQB*A*) – Area (∆ O*C*R)
– Area (~ RC*B*S)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.25 Two-Dimensional Trans. …
1 1 1 1
= (a + c) (b + d) – ab – c (b + b + d) – cd – b (c + a + c)
2 2 2 2
1 1 1 1
= ab + ad + cb + cd – ab – bc – cd – cd – bc – ba
2 2 2 2
= ad – bc
= det [T]
From this we get,
Area of transformed region = (Area of initial region) (det [T])
Illustrative Examples
Example 1.7 : Apply each of the following transformations on the point P [3 – 2] :
1
(a) Scaling in x co-ordinate by 2 units and y co-ordinate by units.
4
(b) Shearing in x-direction – 2 units and y-direction by 5 units.
(c) Reflection through the line y = x.
(d) Rotation by 55° about origin.
(e) Reflection through the line y = – x.
Solution : (a) The transformation matrix for scaling in x co-ordinate by 2 units and y co-
2 0
1
ordinate by units is [T] =
4 0 1 .
4
2 0
[P] [T] = [3 – 2]
1
0 1 = 6 –
2
4
∴
P* 6 –
1
2
(b) The transformation matrix for shearing in x-direction by – 2 units and y direction by 5
units is
1 5
[T] =
–2 1
1 5
[P] [T] = [3 – 2] = [7 13]
–2 1
∴ P* [7 13]
(c) The transformation matrix for reflection through the line y = x is
0 1
[T] =
1 0
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.26 Two-Dimensional Trans. …
0 1
[P] [T] = [3 – 2] = [– 2 3]
1 0
∴ P* [– 2 3]
(d) The transformation matrix for rotation by 55° about the origin is
cos 55° sin 55°
[T] =
– sin 55° cos 55°
0.5735 0.8191
[P] [T] = [3 – 2]
– 0.8191 0.5735
= [3.3587 1.3103]
∴ P* [3.3587 1.3103]
(e) The transformation matrix for reflection through the line y = – x is
0 –1
[T] =
–1 0
0 –1
[P] [T] = [3 –2] = [2 – 3]
–1 0
∴ P* [2 – 3]
Example 1.8 : The position vectors of the line segment AB are A [2 3] and B [– 4 7]. It is
transformed to the line A' B' by using the transformation matrix
1 2
[T] = . Find the slope of A'B'.
3 4
Solution : The slope of the line AB where A [2 3] and B [– 4 7], is
y1 – y2 3–7 2
m = = =–
x1 – x2 2 +4 3
The transformation is
a b 1 2
[T] = =
c d 3 4
a = 1, b = 2, c = 3, d = 4.
b + dm
The slope of the transformation line A'B' is m* = .
a + cm
2
2 + (4) –
3 2
∴ m* = =
2 3
1 + (3) –
3
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.27 Two-Dimensional Trans. …
h* = h
ad – bc = 3 (1) (5) – (2) (2) = – 3
a + cm 1 + (2) (– 1)
The equation of the resulting line is
y* = m* x* + h*
∴ y* = 3x* – 3
Example 1.10 : A line L1 is transformed to line L2 : 2.37 x* – 1.543 y* = 5.642 under the
3 2.5
transformation matrix [T] = . Find the equation of line L1.
2.1 4.3
Solution : Let y = mx + h be the equation of line L1. The equation of line L2 is
y* =
2.37 x* + 5.642
1.543 1.543
i.e. y* = 1.5359 x* + 3.6565
a b 3 2.5
[T] = =
c d 2.1 4.3
∴ a = 3, b = 2.5, c = 2.1, d = 4.3
b + dm
Now, m* =
a + cm
2.5 + (4.3) (m)
∴ 1.5359 =
3 + (2.1) (m)
This gives m = 1.9611.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.28 Two-Dimensional Trans. …
Also, h = h
ad – bc
a + cm
∴ 3.6565 = h
(3) (4.3) – (2.5) (2.1)
3 + 2.1 m
∴ 3.6565 = h ×
12.9 – 5.25
3 + (2.1) (1.9611)
∴ 3.6565 = h × 1.0746
∴ h = 3.4026
Equation of original line L1 is
y = 1.9611 x + 3.4026
Example 1.11 : The line segment joining the points A [3 4], B [5 6] is transformed to the line
segment A' B' by the transformation matrix
2 1
[T] = . Find the mid-point of A' B'.
1 4
Solution : The mid-point of line segment AB where, A [3 4] and B [5 6] is
M
x1 + x2 y1 + y2 = [4 5].
2 2
We know that under 2 × 2 transformation matrix, the mid-point of segment AB is transformed
to the mid-point of segment A'B'.
2 1
[M*] = [M] [T] = [4 5] = [13 24]
1 4
∴ M* = [13 24]
1 1
Example 1.12 : Determine whether the transformation matrix
2 2 represents
1 1
2
–
2
reflection. Justify.
(May 2006)
1 1
1 1
Solution : [T] =
2 2
, det. [T]
2 2 =−1
1 1 1 1
2
–
2 2 –
2
1 1
1 1
Also, [T] [T]t =
2 2 2 2
1 1 1 1
2
–
2 2
–
2
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.29 Two-Dimensional Trans. …
1 0
= =I
0 1
From the above two results, [T] represents a reflection.
Example 1.13 : Find the concatenated transformation matrix and apply it on a triangle with
vertices O [0 0], A [1 2], B [3, – 1]. The sequence of transformations is given below :
Solution : The transformation matrix for rotation through 50° about origin is,
1 – 2.1
[T2] =
0 1
The transformation matrix for uniform scaling by factor 2 is
2 0
[T3] =
0 2
The concatenated transformation matrix is
[T] = [T1] [T2] [T3]
O
*
A
A* = B [T]
B* C
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.30 Two-Dimensional Trans. …
0
0
1.2854 – 1.1673
= 1
2
– 1.5320 4.5026
3 –1
0 0
= –1.7786 7.8379
5.3882 – 8.0045
Example 1.14 : Find the concatenated transformation matrix for the following sequence of
transformations. First scaling of x co-ordinate by factor 3; followed by scaling of y co-ordinate by
factor 5.
If we apply this transformation on the circle with centre at origin and radius 4, then find the
equation of the transformed figure.
3 0
[T1] =
0 1
The transformation matrix for scaling of y co-ordinate by factor 5 is
1 0
[T2] =
0 5
The concatenated transformation matrix is
3 0 1 0 3 0
[T] = [T1] [T2] = =
0 1 0 5 0 5
3 0
Then, [x y] [T] = [x y] = [3x 5y]
0 5
The co-ordinates of the transformed point are : x* = 3x, y* = 5y.
x* y*
Therefore, x = , y= .
3 5
Now, equation of the circle with centre at origin and radius 4 is x2 + y2 = 16.
2 2
x* y*
∴ + = 16
3 5
x*2 y*2
∴ + = 1, which is ellipse.
144 400
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.31 Two-Dimensional Trans. …
Example 1.15 : The triangle ABC with vertices A [3 –1], B [4 2] and C [2 1] is first rotated
through 90° about the origin and then reflected through y-axis. Find the vertices of transformed
triangle.
Solution : The transformation matrix for rotation through 90° about origin is
cos 90° sin 90° 0 1
[T1] = =
– sin 90° cos 90° –1 0
The transformation matrix for reflection through y-axis is
–1 0
[T2] =
0 1
The combined transformation matrix is
0 1 –1 0 0 1
[T] = [T1] [T2] = =
–1 0 0 1 1 0
Now, vertices of the triangle ABC are A [3 –1], B [4 2] and C [2 1].
A
*
A 3 –1
0 1
B* = B [T] = 4 2
1 0
C* C 2 1
A
*
–1 3
B* = 2 4
C* 1 2
The vertices of the transformed triangle are A* [–1 3], B* [2 4] and C* [1 2].
Example 1.16 : Find the concatenated transformation matrix and apply it on the triangle with
vertices A [1 2], B [3 –1], C [2 1]. The sequence of transformation is given below :
(i) Rotation about origin through an angle θ = 50°.
(ii) Shearing in y-direction by – 2.1 units.
(iii) Uniform scaling by factor 2.
Solution : The transformation matrix for rotation about origin through an angle θ = 50° is
cos 50° sin 50°
[T1] =
– sin 50° cos 50°
0.6427 0.7660
∴ [T1] =
– 0.7660 0.6427
The transformation matrix for shearing in y-direction by – 2.1 units is;
1 – 2.1
[T2] =
0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.32 Two-Dimensional Trans. …
∴ [T] =
0.6427 0.7760 1 −2.1 2 0
− 0.7660 0.6427 0 1 0 2
0.6427 0.7660 2 –4.2
∴ [T] =
–0.7660 0.6427 0 2
1.2854 – 1.1673
∴ [T] =
–1.5320 4.5026
The vertices of triangle are A [1 2], B [3 – 1], C [2 1].
If A*, B*, C* are the vertices of a transformed triangle, under the transformation matrix [T], then
A A
*
1 2
1.2854 –1.1673
B* = B [T]= 3 –1 –1.5320
4.5026
C* C 2 1
A
*
– 1.7786 7.8379
∴ B* = 5.3882 – 8.0045
C* 1.0388 2.1680
∴ A* [– 1.7786 7.8379], B* [5.3882 – 8.0045] and C* [1.0388 2.1680].
x = – x3 , y = – y*.
*
∴ x* = – 3x, y* = – y
–3 0
det [T] = =3
0 –1
3 1
Example 1.18 : If we apply transformation matrix [T] = on a square, then we get a
2 2
parallelogram of area 64 cm2. Find the length of each side of the original square.
3 1
Solution : The transformation matrix is [T] = .
2 2
Area of transformed parallelogram
= det. [T] × Area of original square
∴ 64 = (6 – 2) × Area of original square
∴ 16 = Area of original square
Example 1.19 : A circle with area 25 cm2 is transformed by using the transformation matrix
1 2
[T] = . Find the area of the transformed figure. (Oct. 2007)
–1 2
Solution : The transformation matrix is
1 2
[T] =
–1 2
1 2
det. [T] = =4
–1 2
Exercise 1.1
1. What is the effect of the transformation matrix :
(a)
1 0 on a two dimensional object ?
−2 1
(b)
1 0 on a two dimensional object ?
−1 0
2. Apply each of the following transformation on the point P[3 7] :
(a) Scaling in x co-ordinate by factor 2.
1
(b) Scaling in y co-ordinate by factor .
3
(c) Uniform scaling by 3 units.
3. The points O[0 0], A[1 0], B[1 1] and C[0 1] are transformed by 2 × 2 transformation matrix
[T] to the points O'[0 0], A'[2 3], B'[8 4] and C'[6 1] respectively. Find the matrix of
transformation.
* *
4. If a line segment joining the points A[1 1] and B[1 3] is transformed to the line segment A B
* *
where A [8 4] and B [20 6], then find 2 × 2 transformation matrix.
[T] =
2 1 to the lines L ' and L ' respectively. Find the point of intersection of L ' and L ' .
−1 2 1 2 1 2
7. The lines L1 : 3x + 2y = 12 and L2 : L 2x − 3y = 5 are transformed to the line L1' and L2' . Find the
point of intersection of L1' and L2' .
* * * *
8. The lines AB and EF are transformed to the lines A B and E F respectively by the
transformation matrix T =
1 2 . If A[−1 −1], B 3 5 , E − 1 3 and F[3 −2] then find
1 −3 3 2 2
* * * *
the point of intersection of A B and E F .
9. What will be the effect, in combined transformations when the order of the transformations is
changed ?
10. Show the combined two dimensional transformation first reflection about the x-axis and then
about the line y = −x is equivalent to the rotation about the origin by 270° :
11. (a) Find the angle of rotation required to rotate the line y = 2x about the origin so that it is
coincident with the x-axis.
(b) Find the angle through which the line y = −x is rotated so that it coincides with the
x-axis.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.35 Two-Dimensional Trans. …
12. Find the concatenated transformation matrix for the following sequence : First rotation about
origin through 30° followed by shearing in x direction by −2 units.
13. Find the concatenated transformation matrix for the following transformations in order :
(i) Rotation about origin through 45°.
(ii) Shearing in x direction by −2 units.
Apply it to the vector [1 2].
14. The line segment between the points A[−1 −3] and B[3 4] is transformed to the line segment
transformation [T] =
a b and show that the area of transformed parallelogram is equal to
c d
det. [T].
Answers 1.1
1. (a) Shearing in x co-ordinate by factor − 2.
(b) Shearing in x co-ordinate by factor − 1.
3. [T] =
2 3
6 1
4. [T] =
2 3
6 1
* *
5. y = 4x + 7
6.
22 2
3
7. [1 5]
8. [1 1]
−1
11. (a) tan (− 2), (b) 225°
12. T
− 0.134 0.5
− 2.232 0.866
13. [T] =
− 0.7071 0.7071 , P* [− 4.9497 2.1213]
− 2.1213 0.7071
14. [1 5]
15. [2 10]
16. A[− 1 8], B[− 3 7], C[− 2 6]
17. A[0 0], B[− 1.0041 0], C[− 1.0042 1.0041], D[0 1.0041]
2
18. 4 cm
19. 196 π
20. 441 π
* * *
21. A [−1 3], B [2 4], C [1 2]
35 45
[T1] = 4 3 then
− 5 5
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.37 Two-Dimensional Trans. …
A [T ] = 2 1
35 45
B 1 −3 2 4 3
− 5 5
A [T ] =
25 11
5 *
A
B 1 17
6
= *
B
− 5 −
5
C [T ] = 4 −2
35 45
Also,
D 1 5 3 4 3
− 5 5
4 2 *
∴
C [T ] = 3 29 = C *
D 1 D
5 5
11 6
+
* *
5 5 17
We observe that, the slope of the line A B is = .
2 17 19
+
5 5
29
2–
5 19
and the slope of line C* D* is = – . Therefore, the lines A*B* and C*D* are
3 17
4–
5
perpendicular lines. In this case the perpendicular lines are transformed to perpendicular lines.
2 2
Now, consider the transformation matrix [T2] = . We have
3 1
A 2 1 2 2 7 5 A**
[T2] = = =
B –3 2 3 1 0 – 4 B**
C 4 –2 2 2 2 6 C**
[T2] = = =
D 5 3 3 1 19 13 D**
5+4 9 6 – 13 7
The slope of A** B** is = and the slope of C** D** is = .
7–0 7 2 – 19 17
The lines A** B** and C** D** are not perpendicular.
Thus, under the transformation matrix [T2] the perpendicular lines are transformed to the lines
which are not perpendicular.
We now obtain the condition under which the perpendicular lines are transformed to
perpendicular lines. The required condition in its more general form is the condition under which
the angle between two given lines is preserved under the transformation matrix [T].
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.38 Two-Dimensional Trans. …
– – – – – –
Let v1 = v1x i + v1y j and v 2 = v2x i + v2y j be the vectors represented by the line segments
AB and CD.
– – – –
Then, v1 · v2 = |v1| |v2| cos θ = v1x v2x + v1y v2y … (1)
– – – – – –
and v1 × v2 = |v1| |v2| sin θ k = (v1x v2y – v1y v2x) k … (2)
– –
where, θ is the acute angle between the lines of action of v1 and v2.
a b – –
If [T] = is the transformation matrix, then the transformed form of v1 and v2 is
c d
–v* 1
–
v1
[T] = 1x 1y a b
v v
–* =
– v2x v2y c d
v 2 v2
– – –
Also v1 × v2 = [(a v1x + c v1y) (b v2x + d v2y) – (b v1x + d v1y) (a v2x + c v2y)] k
– – –
∴ v1 × v2 = [(ad – bc) (v1x v2y – v1y v2x)] k … (5)
Now, we assume that the angle between the vectors is preserved and also their magnitudes
– – –* –*
are preserved. This requires v1 · v2 = v1 · v2 .
– – –* –*
and v1 × v2 = v1 × v2
Then the comparison of (1) with (4) and the comparison of (2) with (5) gives
a2 + b2 = 1 … (6)
c2 + d2 = 1 … (7)
ac + bd = 0 … (8)
ad – bc = 1 … (9)
a b a c
Now, [T] [T]t =
c d b d
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.39 Two-Dimensional Trans. …
a2 + b2 ac + bd
=
ac + bd c2 + d2
1 0
= =I . . by (6), (7) and (8)
.
0 1
This means the matrix [T] is orthogonal.
a b
Also det. [T] = = ad – bc = 1 . . by (9)
.
c d
Thus, if the transformation matrix [T] is orthogonal and det. [T] = 1, then the perpendicular
lines are transformed to perpendicular lines and also the magnitudes are preserved.
Note : The transformation matrix of a reflective transformation is orthogonal with its
determinant equal to – 1. In this case the magnitudes of vectors is preserved. However, the angle θ
between original lines becomes 2π – θ between transformed lines and hence the perpendicular
lines are still transformed to perpendicular lines.
Note : The uniform scaling preserves the angle between the lines but in this case the
magnitudes of vectors are not preserved.
a b 0
[T] = c d 0
m n 1
The constants m and n appearing in this matrix are called as translation factors in x and y
directions respectively.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.40 Two-Dimensional Trans. …
The equations x* = ax + cy + m
y* = bx + dy + n
are written using homogeneous co-ordinates as
a b 0
[x* y* 1] = [x y 1] c d 0
m n 1
We note that under this transformation, origin is also changed to the point [m n].
Illustrative Example
Example 1.20 : A point P [4 2 1] in a plane is transformed to the point P* [x* y* 1] under the
0 –2 2
homogeneous transformation matrix [T] = –2 2 –2 . Prove that x*
2+ y*2 = 1.
1 0 1
(April 1994)
0 –2 2
Solution : P [4 2 1] and [T] = –2 2 –2 implies
1 0 1
0 –2 2
[P] [T] = [4 2 1] –2 2 –2 = [– 3 – 4 5]
1 0 1
Now, [P*] = [P] [T]
∴ P* = [– 3 – 4 5] = –
3 – 4 1
5 5
∴ [x* y* 1] =
– 3 – 4 1
5 5
3 4
∴ x* = – , y* = –
5 5
1 0 0
Translation matrix [T1] = 0 1 0 .
–m –n 1
(ii) Rotation about origin :
cos θ sin θ 0
Rotation matrix [T2] = – sin θ cos θ 0 .
0 0 1
(iii) Translation back to the point [m n 1] :
1 0 0
Translation matrix [T3] = 0 1 0 .
m n 1
The concatenated transformation matrix for rotation about an arbitrary point [m n 1] is
[T] = [T1] [T2] [T3]
1 0 0 cos θ sin θ 0 1 0 0
= 0 1 0 – sin θ cos θ 0 0 1 0
–m –n 1 0 0 1 m n 1
cos θ sin θ 0
= – sin θ cos θ 0
m (1 – cos θ) + n sin θ n (1 – cos θ) – m sin θ 1
Illustrative Examples
Example 1.21 : Rotate the triangle ABC about its centroid through an angle 45°, where
A [2 – 4], B [3 0] and C [–2 1]. (April 2008)
Solution : The vertices of a triangle ABC are A [2 – 4], B [3 0] and C [– 2 1].
At the centroid G [x y] we have
x1 + x2 + x3 2+3–2
x = = =1
3 3
y1 + y2 + y3 –4+0+1
y = = =–1
3 3
∴ G [1 – 1]
The angle of rotation about G [1 – 1] is θ = 45°.
The required transformation matrix is
1 0 0
cos 45° sin 45° 0
1 0 0
[T] = 0 1 0 – sin 45° cos 45° 0 0 1 0
–1 1 1 0 0 1 1 –1 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.42 Two-Dimensional Trans. …
2 1
1 1
0
1 0
2
1 0 0
0 0
∴ [T] = 0 1 0 1 1 0
–1 1 – 2 2
0
1 1
0 1
1 –1
0
2
1 1
2
1 1
0 0
2
1 = 1
2
1 0 0
∴ [T] = 0 1 0 1 1
–1 1 – 2 2
0
– 2 2
0
1 1
1
–1 – 2+1 –1 1
2
1 1
0
2
1
A 2 –4 1
Now, B [T] = 3 0 1 1
C –2 1 1 – 2 2
0
– 2+1 –1 1
212+1 – 2–1 1
=
2+1 3
2
–1 1
– 5 +1
2
1
– –1 1
2
A* [2 2+1– 2 – 1],
1 +1
B*
3
– 1 and C* –
5 + 1 – 1 – 1
2 2 2 2
Example 1.22 : An object is rotated through angle 90° about the point [4 3]. Find the
transformation equations.
Solution : The rotation about the point [4 3] through an angle 90° is achieved by the
transformation matrix.
1 0 0
cos 90° sin 90° 0
1 0 0
[T] = 0 1 0 – sin 90° cos 90° 0 0 1 0
–4 –3 1 0 0 1 4 3 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.43 Two-Dimensional Trans. …
1 0 0
0 1 0
1 0 0
∴ [T] = 0 1 0 –1 0 0 0 1 0
–4 –3 1 0 0 1 4 3 1
1 0 0
0 1 0
0 1 0
∴ [T] = 0 1 0 –1 0 0 = –1 0 0
–4 –3 1 4 3 1 7 –1 1
Now, [x* y* 1] = [x y 1] [T]
0 1 0
∴ [x* y* 1] = [x y 1] –1 0 0
7 –1 1
The transformation equations are
x* = – y + 7
y* = x – 1
1 0 0
Translation matrix [T1] = 0 1 0 .
–m –n 1
(ii) Rotate the resulting line about origin such that the resulting line coincides with x-axis
(or y-axis).
Let T2 be the rotation matrix.
(iii) In step (ii) if the resulting line coincides with x-axis, then take reflection of an object in
x-axis.
1 0
Reflection matrix [T3] = .
0 –1
In step (ii) if the resulting line coincides with y-axis, then take reflection of an object in
y-axis.
–1 0
Reflection matrix [T3] = .
0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.44 Two-Dimensional Trans. …
(iv) Rotate in backward direction by using the matrix [T4] which is inverse of [T2].
[T4] = [T2]–1
(v) Translate back to original location by using the matrix [T5] which is inverse of [T1].
[T5] = [T1]–1
Then the required transformation is accomplished by the combined transformation matrix.
[T] = [T1] [T2] [T3] [T4] [T5]
= [T1] [T2] [T3] [T2]–1 [T1]–1
Illustrative Examples
Example 1.23 : Using concatenated matrix, reflect the triangle ABC through the line y = 5,
where A [1 3], B [2 4] and C [3 5]. (March 2006)
Solution : The line y = 5 is parallel to x-axis and the point [0 5] is on the line.
We translate the line in such a way that the resulting line passes through the origin. By
considering the point [0 5] on the line, the translation matrix is
1 0 0
[T1] = 0 1 0
0 –5 1
Now, the resulting line coincides with x-axis.
Now, for reflection of ∆ ABC in x-axis the reflection matrix is
1 0 0
[T2] = 0 –1 0
0 0 1
For back translation the translation matrix is
1 0 0
[T3] = [T1]–1 = 0 1 0 .
0 5 1
The concatenated transformation matrix is
[T] = [T1] [T2] [T3]
1 0 0
1 0 0
1 0 0
∴ [T] = 0 1 0 0 –1 0 0 1 0
0 –5 1 0 0 1 0 5 1
1 0 0
1 0 0
1 0 0
= 0 1 0 0 –1 0 = 0 –1 0
0 –5 1 0 5 1 0 10 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.45 Two-Dimensional Trans. …
A
*
A 1 3 1
1 0 0
B* = B [T] = 2 4 1 0 –1 0
C* C 3 5 1 0 10 1
A
*
1 7 1
∴ B* = 2 6 1
C* 3 5 1
1 0 0
[T1] = 0 1 0
0 –2 1
Now, we rotate the line in such a way that the resulting line will coincide with x-axis. This
requires the angle of rotation – θ.
The rotation matrix is
cos (– θ) sin (– θ) cos θ – sin θ
[T2] = =
– sin (– θ) cos (– θ) sin θ cos θ
5
4 3
– 0
3
5
∴ [T ] = 4
5
2
0
5
0 0 1
Next the reflection in x-axis is achieved by using the reflection matrix
1 0 0
[T3] = 0 –1 0
0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.46 Two-Dimensional Trans. …
4 3
0
3
5 5
[T4] = [T2]–1 = 4
–5 5
0
0 0 1
Back translation matrix is
1 0 0
[T5] = [T1]–1 = 0 1 0
0 2 1
The required transformation matrix is
[T] = [T1] [T2] [T3] [T4] [T5]
1 5 1
4 3 4 3
– 0 0
0 3 0
5 4 5
1 0 0 0 0
0 0
∴ [T] = 0 1 0 3 4 –1 0 4 1 0
0 1 5 0 1 –5 0 1
0 0
5 5
–2
0 0 1
0
0 0 1
2
25
7 24
0
25
=
24 –
7
0
2548 25
– 25 64
25
1
The vertices of a triangle ABC are A [0 0], B [1 2] and C [4 4]. If triangle A* B* C* is the
transformed triangle, then
A
*
A
B* = B [T]
C* C
7 24
0
25 25
A*
0 0 1
24 7
B* = 1 2 1 – 0
1
25 25
C* 4 4
– 4825 64
25
1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.47 Two-Dimensional Trans. …
– 25
48 64
1
25
A*
7 74
∴ B* = 1
C* 2576 25
25 132
25
1
1 0 0
[T1] = –2.5 1 0
0 1 1
The transformation matrix for translation in x and y-directions by – 1.2 and – 3.9 units
respectively is;
1 0 0
[T2] = 0 1 0
–1.2 –3.9 1
1
The transformation matrix for scaling in x and y co-ordinates by the factors and 2.1
2
respectively is
12 0 0
[T3] =
0 2.1 0
0 0 1
The concatenated transformation matrix is
[T] = [T1] [T2] [T3]
1 0 0
1 0 0
2
1
0 0
∴ [T] = –2.5 1 0 0 1 0
0 1 –1.2 1
0 2.1 0
0 –3.9
0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.48 Two-Dimensional Trans. …
1 0 0
0.5 0 0
∴ [T] = –2.5 1 0 0 2.1 0
0 0 1 –0.6 –8.19 1
0.5 0 0
∴ [T] = –1.25 2.1 0
–0.6 –8.19 1
Example 1.26 : The position vector [2 5] is rotated about the point [4 3] by an angle θ = 90°.
By using homogeneous system obtain the position vector of the transformed point.
Solution : The concatenated transformation matrix for rotation about the point [4 3] by an
angle θ = 90° is
1 0 0
cos 90° sin 90° 0 1 0 0
[T] = 0 1 0 – sin 90° cos 90° 0 0 1 0
–4 –3 1 0 0 1
4 3 1
1 0 0
0 1 0 1 0 0
∴ [T] = 0 1 0 –1 0 0 0 1 0
–4 –3 1 0 0 1 4 3 1
1 0 0
0 1 0 0 1 0
∴ [T] = 0 1 0 –1 0 0 = –1 0 0
–4 –3 1 4 3 1 7 –1 1
Now, P [2 5 1]. The transformed point P* is given by
0 1 0
[P*] = [P] [T] = [2 5 1] –1 0 0 = [2 1 1]
7 –1 1
The position vector of P* is [2 1].
Example 1.27 : Rotate the line segment AB; where A [2 1] and B [5 7] , about it's point of
trisection near A, by an angle of 35°.
Solution : A [2 1] and B [5 7]. By section formula the point of trisection of segment AB near
A is [3 3].
The concatenated transformation matrix for rotation about the point [3 3] by an angle 35° is
1 0 0
cos 35° sin 35° 0
1 0 0
[T] = 0 1 0 – sin 35° cos 35° 0 0 1 0
–3 –3 1 0 0 1
3 3 1
1 0 0
0.8191 0.5735 0
1 0 0
∴ [T] = 0 1 0 – 0.5735 0.8191 0 0 1 0
–3 –3 1 0 0 1
3 3 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.49 Two-Dimensional Trans. …
1 0 0 0.8191 0.5735 0
∴ [T] = 0 1 0 –0.5735 0.8191 0
–3 –3 1 3 3 1
0.8191 0.5735 0
∴ [T] = – 0.5735 0.8191 0
2.2632 – 1.1778 1
2 1 1
0.8191 0.5735 0
A* A
5 7 1
= [T] = – 0.5735 0.8191 0
B
B* 2.2632 – 1.1778 1
A* 3.3279 0.7883 1
∴ =
B* 2.3442 7.4234 1
∴ A* [3.3279 0.7883], B* [2.3442 7.4234]
Example 1.28 : Rotate the triangle ABC with vertices A [1 2], B [3 6], C [3 1] through an angle
90° about the point [2 4]. (October 2007)
Solution : The concentrated transformation matrix for rotation about the point [2 4] through
the angle 90° is
1 0 0
cos 90° sin 90° 0 1 0 0
[T] = 0 1 0 – sin 90° cos 90° 0 0 1 0
–2 –4 1 0 0 1
2 4 1
1 0 0
0 1 0 1 0 0
∴ [T] = 0 1 0 –1 0 0 0 1 0
–2 –4 1 0 0 1 2 4 1
1 0 0
0 1 0 0 1 0
∴ [T] = 0 1 0 –1 0 0 = –1 0 0
–2 –4 1 2 4 1 6 2 1
The vertices of triangle ABC are A [1 2], B [3 6] and C [3 1].
If the triangle is A* B* C*, the
A
*
A 1 2 1
0 1 0
B* = B [T] = 3 6 1 –1 0 0
C* C 3 1 1 6 2 1
A
*
4 3 1
∴ B* = 0 5 1
C* 5 5 1
∴ A* [4 3], B* [0 5], C* [5 5]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.50 Two-Dimensional Trans. …
Example 1.29 : Reflect the triangle ABC through the line 3x – y = 0; where A [– 2 – 3],
B [– 10 – 6], C [– 15 – 10].
Solution : The line y = 3x passes through origin. Hence translation is not needed.
∴ tan θ = 3 sin θ = 3
10
, cos θ =
1
10
.
The transformation matrix for rotation about origin through an angle – θ is;
cos (– θ) sin (– θ) 0
cos θ – sin θ 0
[T1] = – sin (– θ) cos (– θ) 0 = sin θ cos θ 0
0 0 1 0 0 1
1 3
– 0
10 10
∴ [T ] = 3 1
1
0
10 10
0 0 1
1 0 0
[T2] = 0 –1 0
0 0 1
The transformation matrix for rotation about origin through an angle θ is [T3] = [T1]–1 = [T1]t.
1 3
– 0
10 10
∴ [T ] = 3 1
3
0
10 10
0 0 1
The concatenated transformation matrix is [T] = [T1] [T2] [T3].
1 10
1 3 1 3
– 0 0
0
10 10 0 0 10
∴ [T] = 3 1 –1 0 3 1
10 10
0
0 1
–
10 10
0
1 0 1
0
0 0 0
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.51 Two-Dimensional Trans. …
10 10 10
1 3 1 3
– 0 0
3 3 1
10
∴ [T] = 1
10 10
0
– 10 10 0
0 0 1 0 0 1
– 10 –5 5 0
8 6 4 3
0
6 = 3 4
10
∴ [T] = 8
10 10
0
5 5 0
0 0 1 0 0 1
The vertices of triangle ABC have co-ordinates A [–2, –3, 1], B[–10, –6, 1], C[–15, –10, 1].
If A*, B*, C* are the vertices of transformed triangle, then
4 3
– 0
A*
A –2 –3 1
5 5
B* = B [T] = –10 –6 1 3 4
C –15 1
0
C* 5 5
–10
0 0 1
1 18
– – 1
A*
22
5 5
∴ B* = 54
C* 5 –
5
1
6 – 17 1
1 – 18 1 , B* 22 – 54 1 , C* 6 – 17 1 .
A* –
∴
5 5 5 5 [ ]
Example 1.30 : Find the concatenated transformation matrix for reflection through the line
y = – 4. Apply it to the position vector [– 1 2].
Solution : The point [0 – 4] lies on the line y = – 4.
The translation matrix is
1 0 0
[T1] = 0 1 0
0 4 1
Now, the line coincides with x-axis. The reflection matrix for reflection through x-axis is
1 0 0
[T2] = 0 –1 0
0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.52 Two-Dimensional Trans. …
1 0 0
[T3] = 0 1 0
0 –4 1
The concatenated transformation matrix is [T] = [T1] [T2] [T3].
1 0 0
1 0 0
1 0 0
∴ [T] = 0 1 0 0 –1 0 0 1 0
0 4 1 0 0 1 0 –4 1
1 0 0
1 0 0
1 0 0
∴ [T] = 0 1 0 0 –1 0 = 0 –1 0
0 4 1 0 –4 1 0 –8 1
Now, P [–1 2 1]
1 0 0
[P*] = [P] [T] = [–1 2 1] 0 –1 0 = [–1 – 10 1]
0 –8 1
The position vector of P* is [–1 – 10].
Example 1.31 : Obtain the combined transformation matrix for the following sequence of
transformations :
Reflection through the line y = – x, shearing in x and y directions by 3 and – 4, units
receptively.
Translation in x and y direction by – 1 and 2 units respectively.
Apply it on the point P [3 – 8].
Solution : The transformation matrix for reflection through the line y = – x is
0 –1 0
[T1] = –1 0 0
0 0 1
The transformation matrix for shearing in x and y directions by 3 and – 4 units respectively.
1 –4 0
[T2] = 3 1 0
0 0 1
The transformation matrix for translation in x and y directions by –1 and 2 units respectively is
1 0 0
[T3] = 0 1 0
–1 2 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.53 Two-Dimensional Trans. …
0 –1 0
1 –4 0 1 0 0
∴ [T] = –1 0 0 3 1 0 0 1 0
0 0 1 0 0 1 –1 2 1
0 –1 0
1 –4 0
∴ [T] = –1 0 0 3 1 0
0 0 1 –1 2 1
–3 –1 0
∴ [T] = –1 4 0
–1 2 1
Now, we apply matrix [T] on the point P [3 – 8 1].
–3 –1 0
[P*] = [P] [T] = [3 – 8 1] –1 4 0
–1 2 1
∴ [P*] = [–2 – 33 1].
Example 1.32 : Reflect the square with vertices O [0 0], A [2 0], B [2 2], C [0 2] through the line
2x – y + 4 = 0.
Solution : We take any point say [1 6] on the line 2x – y + 4 = 0.
The transformation matrix for translation is;
1 0 0
[T1] = 0 1 0
–1 –6 1
The line 2x – y + 4 = 0 has slope tan θ = 2.
2 1 2 1
Therefore, sin θ = , cos θ = , sin (– θ) = – , cos (– θ) = .
5 5 5 5
The transformation matrix for rotation by angle – θ is;
cos (– θ) sin (– θ) 0
[T2] = – sin (– θ) cos (– θ) 0
0 0 1
1 2
– 0
5 5
∴ [T ] = 2 1
2
0
5 5
0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.54 Two-Dimensional Trans. …
1 0 0
[T3] = 0 –1 0
0 0 1
Back rotation matrix by an angle θ is
1 2
0
5 5
1 0 0
[T5] = 0 1 0
1 6 1
The concatenated matrix of translation is
[T] = [T1] [T2] [T3] [T4] [T5].
1
1 2
– 0
0
5 5
1 0 0 0 0
∴ [T] = 0 1 0 2 1 –1 0
–1 1 0 1
0
5 5
1
–6 0
0 0
5 1
1 2
0
2 0
5 0 0
1 1 0
– 5 5
0
1 1
0 1
6
0
The calculations give
–5
3 4
0
5
[T] =
4 3
0
516 5
–5 8
5
1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.55 Two-Dimensional Trans. …
We apply this transformation matrix on the square with vertices O [0 0], A [2 0], B [2 2], C [0 2].
A
O*
* OA
B *
=
B
[T]
C * C
3 4
A
O* – 0
0 0 1 5 5
*
2 0 1 4
B
3
∴ = 0
C
* 2
0
2 1
1
5 5
* 2
–
16
5
8
5
1
16 8
– 1
A – 225
5 5
O *
16
∴
*
B = – 14
5
1
1
* 22
C 5
*
5
– 85 14
5
1
O* –
16 8 , A* – 22 16 , B* – 14 22 , C* – 8 14 .
5 5 5 5 5 5 5 5
Think Over It
1. Prove that, the multiplication of transformation matrices for each of the following sequence
of operations is commutative :
(a) Two successive rotations. (b) Two successive translations.
(c) Two successive scalings.
2. Prove that, a uniform scaling and a rotation form a commutative pair of operations but that,
in general, scaling and rotation are not commutative operations.
3. Show that the order in which the transformations are performed is important by the
transformation of a triangle A[1 0], B[0 1], C[1 1] by :
(a) rotating 45° about the origin and then translating in the direction of vector ?
(b) translating and then rotating.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.56 Two-Dimensional Trans. …
4. A diamond shaped polygon has vertices A[−1 0], B[0 −2], C[1 0], D[0 2]. Reflect this
polygon about :
(a) the horizontal line y = 2.
(b) the vertical line x = 2.
(c) the line y = x + 2.
Points to Remember
2. If a = d > 1 then
a 0 produces pure enlargement of the co-ordinates of point P and if
0 1
a = d < 1 then
a 0
0 a produces compression of the co-ordinates of the point P.
3. If T =
a b is the transformation matrix, then the scaling effect is governed by the entries a
c d
and d on the main diagonal of [T]; while the shearing effect is governed by the entries b and c
on the second diagonal of {T].
4. Scaling :
(i)
a 0 produces scaling in x-co-ordinate by factor a.
0 1
(ii)
1 0 produces scaling in y-co-ordinate by factor d.
0 d
(iii)
a 0 produces scaling in x and y co-ordinate by units a and d respectively.
0 d
(iv)
a 0 produces uniform scaling by factor a.
0 a
5. Reflection :
(i)
1 0 represents reflection through x-axis.
0 −1
(ii)
−1 0 represents reflection through y-axis.
0 1
(iii)
0 1 represents reflection through the line y = x.
1 0
(iv)
0 −1 represents reflection through the line y = − x.
−1 0
(v)
−1 0 represents reflection through origin.
0 −1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.57 Two-Dimensional Trans. …
6. Shearing :
(i)
1 0 produces shearing along x-axis by factor c.
c 1
(ii)
1 b produces shearing y-axis by factor b.
0 1
(iii)
1 b produces shearing along x-axis and y-axis by factors b and c respectively.
c 1
7. Mid-point transformation :
* * *
When line L joining the points A[x1 y1] and B[x2 y2] is transformed into a line L joining A [x1
* * * *
y1] and B [x2 y2] under [T] then :
* *
(i) The mid-point of AB corresponds to the mid-point of A B .
(ii) In general if a point P divides AB in the ratio λ : 1, then under the transformation [T] it
* * *
will be transformed into a point P that divides A B in the same ratio λ : 1. Hence, there
* *
is one-one correspondence between the points on AB and the points on A B.
11. The transformation matrix for rotation about origin through angle θ is [T] =
cos θ sin θ .
− sin θ cos θ
12. If the transformation matrix [T] is orthogonal and det. [T'] = 1, then perpendicular lines are
transformed to perpendicular line.
13. If [T] = −1 then magnitudes of the vectors are preserved but; the angle θ between original
lines becomes 2π − θ between the transformed lines.
14. The uniform scaling preserves the angle between the lines but in this case the magnitudes of
vectors are not preserved.
* *
15. The equations x = ax + cy + m, y = bx + dy + n are written in homogeneous co-ordinate
system as
a b 0
* *
[x y 1] = [x y 1]
c d 0 .
m n 1
16. For reflection through an arbitrary line, we write
−1 −1
[T] = [T1] [T2] [T3] [T2] [T1]
where, T1 is the translation matrix.
T2 is the rotation matrix about the origin. T3 is the reflection matrix.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.58 Two-Dimensional Trans. …
12 2
3
8. The effect of the transformation matrix on a two dimensional object is rotation
3 1
2
−
2
about origin through angle 60° in clockwise sense.
a 0 − ah + h
12. The general form of a scaling matrix with respect to a fixed point P[h k] is 0 b − bx + k .
0 0 1
* *
13. The 45° rotation of triangle A[0 0], B[1 1], C[5 2] about the origin leads to A [0 0], B [0 2],
* 5 7
C .
2 2
ANSWERS
7. A line segment joining A[4 9] and B[−2 1] is scaled uniformly by factor 2. Then the mid-point
of the transformed line segment is ……
(a) [10 2] (b) [1 5]
(c) [2 10] (d) [3 5]
8. The combined two dimensional transformation first reflection about x-axis and then about the
line y = −x is equivalent to the rotation about the origin by ……
(a) 136° (b) 270°
(c) 45° (d) 120°
(a) tan
−1 1 (b) tan
−1
(−2)
2
−1 −1
(c) tan (−3) (d) tan (3)
11. The concatenated transformation matrix for reflection through the line y = 4 is ……
0 0 0 0 0 0
(a) 0 1 0
(b) 0 −1 0
0 10 1 0 1 10
0 0 0 0 0 0
(c) 0 −1 0
(d) 0 0 1
0 10 1 0 10 1
2
12. The slope of original line is and that of the transformed line is −1. Then [T] is ……
5
(a)
−1 3 (b)
3 −1
5 0 5 0
(c)
1 −3 (d)
3 1
5 0 5 0
13. The general form of a scaling matrix with respect to a fixed point P(h, k) is ……
a 0 ah − h a 0 − ah + h
(a) 0 b bk − b
(b) 0 b − bk + b
0 0 1 0 0 1
a 0 ah
(c)
0 b bk (d) none of these
0 10 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.61 Two-Dimensional Trans. …
14. An object is rotated by 30° about the origin. The matrix which represents this rotation is ……
− 23 − 1
2 23 − 1
2
(a) 1 3
(b) 1 3
2 2 2 2
− 2 3 − 1
2
(c) −1 − 3
(d) None of these
2 2
15. The concatenated transformation matrix for reflection through the line y = 4 is ……
0 −1 0 0 0 0
(a) 0 0 0
(b) 0 −1 0
0 10 1 0 10 1
0 −1 0
(c) 0 10 1
(d) none of these
0 0 0
16. The line segment AB is rotated about the point [2 1] through 90°; where A[3 5] and B[4 1].
Then ……
* * * *
(a) A [−2 2 −1], B [2 31] (b) A [2 3 1], B [−2 2 1]
* * * *
(c) A [−2 −2 1], B [2 −3 1] (d) A [−2 2 1], B [2 3 1]
17. The 45° rotation of triangle A[0 0], B[1 1], C[5 2] about the point P[−1 −1] leads to ……
* * *
(a) A [−1 2], B [1 2 − 1] , C [1 2]
* * * 3 2 − 1 9 9
(b) A [−1 2 − 1], B [−1 2 2 − 1], C −
2
2
* * *
(c) A [1 − 2], B [−1 2], C [7 − 2]
* * *
(d) A [ 2 − 1 2], B [1 2 2], C [2 2 −1]
Answers
[T] =
a b . (P.U. March 2008)
c d
2. Write the transformation matrix for reflection through the line y = x. (P.U. Oct. 2012)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.62 Two-Dimensional Trans. …
* *
3. Prove that, mid-point of the line segment AB is transformed to the mid-point of segment A B
under 2 × 2 transformation matrix [T]. (P.U. Oct. 2012)
4. Prove that under any 2 × 2 transformation matrix, the mid-point M of the line segment AB is
* * *
transformed into the mid-point M of the transformed line segment A B .
(P.U. April 2005, Oct. 2007)
*
5. Suppose the 2 × 2 transformation matrix transforms the points P and Q to the points P and
*
Q respectively. If R divides segment PQ internally in the ratio m : n then prove that its
* * *
transformed point R divides segment P Q internally in the ratio m : n. (P.U. March 2009)
6. Prove that, if the line y = mx + k is transformed to the line
* * *
y = m x + k+* by 2 × 2 transformation matrix
T=
a b then m* = b + dm and K* = K ad − bc (P.U. April 2005)
c d a + cm a + cm
20. Find the form of the matrix for reflection about a line L with slope m and y intercept (0 b).
21. Obtain the condition under which the perpendicular lines are transformed onto perpendicular
lines; under the transformation matrix T.
(D) Numerical Problems :
π
1. An object is rotated about the point [5 3] through an angle . Find the concatenated matrix
2
of transformation.
2. Find the concatenated transformation matrix for the following sequence of transformations :
shearing in x and y directions by −2 and 3 units respectively, followed by translation in x and y
directions by − 3.2 and 1.6 units respectively, followed by scaling y co-ordinate by factor 4.
c
3. An object is rotated about the point [−1 2] through π . Find the concatenated matrix of
transformation.
4. Find the matrix that represents rotation of an object by 30° about the origin. What are the
new co-ordinates of the point [2 −4] after the rotation ?
5. Show that the parallel lines AB and CD are not transformed onto parallel lines under the
1 0 1
transformation matrix [T] = 0 1 2 where, A[1 2], B[2 4], C[2 6] and D[3 8].
0 0 1
6. Consider a triangle with vertices A[3 6], B[6 9], C[3 9]. Rotate the triangle about the point
[−2 1] through an angle 35°. Write the position vectors of the transformed triangle.
7. By using concatenated matrix of transformation reflect the triangle ABC through the line y = 5;
given that A[1 3], B[2 4] and C[3 5].
π
8. Rotate the line segment between the points A[1 2] and B[3 6] by about the mid-point of
2
segment AB.
9. Obtain the concatenated transformation matrix and apply it on the line segment joining [1 2]
and B[0 4]. The sequence of transformations is as below.
Translation in y-direction by 2 units and then rotation about the origin by θ = − 40°.
10. Find the concatenated transformation matrix for the following sequence of transformations :
Reflection through the line y = x, shearing in x and y directions by 1 and −2 units respectively.
Apply it onto the point P[4 −2].
11. Reflect the triangle ABC through the line x − 2y + 4 = 0 where A[2 4], B[4 6] and C[2 6].
12. Find the concatenated transformation matrix for the following sequence of transformations :
Shearing in y-direction by − 3.4 units, followed by translation in x and y directions by − 5.2
and − 1.3 units respectively, followed by scaling in x and y coordinates by factor 2.1 and 1.2
respectively.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 1.64 Two-Dimensional Trans. …
Answers
0 1 0
1.
[T] = −1 0 0
8 −2 1
1 12 0
2.
[T] = −2 4 0
−3.2 6.4 1
−1 0 0
3. [T] =
0 −1 0
−2 4 1
23 − 1
2 3+2
4. 1 3
,
1 − 2 3
2 2
*
6. A [0.228 7.963 1]
*
B [− 0.0352 12.1408 1]
*
C [− 2.4925 10.4203 1]
* * *
7. A [1 7], B [2 6], C [3 5]
* *
8. A [4 3 1], B [0 5 1]
0.7660 − 0.6427 0
9. [T] =
0.6427 0.7660 0
−1.2854 0.4680 1
* *
A [0.7660 1.3573 1], B [1.2854 3.5320 1]
−3 1 0
10. [T] = 1 2 0 , P*[−13 −2 1]
1 −2 1
11. A
* 14 12 , B* 28 14 , C* 22 6
5 5 5 5 5 5
2.1 − 4.08 0
12. [T] =
0 1.2 0
− 10.92 − 1.56 1
✍✍✍
Chapter 2…
Three-Dimensional Transformations
George David Birkhoff (1884-1944) : He was an established
mathematician of United States of America. He was born in Overisel
of Mich. He had his first education from Lewis Institution III of
Chicago. Then he joined Chicago University. After this he joined
Harvard University where he obtained A.B. Degree in 1905 and A.M.
Degree in 1906. At last he got Doctorate Degree from Chicago
University in 1907. As a teacher he brought many improvements in
the University of Wisconsin.
He made research on asymptotic problem, singular points and
expansion problems and added many new facts. His first writing was
George David Birkhoff
based on Dynamics which was published in the year 1909.
He devoted his whole life in making research about differential calculus and Dynamics with
addition of new ideas and style. He has created many new facts on Theory of stability, Problem
of Three Bodies, geometrical Theorems of Poincare, dynamical systems and Ergodic Theory. He
died suddenly at Cambiridge on 12, Nov., 1944 which created a great vacuum in research
atmsophere.
2.1 Introduction
Construction of three-dimensional graphic images requires the use of three-dimensional
geometrical and co-ordinate transformations. These transformations are formed by the
composition of scaling, reflection, rotation and translation. All of the above transformations can be
represented as a matrix transformation just as we have discussed in two-dimensional case.
Methods for geometric transformations in three dimensions are extended from
two-dimensional methods by including considerations for the z co-ordinate in space. A point in
three-dimensional space is represented by the position vector matrix [x y z].
We have introduced homogeneous co-ordinates in two dimensions. Now, we have to
introduce same in three dimensional space.
A point [x y z] in three dimensional space is represented in the homogeneous co-ordinate
system by a homogeneous co-ordinate vector matrix [x' y' z' h], where x' = xh, y' = yh, z' = zh,
h ∈ R (set of real numbers).
The transformation from homogeneous co-ordinates to three dimensional ordinary
co-ordinates is given by;
x' y' z'
1 .
h h h
(2.1)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.2 Three-Dimensional Transformations
d e f p
q
Scaling, shearing, reflection, a b c Perspective transformation
rotation transformation
g i j r 3 × 1
Translation transformation [l m n] Overall scaling transformation
3×3
1×3 [s]1 × 1
The upper left 3 × 3 sub-matrix gives transformations in the form of scaling, shearing, rotation
and reflection. The lower left 1 × 3 sub-matrix gives translation. The upper right 3 × 1 sub-matrix
gives perspective transformation and last 1 × 1 sub-matrix gives overall scaling.
2.2 Scaling
The diagonal terms of the general 4 × 4 transformation produce local and overall scaling. We
consider here local shearing effect and overall shearing effect separately.
a 0 0 0
Local Shearing Effect : Consider the transformation matrix, [T]=
0 e 0 0
0 0 j 0
0 0 0 1
Applying [ T ] on [X] = [x, y, z, 1] we get [X']
∴ [X'] = [x', y', z', 1] = [X] [T]
a 0 0 0
⇒ [x' y' z' 1] = [x y z 1]
0 e 0 0 = [ax ey jz 1]
0 0 j 0
0 0 0 1
⇒ x' = ax, y' = ey, z' = jz
Illustration : Consider the rectangular parallelopiped where x = 2, y = 3 and z = 1.
We can write homogeneous position vector matrix for the above rectangular parallelopiped
as:
2
0 0 1 1
2 1
0 1 1
3 1
[X] =
0 3 1 1
(co-ordinate of the 8 vertices) … (1)
02 0
0
0
0
1
1
2 3 0 1
0 3 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.3 Three-Dimensional Transformations
1
We can convert rectangular parallelopiped into a unit cube by shearing factors unit along
2
1
x-axis, unit along y-axis and 1 unit along z-axis. The local shearing transformation matrix is
3
1
0 0 0
2
[T] =
0 1
3
0 0
… (2)
0 0 1 0
0 0 0 1
Applying [T] on [X], we get
[X'] = [X] [ T ]
2 0
0 0 1 1
2
1
0 0 0
2 3 1
1 1
1
0 3 1 0
1
1 0 0
3
=
02 00 0
0
1
1
0
2 3 1
0 1 0
1 0
0
0 3 0 0 0 1
1
0 0 1 1
1 1
0 1 1
1 1
⇒ = [X']
0 1 1 1
01 0
0
0
0
1
1
1 1 0 1
0 1 0 1
The matrix [X'] obtained above is the homogeneous position vector matrix of the unit cube.
Overall Shearing Effect : Overall scaling is obtained by using the fourth diagonal element in
[T].
Therefore, consider the transformation matrix
1 0 0 0
[T] =
0 1 0 0
0 0 1 0
0 0 0 s
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.4 Three-Dimensional Transformations
1 0 0 0
⇒ [x' y' z' 1] = [x y z 1]
0 1 0 0 = [x y z 1]
0 0 1 0
0 0 0 s
The homogeneous co-ordinates [x y z s] can be written as
x y z 1 .
s s s
x y z
Hence, we have x' = , y' = , z' = .
s s s
The same overall scaling effect is obtained by using the transformation matrix
s
1
0 0 0
0 1
0 0
[T] =
s
1
0 0
s
0
0 0 0 1
s
1
0 0 0
0 1
0 0
xyz
[x' y' z' 1] = [x y z 1] = s s s 1
s
i.e.
1
0 0
s
0
0 0 0 1
x y z
⇒ x' = , y' = , z' =
s s s
Illustration : The homogeneous position vector matrix for the unit cube is
1
0 0 1 1
1 1
0 1 1
1 1
[X] =
0 1 1 1
01 0
0
0
0
1
1
1 1 0 1
0 1 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.5 Three-Dimensional Transformations
If we want the size of the cube four times the unit cube, the transformation matrix for it will be
0
1 0 0 0
[T] =
0 1
0
0
1
0
0
0 1
0 0
4
Applying [T] on [X] = [x y z 1], we get [X']
∴ [X'] = [x' y' z' 1] = [X] [T]
1
0 0 1
4
1 1
0 1
4
1
0 0 1 1
1 4
1
1 1
1 1
0 1 1
0
1 0 0 0
0
1 1
1
1 0 0
0 1 1
1
4
=
1
1 1
⇒ [x' y' z' 1] = 0 0 1 0
01 0 0 1
0 1
4
0 0 0
0 0 1 4
1 1
0 0
1 4
1 0 1
0 1 0 1
0 0
1 1 0
1
0 1
4
1 0
4
1
The homogeneous co-ordinate factor for each of the transformed position vectors is h = .
4
To obtain the ordinary co-ordinates in three dimensional space, each position vector should be
multiplied by 4.
4
0 0 4 1
4 1
0 4 1
4 4
04 0 0
0 0
1
1
4 4 0 1
0 4 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.6 Three-Dimensional Transformations
1 0 0 0
[T] =
0 1 0 0
0 0 1 0
0 0 0 s
If s < 1, we get uniform expansion of the position vectors, and if s > 1, we get uniform
compression of the position vectors.
2.3 Shearing
We have generalized 4 × 4 transformation matrix as
a b c p
d e f q
g i j r
l m n s
Putting a = e = j = s = 1, and l = m = n = p = q = r = 0, the above transformation can be
written as
1 b c 0
[T] =
d 1 f 0
g i 1 0
0 0 0 1
Now, applying [T] on [X] = [x y z 1], we get
[X'] = [x' y' z' 1] = [X] [T]
1 b c 0
⇒ [X'] = [x y z z]
d 1 f 0
g i 1 0
0 0 0 1
⇒ [x'] = [x + dy + gz, y + bx + iz, z + cx + fy]
⇒ x' = x + dy + gz, y' = y + bx + iz, z' = z + cx + fy
Thus, the non-diagonal terms in the upper left 3 × 3 sub-matrix of the generalized 4 × 4
transformation matrix produce shearing effect in three dimensional space.
Illustrative Examples
Example 2.1 : Write the transformation matrix for each of the following transformations and
apply it on unit cube.
(i) Shear in y-co-ordinate proportional to z-co-ordinate by factor 4.
(ii) Shear in z-co-ordinate proportional to x-co-ordinate and y-co-ordinate by factors 3 and
2 respectively.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.7 Three-Dimensional Transformations
Solution : (i) The transformation matrix [T] for shearing in y-co-ordinate proportional to
z-co-ordinate by factor 4 is
1 0 0 0
[T] =
0 1 0 0
0 4 1 0
0 0 0 1
Applying [T] on unit cube, we get,
1 1
0 0 1 1 0 4 1 1
1 1 1 1 1
0 1 1 4 1 1
1 1
0 0 0
5 1
01 0 0
0 0
1
1
0
0
4 1
0 0
0
1
01 0 0
0 0
1
1
1 1 0 1 1 1 0 1
0 1 0 1 0 1 0 1
(ii) The transformation matrix [T] for shearing in z-co-ordinate proportional to x-co-ordinate
and y-co-ordinate by factors 3 and 2 respectively is;
10 0 3 0
[T] =
1 2 0
0 0 1 0
0 0 0 1
Applying [T] on unit cube, we get
1 1
0 0 1 1 0 1 1 1
0 1 1 0 4 1
10 1 1 1
1 0 3 0
10 1 6 1
[X'] = [X] [T] =
0 0
=
1
1 1 1 1 2 1 3 1
0 0 0 1 0 0 1 0 0 0 0
11 0 0 1
0 0 0 1
11 0 3 1
0 1 0 1
1 0 1 1 5 1
1 0 1 2
2.4 Rotation
Rotation in three dimensions is more complex than rotation in two dimensions. It requires the
prescription of an angle of rotation and axis of rotation.
The positive rotation angles produce counter clockwise rotations about a co-ordinate axis, if
we are looking along the positive half of the axis towards the origin.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.8 Three-Dimensional Transformations
O X
Y
Y
X X
O O
Z Z
Fig. 2.1
In three dimensions, it is helpful to devise transformations for rotation about each of the three
co-ordinate axes.
Rotation about x-axis through an angle θ :
x' = x
y' = y cos θ – z sin θ
z' = y sin θ + z cos θ
which can be written in homogeneous co-ordinate form as
10 cos0 θ sin0 θ 00
[x' y' z' 1] = [x y z 1]
… (1)
0 – sin θ cos θ 0
0 0 0 1
Rotation about y-axis through an angle θ :
z' = z cos θ – x sin θ
x' = z sin θ + x cos θ
y' = y
which can be written in homogeneous co-ordinate form as
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.9 Three-Dimensional Transformations
cos0 θ 10 – sin0 θ 00
[x' y' z' 1] = [x y z 1]
… (2)
sin θ 0 cos θ 0
0 0 0 1
Rotation about z-axis through an angle θ :
x' = x cos θ – y sin θ
y' = x sin θ + y cos θ
z' = z
which can be written in homogeneous co-ordinate form as
–cos θ sin θ 0 0
[x' y' z' 1] = [x y z 1]
sin θ cos θ 0 0
… (3)
0 0 1 0
0 0 0 1
It should be noted that the transformation equations for rotations about the co-ordinate axes
are obtained with a cyclic permutation of the co-ordinate parameters x, y and z i.e. we use the
replacements.
x
y z
Fig. 2.2
It should be further noted that the three-dimensional rotations are obtained by using matrix
multiplication and we know that the matrix multiplication is not commutative. Therefore, the order
of multiplication affects the final result.
Illustrative Example
Example 2.2 : Write the transformation matrix for each of the following :
(i) Rotation about x-axis through an angle 50°
(ii) Rotation about z-axis through an angle – 25°.
Solution : (i) Rotation about x-axis through an angle θ = 50° :
From equation (1), we have
10 cos050° sin050° 00
T =
0 – sin 50° cos 50° 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.10 Three-Dimensional Transformations
10 0.6428
0 0 0
⇒ [T] =
0.7660 0
0 – 0.7660 0.6428 0
0 0 0 1
(ii) Rotation about z-axis through an angle θ = – 25° :
From equation (3), we have
–cos θ sin θ 0 0
[T] =
sin θ cos θ 0 0
0 0 1 0
0 0 0 1
0.9063 – 0.4663 0 0
⇒ [T] =
0.4663 0.9063 0 0
0 0 1 0
0 0 0 1
2.5 Reflection
Reflection in three dimension can be performed relative to a selected axis or with respect to a
selected reflection plane. Reflections relative to the axis are equivalent to 180° rotations about that
axis and reflections with respect to a plane are equivalent to 180° rotations in four-dimensional
space.
In a reflection through the XY-plane, only z-co-ordinate of the position vector changes in sign.
Thus, the transformation matrix for a reflection through the XY-plane is
10 0 0 0
[Rf] =
1 0 0
0 0 –1 0
0 0 0 1
The transformation matrix for a reflection through the YZ-plane is
–01 0 0 0
[Rf] =
1 0 0
0 0 1 0
0 0 0 1
The transformation matrix for a reflection through the ZX-plane is
10 0 0 0
[Rf] =
–1 0 0
0 0 1 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.11 Three-Dimensional Transformations
Example 2.3 : Reflect the following object [X] through the YZ-plane.
2
1 0 1 1
2 1
0 1 1
1 1
[X] =
1 1 1 1
12 0 2
0 2
1
1
2 1 2 1
1 1 2 1
Solution : Here the transformation matrix for reflection through YZ-plane is
–1 0 0 0
[Rf] =
0 1 0 0
0 0 1 0
0 0 0 1
∴ Applying [T] on [X], we get
2 –2
1 0 1 1 –1 0 1 1
2 1 –1 –2 1
0 1 1 0 1 1
1 1
0 0 0
1 1
12 0 2
0 2
1
1
0
0
0 1
0 0
0
1
–– 12 0 2
0 2
1
1
2 1 2 1 –2 1 2 1
1 1 2 1 –1 1 2 1
2.6 Translation
Translation
We know that in the generalized 4 × 4 transformation matrix, the lower left 1 × 3 sub-matrix
produces translation. Let the three-dimensional translation matrix be
10 0 0 0
[T] =
1 0 0
0 0 1 0
l m n 1
Applying [T] on [X] = [x, y, z, 1] we get
[X'] = [x' y' z' 1] = [X] [T]
10 0 0 0
⇒ [x' y' z' 1] = [x y z 1]
1 0 0
0 0 1 0
l m n 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.12 Three-Dimensional Transformations
10 0 0 0
[T] =
1 0 0
0 0 1 0
2 – 7 11 1
Applying [T] on [X], we get
[X'] = [X] [T]
10 0 0 0
⇒ [x' y' z' 1] = [x y z 1]
1 0 0
0 0 1 0
2 – 7 11 1
⇒ [x' y' z' 1] = [x + 2 y – 7 z + 11 1]
⇒ x' = x + 2, y' = y – 7, z' = z + 11
which are the translated homogeneous co-ordinates.
2.7 Multiple Transform
Transformations
ransformations
If we apply the transformation matrices [T1], [T2], [T3],… on [X] successively, we get
[X'] = [X] [T] = [X] [T1] [T2] [T3] …
Alternatively, successive transformation matrices can be combined or concatenated in a single
4 × 4 transformation matrix. i.e. [T] = [T1] [T2] [T3] … which can be applied on [X] to produce [X']. It
should be noted that the order in the matrix multiplication should be same as the order in the
application of successive transformation matrices.
Illustrative Examples
Example 2.4 : Find the concatenated transformation matrix for successive transformations.
(i) Reflection in XY-plane.
(ii) Translate in x, y, z direction by 4, 2, 1 units respectively.
(iii) Shearing in x co-ordinate by a factor – 4 units proportional to z-co-ordinate.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.13 Three-Dimensional Transformations
10 0 0 0
[Rf] =
1 0 0
0 0 –1 0
0 0 0 1
10 0 0 0
[T2] =
1 0 0
0 0 1 0
4 2 1 1
(iii) The transformation matrix for shearing in x-co-ordinate by a factor – 4 units proportional
to z-co-ordinate is
10 0 0 0
[T3] =
1 0 0
–4 0 1 0
0 0 0 1
0
1 0 0 0 1 0 0 0 1 0 0 0
⇒ [T] =
1 0 0 0 1 0 0 0 1 0 0
0 0 –1 0 0 0 1 0 –4 0 1 0
0 0 0 1 4 2 1 1 0 0 0 1
10 0 0 0
1 0 0 0
⇒ [T] =
1 0 0 0 1 0 0
0 0 –1 0 –4 0 1 0
4 2 1 1 0 0 0 1
10 0 0 0
⇒ [T] =
1 0 0
0 0 –1 0
0 2 1 1
Example 2.5 : Find the concatenated transformation matrix for the rotation about x-axis
through 90° followed by the rotation about z-axis through 180°. Apply the resulting concatenated
transformation matrix on the position vector [2 2 1].
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.14 Three-Dimensional Transformations
10 0 0 0
[T1] =
0 1 0
0 –1 0 0
0 0 0 1
(ii) Rotation about z-axis through θ = 180° :
–01 0 0 0
[T2] =
–1 0 0
0 0 1 0
0 0 0 1
Therefore, the concatenated transformation matrix is
[T] = [T1] [T2]
10 00 0 0
–1 0 0 0
⇒ [T] =
1 0 0 –1 0 0
0 –1 0 0 0 0 1 0
0 0 0 1 0 0 0 1
–01 00 0 0
⇒ [T] =
0 0
… (1)
0 1 0 0
0 0 0 1
Applying [T] on the homogeneous co-ordinate position vector [X] = [2 2 1 1], we get
[X'] = [X] [T]
–01 0 0 0
= [2 2 1 1]
0 0 0 = [– 2 1 2 1]
0 1 0 0
0 0 0 1
Note : Here.
–01 0 0 0
1 0 0 0
[T2] [T1] =
–1 0 0 0 0 1 0
0 0 1 0 0 –1 0 0
0 0 0 1 0 0 0 1
–01 0 0 0
=
0 –1 0
… (2)
0 –1 0 0
0 0 0 1
∴ (1) and (2) ⇒ [T1] [T2] ≠ [T2] [T1]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.15 Three-Dimensional Transformations
0
1 0 0 0 0 1 0 0 1 0 0 0
∴ [T] =
1 0 0 –1 0 0 0 0 1 0 0
0 0 1 0 0 0 1 0 0 0 –1 0
–1 2 1 1 0 0 0 1 0 0 0 1
–10 1 0 0
1 0 0 0
[T] =
0 0 0 0 1 0 0
0 0 1 0 0 0 –1 0
–2 –1 1 1 0 0 0 1
–10 1 0 0
⇒ [T] =
0 0 0
0 0 –1 0
–2 –1 –1 1
Applying [T] on A [3 2 1], we get
–10 –1 0 0
[A'] = [A] [T] = [3 2 1 1]
0 0 0
0 0 –1 0
–2 –1 –1 1
⇒ [A'] = [–4 2 –2 1]
Example 2.7 : Obtain the concatenated transformation matrix for the following sequence of
transformation :
(i) Scaling in x and z co-ordinates by factors 2 and 3 respectively.
(ii) Reflection through YZ-plane.
Solution : Here, the concatenated transformation matrix [T] is given by
[T] = [S] [Rf]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.16 Three-Dimensional Transformations
20 0 0 0
–10 0 0 0
∴ [T] =
1 0 0 1 0 0
0 0 3 0 0 0 1 0
0 0 0 1 0 0 0 1
–20 0 0 0
⇒ [T] =
1 0 0
0 0 3 0
0 0 0 1
Example 2.8 : Find the concatenated transformation matrix for rotation about x-axis through
an angle 60° followed by a rotation about y-axis through an angle 90°. Apply this on [X], where,
0 0 1 1
[X] =
2 0 1 1
2 3 1 1
Solution : Concatenated transformation matrix [T] is
[T] = [R1] [R2]
10 0 0 0
cos090° 0 – sin 90° 0
∴ [T] =
cos 60° sin 60° 0 1 0 0
0 – sin 60° cos 60° 0 sin 90° 0 cos 90° 0
0 0 0 1 0 0 0 1
10 0 0 0
00 0 –1 0
⇒ [T] =
0.5 8.66 0 1 0 0
0 –0.866 0.5 0 1 0 0 0
0 0 0 1 0 0 0 1
0.866
0 0 –1 0
⇒ [T] =
0.5 0 0
0.5 –0.866 0 0
0 0 0 1
Applying [T] on [X], we get transformed position vectors [X']
i.e. [X'] = [X] [T]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.17 Three-Dimensional Transformations
0 0 1 1 0.866
0 0 –1 0
⇒ [X'] =
2 0 1 1 0.5 0 0
2 3 1 1 0.5 –0.866 0 0
0 0 0 1
0.5 –0.866 0 1
⇒ [X'] =
0.5 –0.866 –2 1
3.098 0.634 –2 1
2.8 Rotation about an Axis Parallel
arallel to
Co-ordinate Axis
In the article 2.4 we have discussed the rotation about the x, y and z axes and obtained the
transformation matrices about these axes. Now, we have to discuss the rotation of an object about
a line parallel to co-ordinate axis.
Consider the original frame of reference in three dimensional space. We call it a fixed global
axis system. Now considering any point in this space, draw lines parallel to – x, – y, – z axes. These
three lines constitute the local axis system.
When an object is to be rotated about an axis that is parallel to one of the co-ordinate axes,
we can attain the rotation with the following transformation sequence :
1. Translate the object so that the rotation axis (local axis) coincides with the parallel
co-ordinate axis (fixed global axis) (matrix Tr).
2. Perform the specified rotation about that axis (i.e. rotation about the respective global
axis through an angle θ) (matrix R).
3. Apply inverse translation (i.e. translate the object so that the rotation axis is moved back
to its original position.
Y'
Y
X'
X
Z'
Z
Fig. 2.3 : Original position of the object
Thus, the concatenated transformation matrix will be
[T] = [Tr] [R] [Tr]–1
where, [Tr] ≡ Translation matrix
[R] ≡ Rotation matrix
[Tr]–1 ≡ Inverse of the translation matrix.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.18 Three-Dimensional Transformations
q
X X
Z Z
(a) Translation (b) Rotation through (θ
θ)
Y'
Y
X'
X
Z'
Z
(c) Translation to original position
Fig. 2.4
Illustrative Examples
Example 2.9 : Rotate the following object [X] defined by the position vectors (relative to the
global xyz-axis system) through an angle θ = 30° about the local x-axis passing through the
centroid of the block. The origin of the local axis system is assumed to be the centroid of the
block. Obtain the transformed position vector.
2
1 1 2 1
2 1
1 2 1
2 2
[X] =
1 2 2 1
12 1 1
1 1
1
1
2 2 1 1
1 2 1 1
Solution : The centroid of the given object [X] is
0
1 0 0 0
10 0 0 0
where, [Tr] =
1 0 0
=
0 1
0
0
1
0
0
0 0 1 0
0
0 –yc –zc 1
–
3
2
–
3
2
1
0 0
1 0 0 0 1 0 0 0
[R] =
cos θ sin θ 0
=
0.866 – 0.5 0
0 – sin θ cos θ 0 0 0.5 0.866 0
0 0 0 1 0 0 0 1
0
1 0 0 0
= 00 10 01 00
1 0 0 0
[Tr]–1 =
1 0 0
0 0 1 0
0 32 32 1
0 yc z 1
c
0 0 0
1 0 0 0 1 0 0 0
1 0 0 0
∴ (1) ⇒ [T] =
0 1
0
0
1 0
0 0.866 0.5 0
0
1 0 0
0 1 0
0
1 0
0 – 0.5 0.866 0
1 0
–
3
2
–
3
2
0 0
3 3
2 2
1
10 0 0 0
=
0.866 0.5 0
0 – 0.5 0.866 0
0 0.951 –0.549 1
Applying [T] on [X], we get
[X'] = [X] [T]
2
1 1 2 1
2 1 1
1 2 1
2 2
0 0 0
⇒ [X'] =
1 2 2 1 0 0.866 0.5 0
12 1 1
1 1
1
1
0
0
– 0.5
0.951 –0.549
0.866 0
1
2 2 1 1
1 2 1 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.20 Three-Dimensional Transformations
2
1 0.817 1.683 1
2 1
0.817 1.683 1
1.683 2.183
⇒ [X'] =
1 1.683 2.183 1
12 1.317 0.817
1.317 0.817
1
1
2 2.183 1.317 1
1 2.183 1.317 1
Example 2.10 : Obtain transformed position vectors of the vertices of ∆ ABC, when ∆ ABC is
rotated through an angle 90° about the local x-axis passing through A [– 1 2 2 1], B [2 1 2 1],
C [2 3 2 1].
Solution : Position vector of centroid of a ∆ ABC in homogeneous co-ordinate system is
[xc yc zc 1] =
– 1 + 2 + 2 2 + 1 + 3 2 + 2 + 2 1
3 3 3
= [1 2 2 1]
The concatenated transformation matrix [T] is
[T] = [Tr] [R ] [Tr]–1 … (1)
where, [Tr] = Translation matrix
[R] = Rotation matrix
[Tr]–1 = Inverse of translation matrix
10 01 00 00 10 00 01 00 10 0 0 0
(1) ⇒ [T] =
1 0 0
0 0 1 0 0 –1 0 0 0 0 1 0
0 –2 –2 1 0 0 0 1 0 2 2 1
10 00 01 00 10 01 00 00
⇒ [T] =
0 –1 0 0 0 0 1 0
0 2 –2 1 0 2 2 0
10 00 01 00
⇒ [T] =
0 –1 0 0
0 4 0 1
Applying [T] on [X], we get
A'
[X'] = B' = [X] [T]
C'
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.21 Three-Dimensional Transformations
–1 2 2 1 10 0 0 0
⇒ [X'] =
2 1 2 1 0 1 0
2 3 2 1
0 –1 0 0
0 4 0 1
A' –1 2 2 1
⇒
B' = 2 2 1 1
C' 2 2 3 1
which are the transformed position vectors of ∆ ABC.
P2
P1
X
O
P2
P'1
X
O
Z
Fig. 2.6
'
Step 2 : Rotate P2 for the z-axis
Y
P'1
X
O
P"2
Fig. 2.7
Step 3 : Rotate the object around the z-axis
Y
P'1
d X
O
P"2
Z
Fig. 2.8
Step 4 : Rotate the axis to the original orientation.
Y
P2
P'1
X
O
Fig. 2.9
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.23 Three-Dimensional Transformations
P2
P1
X
O
Z
Fig. 2.10
For making an arbitrary axis passing through the origin coincides with one of the co-ordinate
axes requires two rotations about the remaining two co-ordinate axes.
Procedure : Make the arbitrary rotation axis coincide with the z-axis, first rotate about x-axis
and then about y-axis. For the determination of the rotation angle α about x-axis, we have to
place the arbitrary axis in XZ-plane, project the unit vector along the axis on YZ-plane.
Let cx, cy, cz be the direction cosines of the line OP passing through the origin. The position
vector of the point P will be [cx, cy, cz].
2 2 2
Also |OP| = cx + cy + cz = 1 (... l2 + m2 + n2 = 1)
|OM| = cy, |LM| = cx, |MQ| = cz
Let |OQ| = d
In right angled ∆ OQR,
Z
cy
R Q
P
d cz
a
O
Y
M
cx
N
L
X
Fig. 2.11
OQ2 = OR2 + RQ2 = OM2 + RQ2
2 2
⇒ d2 = cy + cz
2 2
⇒ d = cy + cz
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.24 Three-Dimensional Transformations
OR OM cz
Again cos α = = =
OQ OQ d
RQ cy
and sin α = =
OQ d
After rotation about the x-axis into XZ-plane, the z component of the unit vector is d and the
x component is cx.
Now, we rotate about y-axis through an angle β which make the arbitrary axis coincide with
z-axis.
In right angled ∆ ONP',
O X
L
b
d
N
cx P' (cx, 0, d)
Z
Fig. 2.12
ON LP'
cos β = = =d (∴ |OP'| = 1)
OP' 1
NP' cx
and sin β = = = cx
OP' 1
10 0 0 0
where, [Tr] =
cos α 0 0
0 – sin α 1 0
–x 0 –y0 –z0 1
cos0(–β) 10 – sin0(–β) 00 d 0 cx 0
[Ry] =
=
0 1 0 0
sin (–β) 0 cos (–β) 0 –cx 0 d 0
0 1 0 1 0 0 0 1
–cos δ sin δ 0 0
[Rδ] =
sin δ cos δ 0 0
0 0 1 0
0 0 0 1
Illustrative Examples
Example 2.11 : Consider the line with direction ratios 1, 1, 1 and passing through the origin.
Determine angles through which the line should be rotated about x-axis and then about y-axis; so
that it coincides with z-axis.
Solution : Direction cosines of the line are
1, 1, 1
(cx, cy, cz) =
3 3 3
2 2
d2 = cy + cz
2 2
⇒ d = cy + cz
1 1 2
⇒ d = + =
3 3 3
Let the line makes an angle α with x-axis.
cz 1
⇒ cos α = =
d 2
cy 1
and sin α = =
d 2
1
since cos α = sin α =
2
⇒ α = 45°
Let the line makes an angle β with y-axis.
2
⇒ cos β = d =
3
2
β = cos–1 = 35.26°
3
Thus, α = 45° and β = 35.26°
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.26 Three-Dimensional Transformations
Example 2.12 : Consider the line with direction ratios 1, – 2, 2 and passing through the origin.
Determine the angles through which the line should be rotated about x-axis and then about
y-axis, so that it coincides with z-axis.
Solution : Direction cosines of the line are
2 2
⇒ cos β = d =
3
2 2
⇒ β = cos–1
3
⇒ β = 19.47°
Thus, α = – 45° and β = 19.47°
2.10 Reflection through an Arbitrary Plane
In article 2.5 we have discussed the reflection of an object through the co-ordinate planes. But
it may be required to reflect an object through the plane other than the co-ordinate plane.
The procedure for getting the concatenated transformation for the reflection through an
arbitrary plane is given below.
1. Translate the point (lies in the reflection plane) to the origin of the co-ordinate system.
cz cy
2. Rotate through an angle α about x-axis, where cos α = , sin α = .
d d
3. Rotate through an angle – β about y-axis, where cos β = d, sin β = cx.
Using the above steps successively, the concatenated transformation can be written as
[M] = [Tr] [Rx] [Ry] [Rf] [Ry]–1 [Rx]–1 [Tr]–1
where the matrices [Tr], [Rx] [Ry] are given in the previous article 2.9.
Illustrative Examples
Example 2.13 : It is required to reflect in the face ABC of the pyramid OABC given by
O [0 0 0], A [3 1.5 2], B [2.5 2 2], C [3 2 1.5]. Determine the transformation matrix for the
translation and rotation so that the required face coincides with the XY-plane.
Solution : For the translation choose the point A to the origin which gives us translation
matrix
0 1 0 0
1 0 0 0
[T ] =
0 0 1 0
–3 – 3 –2 1
r
2
–
The normal n to the reflection plane containing A, B, C is
– —- —- – – – –
n = AC × AB = (C – A ) × (B – A )
0
i j k
1 1
=
–
2 2
– 12 1
2
0
1 1 1
= i+ j+ k
4 4 4
=
1 1 1
4 4 4
Normalizing gives direction cosines cx cy cz as
1 1 1
4 4 4
=
1
[cx, cy, cz]
1 1 1 1 1 1 1 1
+ +
16 16 16
+ +
16 16 16 16 16 16
+ +
1 1 1
=
3 3 3
2 2 2
d = cy + cz =
3
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.28 Three-Dimensional Transformations
1
cz 3 1
cos α = = =
d 2 2
3
cy 1
sin α = =
d 2
2
cos β = d =
3
1
sin β = cx =
3
⇒ α = 45°, β = 35.26°
From the previous article 2.9, we have
0
1 0 0 0
1 1
[R ] =
2 2
0
0 0
x 1 1
–
0 1
2 2
0 0
2/ 6 0 1/ 3 0
[Ry] =
0 1 0 0
–1/ 3 0 2/ 6 0
0 0 0 1
0 2/ 6
1 0 0 0
10 0 0
0 1 1 0 1/ 3 0
0 0
0
∴ [Tr] [Rx] [Ry] =
1 0 2 2 1 0 0
0
–3
0 1 0
1
0 –
1
2
1
2
0
–1/ 3
0
0 2/ 6 0
1
0
–3/2 –2 0 0
0 0 1
–1/2/ 66 0 1/ 3 0
=
1/ 2 1/ 3 0
… (1)
–1/ 6 –1/ 2 1/ 3 0
–5/2 6 1/2 2 –13/2 3 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.29 Three-Dimensional Transformations
Reflection through the arbitrary plane is now given by reflection through the z = 0 plane (see
article 2.5).
10 0 0 0
∴ [Rf] =
1 0 0 … (2)
0 0 –1 0
0 0 0 1
3 1
1/ 3 1/ 3 1/ 3 0
3/2 2
∴ [M] = [Tr] [Rx] [Ry] [Rf] [Ry]–1 [Rx]–1 [Tr]–1
2/ 6 0 1/ 3 0
1 0 0 0
=
–1/ 6 1/ 2 1/ 3 0 0 1 0 0
–1/ 6 –1/ 2 1/ 3 0 0 0 –1 0
2/0 6 –1/ 6 1/ 6 0
=
1/ 2 –1/ 2 0
3 1
1/ 3 1/ 3 1/ 3 0
3/2 2
–2/3
1/3 –2/3 –2/3 0
=
1/3 –2/3 0
–2/3 –2/3 1/3 0
13/3 13/3 13/3 1
Example 2.14 : Rotate the line segment joining A [1 2 3], B [4 5 6] about y-axis through 30°.
0.8660 0 –0.5 0
[Ry] =
0 1 0 0
0.5 0 0.8660 0
0 0 0 1
A 1 2 3 1
[X] = =
B 4 5 6 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.30 Three-Dimensional Transformations
0.8660 0 –0.5 0
1 2 3 1 0 1 0 0
[X'] = [X] [Ry] =
4 5 6 1 0.5 0 0.8660 0
0 0 0 1
2.368 2 2.098 1
=
6.464 5 3.196 1
A' 2.368 2 2.098
= =
B' 6.464 5 3.196
Example 2.15 : Rotate the line segment AB, through where A [1 2 4], B [2 2 1] about the local
x-axis passes through the point P [2 3 4] through an angle 65°.
Solution : Here
1 2 4 1
[X] =
2 2 1 1
10 0 0 0
Tr =
1 0 0
0 0 1 0
0 –3 –4 1
cos 65° = 0.4226, sin 65° = 0.9063
10 0 0 0
[Rx] =
0.4226 0.9063 0
0 –0.9063 0.4226 0
0 0 0 1
[T] = [Tr] [Rx] [Tr ]–1
10 0 0 0
1 0 0
0
10 0 0 0
⇒ [T] =
1 0 0 0 0.4226 0.9063 0 1 0 0
0 0 1 0 0 –0.9063 0.4226 0 0 0 1 0
0 –3 –4 1 0 0 0 1 0 3 4 1
10 0 0 0
1 0 0 0
=
0.4226 0.9063 0 0 1 0 0
0 –0.9063 0.4226 0 0 0 1 0
0 2.3574 –4.4093 1 0 3 4 1
10 0 0 0
=
0.4226 0.9063 0
0 –0.9063 0.4226 0
0 2.3574 –4.4093 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.31 Three-Dimensional Transformations
1 0
1 0 0 0
1 2 4
=
0.4226 0.9063 0
2 2 1 1 0 –0.9063 0.4226 0
0 2.3574 –4.4093 1
1 2.5779 3.0937 1
=
2 5.2968 1.8259 1
⇒ A' = [1 2.5779 3.0937 ]
B' = [2 5.2968 1.8259 ]
Example 2.16 : Reflect the pyramid OABC with O [0 0 0], A [1 1 0], B [0 1 0], C [0 0 1] in the
plane x = 3.
0
1 0 0 0 –1 0 0 0 1 0 0 0
=
1 0 0 0 1 0 0 0 1 0 0
0 0 1 0 0 0 1 0 0 0 1 0
–3 0 0 1 0 0 0 1 3 0 0 1
–10 0 0 0
1 0 0 0
=
1 0 0 0 1 0 0
0 0 1 0 0 0 1 0
3 0 0 1 3 0 0 1
–10 0 0 0
=
1 0 0
0 0 1 0
6 0 0 1
–0.75
1 –0.85 0.25 0
[T] =
1 0.7 0 on the unit cube.
0.5 1 1 0
0 0 0 1
1
0 0 1 1
1 1
0 1 1
1 1
1 –0.85 0.25 0
=
0 1 1 1 –0.75 1 0.7 0
01 0 0
0 0
1
1
0.5
0
1
0
1
0
0
1
1 1 0 1
0 1 0 1
1.5
0.5 1 1 1
0.75 1
0.15 1.25 1
1.15 1.95
=
–0.25 2 1.7 1
01 0
–0.85 0.25
0 1
1
0.25 0.15 0.95 1
–0.75 1 0.7 1
Example 2.18 : Write the transformation matrix for each of the following :
Apply each transformation on the rectangular parallelopiped whose position vector matrix is
3
0 0 1 1
3 1
0 1 1
2 1
[X] =
0 2 1 1
03 0 0
0 0
1
1
3 2 0 1
0 2 0 1
Solution : (i) Transformation matrix for rotation about x-axis through θ = – 90° is
10 0 0 0
[T] =
0 –1 0
0 1 0 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.33 Three-Dimensional Transformations
3 3
0 0 1 1 0 1 0 1
0 1 1 1 0 1
30 2 1 1
10 0 0 0
30 1 –2 1
[X'] = [X] [T] =
1 0
=
1
2 1 1 0 –1 0 1 –2 1
0 0 0 1 0 0 0 0 0
33 0 0 1
0 0 0 1
33 0 0 1
0 1 0 1
2 0 1 0 –2 1
2 0 0 –2
(ii) Transformation matrix for rotation about y-axis through θ = 90° is
00 0 –1 0
[T] =
1 0 0
1 0 0 0
0 0 0 1
Applying [T] on [X], we get
3 1
0 1 0 1 1 0 0 1
3 1 0 1 1
1 0 1 0 –3 1
1 –2
0 –1 0
2 –3
03 0
0
0
0
1
1
1
0
0
0
0
0
0
1
00 0
0 –3
0 1
1
3 0 –2 1 0 2 –3 1
0 0 –2 1 0 2 –3 1
Y
Y'
A'
A
– 90º
X' X
Z'
Z
Fig. 2.13 (a)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.34 Three-Dimensional Transformations
Z'
A'
X'
10 0
1
0
0
0
0
10 0 0 0
0.866 0.5 0
0.707
0
0 −0.707 0
1 0 0
∴ [T] = 0 0.707
0 0 1 0 − 0.5 0.66 0 0 0.707 0
−1 −1 −1 1 0 0 0 1 0 0 0 1
0.707
0.354
0
0.866
− 0.707
0.354
0
0
=
0.612 − 0.5 0.612 0
−1.673 − 0.366 − 0.259 1
X’ = [X] [Tr] gives X’ = [2 1 0 1]
X’’ = [X’] [Rx] = [2 0.866 0.5 1]
X’’’ = [X’’] [Ry] = [1.768 0.866 −1.061 1]
We get identical results.
Think Over It
1. The vertices of a pyramid are A[0 0 0], B[1 0 0], C[0 1 0] and D[0 0 1]. The line L passing
− −
through C has direction of the vector j + k. The pyramid is rotated by 45° about the line L.
Find the co-ordinates of the rotated figure.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.35 Three-Dimensional Transformations
Points to Remember
1. For three dimensional homogeneous co-ordinates the generalized 4 × 4 transformation matrix
is given by,
da b
e
c
f
p
q
[T] =
g i j r
l m n s
The above 4 × 4 transformation matrix can be divided into four parts as : scaling, shearing,
reflection, rotation transformation.
10 0
e
0
0
0
0
[T] =
0 0 1 0
0 0 0 1
(ii) Transformation matrix for scaling in x co-ordinate by a units is given by
0a 0
1
0
0
0
0
[T] =
0 0 1 0
0 0 0 1
(iii) Transformation matrix for scaling in z co-ordinate by j units is given by
10 0
1
0
0
0
0
[T] =
0 0 j 0
0 0 0 1
(iv) Transformation matrix for uniform scaling by ‘a’ units is given by
0a 0
a
0
0
0
0
[T] =
0 0 a 0
0 0 0 a
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.36 Three-Dimensional Transformations
It should be noted that, if 0 < a < 1, then it gives uniform compression of the position
vectors and if a > 1 then it gives uniform expansion of the position vectors.
10 0
1
0
0
0
0
[T] =
0 0 1 0
0 0 0 s
It should be noted that, if 0 < s < 1, then it gives uniform expansion of the position
vectors and if s > 1 then uniform compression of the position vectors.
0a 0
e
0
0
0
0
[T] =
0 0 j 0
0 0 0 1
3. Three dimensional shearing :
d1 0
1
0
0
0
0
[T] =
g 0 1 0
0 0 0 1
(ii) Transformation matrix for shearing in y-co-ordinate proportional to x and z axes by
factor b and i respectively is,
10 b
1
0
0
0
0
[T] =
0 i 1 0
0 0 0 1
(iii) Transformation matrix for shearing in z-co-ordinate proportional to x and y axes by
factors ‘c’ and ‘f’ respectively is,
10 0
0
c
f
0
0
[T] =
0 0 1 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.37 Three-Dimensional Transformations
10 0 0
cos θ sin θ 0
0
[T] =
0 − sin θ cos θ 0
0 0 0 1
(ii) The transformation matrix for rotation about y-axis through an angle θ is,
cos0 θ 0 − sin θ
1 0
0
0
[T] =
sin θ 0 cos θ 0
0 0 0 1
(iii) The transformation matrix for rotation about z-axis through an angle θ is,
−cossinθθ sin θ
cos θ
0
0
0
0
[T] =
0 0 1 0
0 0 0 1
5. Three dimensional reflection :
(i) The transformation matrix for reflection through XOY plane (i.e. z = 0 plane) is,
10 0 0 0
1 0 0
[T] =
0 0 −1 0
0 0 0 1
(ii) The transformation matrix for reflection through YOZ plane (i.e. x = 0 plane) is,
−10 0
1
0
0
0
0
[T] =
0 0 1 0
0 0 0 1
(iii) The transformation matrix for XOZ plane (i.e. y = 0 plane) is,
10 0
−1
0
0
0
0
[T] =
0 0 1 0
0 0 0 1
6. Three dimensional translation : The transformation matrix for translation in X, Y, Z direction
by units l, m, n respectively is,
10 0
1
0
0
0
0
[T] =
0 0 1 0
l m n 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.38 Three-Dimensional Transformations
Miscellaneous Exercise
(A) State whether the following statement is True or False. Justify your answer.
1. The translation matrix for scaling in X, Y, Z co-ordinates by factor 2, −3, 4 units respectively is,
20 0
−3
0
0
0
0
[T] =
0 0 4 0
0 0 0 1
2. The transformation produced by the following transformation matrix,
10 0
1
0
0
0
0
[T] =
2 0 1 0
0 0 0 1
is a scaling in x co-ordinate.
10 0 0
1 0
0
0
3. The transformation matrix to translate the point P[2 1 −3] to origin is .
0 0 1 0
−2 1 −3 1
1
4. The transformation matrix for scaling x and y co-ordinate by factor and 2 units respectively
3
30 0
1
0
0
0
0
is, [T] =
0 0 2 0
0 0 0 1
ANSWERS
(B) Multiple Choice Questions : Choose the correct alternative from given alternatives.
10 −1 2 0
0 −1 0
1. The effect of the 4 × 4 transformation matrix, [T] = on any object in space is
0 3 0 0
0 0 0 1
……
(a) Shearing in y co-ordinate proportional to X and Z axis by factors −1 and 3.
(b) Shearing in Z co-ordinate proportional to X and Y axis by factor 2 and −1.
(c) Shearing in y-co-ordinate proportional to x and z axis by factor −1 and 3. Also shearing in
z co-ordinate proportional to X and y axis by factor 2 and −1.
(d) None of the above.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.39 Three-Dimensional Transformations
2. The transformation matrix for rotation about x-axis through an angle θ = 45° is ……
0 0
1 0 0 0 1 0 0 0
1 1 1 1
(a) [T] =
2 2
0
(b) [T] =
2
−
2
0
0 −1
2
1
2
0 0 1
2
1
2
0
0 0 0 1 0 0 0 1
0
1 0 0 0
1 −1
(c) [T] =
−
2 2
0
(d) None of these
0 1
2
1
2
0
0 0 0 1
3. The transformation matrix for reflection through the plane z = −3 is ……
10 0 0 0
−1 0 0
10 0 0 0
1 0 0
(a) [T] = (b) [T] =
0 0 −1 0 0 0 −1 0
0 0 0 1 0 0 −6 1
10 0 0
−1 0
0
0
[T] =
0
(c) (d) none of these
0 0 −1
0 0 −6 1
10 0
1
0
0
0
0
4. The matrix, [T] =
is ……
0 0 1 0
−5 0 0 1
(a) the transformation matrix for translation in y direction by −5 units.
(b) the transformation matrix for translation in z direction by −5 units.
(c) the transformation matrix for translation in x direction by −5 units.
(d) none of above.
5. The three dimensional translation matrix [T] is ……
10 0
1
0
0
0
0
00 0
1
0 l
0 m
(a) 0 0 1 0 (b) 0 0 1 n
l m n 1 0 0 0 1
0l m
1
n
0
1
0
10 0
1
0 l
0 m
(c) 1 0 0 0 (d) 0 0 1 n
0 0 1 0 l m n 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.40 Three-Dimensional Transformations
−10 0 0
−1 0
0
0
10 0
1
0 0
0 0
(a) 0 0 −1 0 (b) 0 0 1 0
0 0 0 −1 0 0 0 −1
10 0 0 0
1 0 0
10 0
−1
0
0
0
0
(c) 0 0 −1 0 (d) 0 0 1 0
0 0 0 1 0 0 0 1
cos0 φ 0 − sin φ
1 0
0
0
7. The transformation matrix, [T] =
corresponds to rotation by an angle φ
sin φ 0 cos φ 0
0 0 0 1
about ……
(a) x-axis (b) y-axis
(c) z-axis (d) none of these
8. For a pure reflection the determinant of the reflection matrix is ……
(a) 1 (b) −1
(c) 0 (d) none of these
Answers
1 - (c) 2 - (a) 3 - (b) 4 - (c) 5 - (a) 6 - (c)
7 - (b) 8 - (b)
(C) Theory Questions :
1. Obtain three dimensional transformation matrix for :
(i) Translation (ii) Scaling
(iii) Shearing (iv) Rotation about an arbitrary axis
(v) Reflection
2. Explain the rotation about :
(i) an axis parallel to co-ordinate axis.
(ii) an arbitrary axis in space.
3. State the various steps for getting the concatenated transformation for the reflection through
an arbitrary plane.
(D) Numerical Problems :
1. Find the combined transformation matrix for the following sequence of transformations :
Rotation about X-axis by an angle 30°, followed by rotation about Y-axis by an angle 30°,
followed by scaling in X and Z co-ordinates by factor of 3 and 2 respectively. Apply it on the
point [2 1 3].
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.41 Three-Dimensional Transformations
2. Obtain the concatenated transformation matrix for the following sequence of transformation :
Shearing in x co-ordinate by a factor of 2 units proportional to Z co-ordinate followed by
reflection YZ plane.
3. Find the concatenated transformation matrix for rotation about X-axis through an angle 60°,
0 0 1 1
followed by a rotation about y-axis through an angle 90°. Apply it on [X] = 2 0 1 1 .
2 3 1 1
4. Find the concatenated transformation matrix for the following transformations in order :
Translate in X, Y, Z directions by −2, −2, −2 units respectively. Rotation about X-axis by angle
45°. Reduce to half its size.
5. What is the effect of 4 × 4 transformation matrix
10 −2
1
0
0
0
0
[T] = on any object in space ?
0 3 1 0
0 0 0 1
6. The plane x + 2y + 2z = 0 is to be rotated, so that it coincides with the z = 0 plane. Determine
the required angles of rotation about the X-axis and Y-axis.
7. Consider the line having direction ratios 1, 1, 1. Determine the angle of rotation about X-axis
and then about Y-axis, so that the line coincides with the z-axis.
8. Find the concatenated transformation matrix for the following sequence of transformations :
Translate in X, Y and Z directions by −2, −2, −2 units respectively; followed by rotation about
1
X-axis by an angle 45° followed by uniform scaling by units.
2
9. Obtain the transformed position vectors of the vertices of ∆ABC, when ∆ABC is rotated
through an angle 90° about the local X-axis passing through the centroid of ∆ABC; where
A[−1 2 2 1], B[2 1 2 1], C[2 3 2 1].
10. A line L has direction ratios 1, −2, 2 and it passes through origin. Determine the angles
through which the line should be rotated about Y-axis and then about Z-axis.
11. Find the concatenated transformation matrix for the following sequence of transformations :
First translate in X and Z direction by 2 and 1 units respectively, followed by shearing in
1
Y-direction proportional to X and Z coordinate with and 3 units respectively, followed by
2
reflection through XZ plane. Apply it on origin.
Answers
2.598
0.75
0 −1 0
0.8660 0.8660 0
1. [T] =
1.299 − 0.5 1.4998 0
0 0 0 1
*
P = [9.843 − 0.634 3.3654]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 2.42 Three-Dimensional Transformations
−10 0
1
0
0
0
0
2. [T] =
−2 0 1 0
0 0 0 1
0.8660
0 0
0.5
−1 0
0 0
3. [T] =
0.5 −0.8660 0 0
0 0 0 1
0.5 − 0.8660 0 1
*
[X ] =
0.5 − 0.8660 −2 1
3.098 0.6340 −2 1
0.5
0
0
0.3535
0
0.3535
0
0
4. [T] =
0 − 0.3535 0.3535 0
−1 0 − 1.4140 1
5. Shearing in y co-ordinate proportional to x-co-ordinate by factor −2 and proportional to
z co-ordinate by factor 3.
6. 45°, 35.263°
7. α = 45°, β = 45°
−1 1
8. α = 45°, β = tan
2 2
0.5
0
0
0.3535
0
0.3535
0
0
9. [T] =
0 − 0.3535 0.3535 0
−1 0 − 1.4140 1
* *
A = [−1 2 2], B [2 2 1], C[2 2 3].
π −1 1
10. − and tan
4 2 2
10 −1/2
−1
0
0
0
0
11. [T] =
0 −3 1 0
2 −4 1 1
✍✍✍
Chapter 3…
Projection
George Bernard Dantzig, professor emeritus of operations
research and of computer science who devised the "simplex method"
and invented linear programming (which is not related to computer
programming), died May 13 at his Stanford home of complications
from diabetes and cardiovascular disease. He was 90 years old. A
funeral service has been the mathematicians and held. "George B.
Dantzig is regarded by most experts as having been the initiator of
and leading figure in the revolutionary scientific development of
mathematical programming as a powerful method for optimally
managing resources in literally thousands of applications in industry
George David Birkhoff and government in the last three decades," said Arthur F. Veinott Jr.,
professor of management science and engineering.
"So pervasive is the influence of Dantzig's simplex method that experts have estimated that
from 10 percent to 25 percent of all scientific computation is devoted to it. Indeed, that method
is probably the single most widely used algorithm originated in the last six decades."
3.1 Introduction
Geometric theorems are developed for affine and perspective geometry. The theorems of
affine geometry are identical to the theorems of Euclidean geometry. In Euclidean geometry and
affine geometry; parallelism of lines is important. In perspective geometry; the lines are generally
non-parallel. An affine transformation is a combination of linear transformations; for example,
rotation followed by translation etc. The affine and perspective transformations are both three
dimensional transformations. their view in 2-d surface needs a projection from three space to two
space.
3.2 Affine and Perspective Geometry
In affine geometry, lines are parallel (i.e. parallelism concept is important) whereas in
perspective geometry, lines are not generally parallel. Affine and perspective transformations are
three-dimensional transformation i.e. these are transformations from one three-dimensional space
to another three-dimensional space.
Affine transformations have the general properties that the parallel lines are transformed into
parallel lines and finite points transformed to finite points. Translation, rotation, scaling, shearing
and reflection are examples of two-dimensional affine transformations.
Projection : A geometrical transformation in which one line, shape etc. is converted into
another according to certain geometrical rule is called projection.
Plane Geometric Projection : The result of the projection of an object from
three-dimensional space to two-dimensional plane is called the plane geometric projection.
(3.1)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.2 Projection
B View plane
B'
A
A'
B'
A Centre of
A' projection
The movable object and the fixed centre of projection approach is used in this text.
Projections
Parallel
Perspective
Trimetric
Cavalier Cabinet
Dimetric
Fig. 3.3
The orthographic projections are projections on one of the co-ordinate planes x = 0
(yz-plane), y = 0 (xz-plane), z = 0 (xy-plane) respectively. If the point is projected onto z = 0 plane,
the matrix for the projection onto z = 0 plane is
0
1 0 0 0
[Pz] =
1 0 0
0 0 0 0
00 0 1
The matrices for the orthographic projections onto x = 0 and y = 0 planes are :
0
0 0 0 0
1 0 0 0
0
[Px] =
1 0 0 and [Py] =
0 0 0
0 0 1 0 0 0 1 0
0 0 0 1 0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.4 Projection
Z'
X'
X
Z
Y'
O O X X O O
Z Z Z Z
Orthographic projection onto Orthographic projection onto
y = 0 plane (Top view) z = 0 plane (Front view)
X Y Y
O X O
Z
Orthographic projection onto x = 0 plane (Right side view)
Fig. 3.5
Top view Rear view Left side view Front view Right side Bottom view
view
Fig. 3.6
The front view, side view and top view are sometimes called front elevation, side elevation and
the plane view. Engineering and architectural drawings generally use orthographic projections,
because it accurately shows the true size and shape of the single plane face of the object.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.5 Projection
It should be noted that all six views are obtained by the combinations of reflection, rotation
and translation followed by the projection on z = 0 plane (i.e. XY plane) from the centre of
projection at infinity on the z-axis.
Rear view is obtained by rotation about y-axis by 180°, followed by the projection on the
plane z = 0. Top view is obtained by rotation about x-axis by + 90°, followed by the projection on
z = 0 plane. Left side view is obtained by rotation about y-axis by + 90°, followed by the
projection on z = 0 plane. We summarize this procedure and we can write the concatenated
transformation matrix for each of the views as given in the following Table 3.1.
Table 3.1
Concatenated
No. View Rotation Transformation
matrix
1. Front – T = [Pz]
2. Top Rotation about x-axis through θ = 90° T = [Rx] [Pz]
3. Bottom Rotation about x-axis through θ = – 90° T = [Rx] [Pz]
4. Left Rotation about y-axis through θ = 90° T = [Ry] [Pz]
5. Right Rotation about y-axis through θ = – 90° T = [Ry] [Pz]
6. Rear Rotation about y-axis through θ = 180° T = [Ry] [Pz]
Illustrative Examples
Example 3.1 : Develope the top view for the object whose position vectors are given below :
0 0 1 1
1 0 1 1
1 0.5 1 1
0.5 1 1 1
0 1 1 1
[X] =
0
1
0
0
0
0
1
1
1 1 0 1
0
1
1
1
0
0.5
1
1
Solution : Here, for top-view, the concatenated transformation matrix is;
[T] = [Rx] [Pz] (θ = 90°)
10 0 0 0
1 0 0 0
10 0 0 0
=
0 1 0 0 1 0 0
=
0 0 0
0 –1 0 0 0 0 0 0 0 –1 0 0
0 0 0 1 0 0 0 1 0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.6 Projection
0 0 1 1 0 −1 0 1
1 0 1 1 1 −1 0 1
1 0.5 1 1 1 0 0 0
1 −1 0 1
0
0.5 1 1 1 0.5 −1 0 1
0 1 1 1 0 0 0 0 −1 0 1
[X'] = =
0
1
0
0
0
0
1
1 00 −1 0 0
1
0
1
0
0
0
0
1
1
0 0
1 1 0 1 1 0 0 1
0
1
1
1
0
0.5
1
1 0 0
1 −0.5
0
0
1
1
3.4 Axonometric Projections
Axonometric projections are orthographic projections in which the direction of projection is
not parallel to any of the three co-ordinate axes.
It is constructed by manipulating the object :
(i) Using rotations and translations such that atleast three adjacent faces are shown.
(ii) The result is then projected from the centre of projection at infinity, usually onto the
z = 0 plane. It should be noted that the axonometric projection does not accurately show
its correct size and shape, unless a face is parallel to the plane of the projection.
In an axonometric projection, we first apply rotation or translation which preserve the length
of the vectors. Then we apply orthographic projection where all the projectors are perpendicular
to the projection plane, hence the lengths of the vectors are shortened. However, in an
axonometric projection, the relative lengths of parallel lines remain constant. (i.e. parallel lines are
equally foreshortened). First we define the foreshortening factor.
Foreshortening factor : It is the ratio of the projected length of line to its real length. i.e. if
|P'Q'|
P'Q' is the projected length of the real line PQ then foreshortening factor is given by
|PQ|
P
Line Q
Projection
Projection plane
P' Q'
Fig. 3.7
The foreshortening factors along the projected principal axes are denoted by fx, fy, fz.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.7 Projection
AB 10 0 0 1
∴ [U] =
=
1 0 1
C 0 0 1 1
O 0 0 0 1
10 0 0 1
Then [U*] = [U] [T] =
1 0 1 [T]
0 0 1 1
0 0 0 1
* *
xx yx 0 0
=
x *
y
*
yy 0 0
x *
z
*
yz 0 0
x *
0
*
y0 0 0
* * * *
|O* A*| (xx – x0)2 + (yx – y0)2
fx = =
|OA| 1
* * * *
fy = (xy – x0)2 + (yy – y0)2 , fz
* * * *
= (xz – x0)2 + (yz – y0)2
* *
If the translations are not applied, then x0 = y0 = 0.
*2 *2 *2 *2 *2 *2
∴ fx = xx + yx , fy = xy + yy , fz = xz + yz
Further,
a 11 a12 0 0
if [T] =
a 21 a22 0 0
a 31 a32 0 0
1 m 0 1
a11 a12 0 0
A* 10 0 0 1
B* =
1 0 1 a 21 a22 0 0
C* 0 0 1 1 a 31 a32 0 0
O* 0 0 0 1 1 m 0 1
a 11 + 1 a12 + m 0 1
=
a 21 + 1 a22 + m 0 1
a 31 + 1 a32 + m 0 1
1 m 0 1
|O*A*| 2 2
Here fx = = a11 + a12
|OA|
2 2
Similarly, fy = a21 + a22
2 2
fz = a31 + a32
There are three types of axonometric projections :
(i) Trimetric projection (ii) Dimetric projection (iii) Isometric projection
(I) Trimetric Projection :
A trimetric projection is obtained by arbitrary rotations, in arbitrary order about any or all
co-ordinate axes, followed by parallel (orthographic) projection on z = 0 plane. Trimetric
projection is formed by first rotation about y-axis through an angle φ and then rotation about
x-axis through an angle θ, followed by parallel (orthographic) projection on the z = 0 plane.
Thus, the concatenated trimetric projection is given by;
[T] = [Ry] [Rx] [Pz]
cos0 φ 0 sin φ 0
1 0 0 0
10 0 0 0
=
1 0 0 0 cos θ sin θ 0 1 0 0
sin φ 0 cos φ 0 0 –sin θ cos θ 0 0 0 0 0
0 0 0 1 0 0 0 1 0 0 0 1
Illustrative Examples
Example 3.2 : Determine the foreshortening factors fx, fy, fz if the transformation matrix for
axonometric projection is given by;
0.5 0.43 0 0
[T] =
0 0.86 0 0
0.86 0.25 0 0
3.58 0.75 0 1
Solution : The foreshortening factors fx, fy, fz are given by the following formula,
2 2
fx = a11 + a12 = (0.5)2 + (0.43)2 = 0.6594
2 2
fy = a21 + a22 = (0)2 + (0.86)2 = 0.860
2 2
fz = a31 + a32 = (0.86)2 + (0.25)2 = 0.8956
Example 3.3 : Obtain the transformation matrix for the trimetric projection formed by
rotation about the y-axis through an angle φ = 30°, followed by rotation about the x-axis through
an angle θ = 45°, and then orthographic projection on the z = 0 plane. Also determine the
principal foreshortening factor.
Solution : The concatenated trimetric projection is given by;
[T] = [Ry] [Rx] [Pz]
2
3
4
2
0 0
2
=
0 0 0
2
1
2
– 6
4
0 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.10 Projection
32 22 3 2
fx = + = + = 0.935
2 4 4 16
22
fy = 02 +
2
2
= = 0.707
4
12 – 62
fz = +
2 4
1 6
= + = 0.791
4 16
Example 3.4 : Develop the transformation matrix for trimetric projection obtained by rotation
about y-axis through an angle φ = 30°, followed by rotation about x-axis through an angle
θ = 45°, and then orthographic projection on z = 0 plane. Apply it on the cube whose position
vectors are given below :
0 0 1 1
1 0 1 1
1 0.5 1 1
0.5 1 1 1
0 1 1 1
[X] =
0
1
0
0
0
0
1
1
1 1 0 1
0
1
1 0
1 0.5
1
1
Also obtain foreshortening factors fx, fy, fz.
Solution : From the previous example (1), the concatenated transformation matrix [T] is
2
3
4
2
0 0
2
[T] =
0 0 0
2
1
2
– 6
4
0 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.11 Projection
The transformed position vectors [X'] are obtained by applying [T] on [X], we get
0 0 1 1
1 0 1
1 0.5 1
1
1 2
3
4
2
0 0
0.5 1 1 1
2
0 1 1 1 0 0 0
[X'] = [X] [T] = 2
0
1
0
0
0
0
1
1 1 – 6
0
0
1 1 0 1 2 4
0
1
1 0
1 0.5
1
1 0 0 0 1
0.5 0.612 0 1
1.366 −0.259 0 1
1.366 0.095 0 1
0.933 0.272 0 1
0.5 0.095 0 1
=
0
0.866
0
0.354
0
0
1
1
0.866 1.061 0 1
0
1.116
0.707
0.754
0
0
1
1
The foreshortening ratios are obtained by applying [T] on unit vectors along the principal
axes.
2
3
4
2
0 0 3 2
1
0 1
2 4
1 0 0 2
=
∴
[U] [T] = 0 1 0 1
0
2
0 0 2
0 0 1
0 0 1 1
1 – 6
0
2
1
0 1 – 6
2 4
1
0
2 4
0 0 0
Foreshortening factors are :
32 22
fx = + = 0.935
2 4
2
fy = = 0.707
2
fz =
12 + – 62 = 0.791
2 4
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.12 Projection
Example 3.5 : Develop the transformation matrix for trimetric projection obtained by rotation
about y-axis through an angle φ = 45°, followed by rotation about x-axis through an angle θ = 60°
and then orthographic projection on z = 0 plane. Apply it on the cube whose position vectors are
given below :
1
0 0 1 1
0 1 1
0.51 0.5 1 1
0
1 1 1
1 1 1
[X] =
01 0
0
0
0
1
1
10 1 0 1
1 1
1
0
0.5
1
1
Also obtain the foreshortening factors fx, fy, fz.
Solution : The concatenated transformation matrix for trimetric projection is given by;
[T] = [Ry] [Rx] [Pz]
cos0 φ sincos
φ sin θ 0 0
=
θ 0 0
0.7071 0.6124 0 0
⇒ [T] =
0 0.5 0 0
0.7071 – 0.6124 0 0
0 0 0 1
The transformed position vectors [X'] are obtained by applying [T] on [X], we get;
0 0 1 1
1 0 1 1
1 0.5 1 1
0.7071 0.6124 0 0
0.5 1 1 1
0 1 1 1 0 0.5 0 0
[X'] = [X] [T] = 0 0 0 1 0.7071 – 0.6124 0 0
1
1
0
1
0
0
1
1 0 0 0 1
0
1
1
1
0
0.5
1
1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.13 Projection
1.4142
0.7071 − 0.6123 0 1
0 0 1
1.4142 0.25 0 1
1.0607 0.1939 0 1
0.7071 −0.1123 0 1
=
0.7071
0 0
0.6124
0
0
1
1
0.7071 1.1124 0 1
1.0607
0 0.5
0.8062
0
0
1
1
The foreshortening ratios are obtained by applying [T] on unit vectors along the principal
axes.
1 0 0 1 0.7071 0.6124 0 0
∴
[U] [T] = 0 1 0 1
0 0.5 0 0
0 0 1 1
0.7071 – 0.6124 0 0
0 0 0 1
0.7071 0.6124 0 1
=
0 0.5 0 1
0.7071 – 0.6124 0 1
Foreshortening factors are :
fy = (0.5)2 = 0.50
cos0 φ 0 –sin φ 0
1 0 0 0
10 0 0 0
=
1 0 0 0 cos θ sin θ 0 1 0 0
sin φ 0 cos φ 0 0 –sin θ cos θ 0 0 0 0 0
0 0 0 1 0 0 0 1 0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.14 Projection
1 0 0 1
cos φ sin φ sin θ 0 0
[U'] = [U] [T] = 0 1 0 1
0 cos θ 0 0
0 0 1 1
sin φ –cos φ sin θ 0 0
0 0 0 1
=
sin2 θ (1 – sin2 θ) + sin2 θ [... using (5)]
1 – sin2 θ
= sin2 θ + sin2 θ
= 2 sin2 θ
2
fz
⇒ sin2 θ = … (6)
2
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.15 Projection
2
fz
2
2 fz
Equation (5) ⇒ sin2 φ = 2 = 2 … (7)
fz 2 – fz
1–
2
± fz
Thus, equations (6) and (7) ⇒ θ = sin–1
2
± fz
and φ = sin–1 2
2 – fz
This shows that the range of foreshortening factor is 0 ≤ fz ≤ 1. Foreshortening factor f(z) gives
four possible dimetric projections for the following angles :
(i) θ > 0, φ > 0
(ii) θ > 0, φ < 0
(iii) θ < 0, φ > 0
(iv) θ < 0, φ < 0
Example 3.6 : Determine the dimetric projection for the for shortening factor along z-axis of
1
, for the cube with the corner cut-off whose position vector is
2
1
0 0 1 1
0 1 1
0.51 0.5 1 1
0
1 1 1
1 1 1
[X] =
01 0
0
0
0
1
1
10 1 0 1
1 1
1
0
0.5
1
1
± fz ± 1 = sin–1 (± 0.35 355) = ± 20.705°
Solution : Here θ = sin–1 = sin–1
2 2 2
± fz
and φ = sin–1 2
2 – fz
= sin–1
±1
1
2 2–
4
= sin–1 (± 0.378)
= ± 22.208°
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.16 Projection
0
cos (22.208°) sin (22.208°) sin (22.705°) 0 0
=
cos (22.208°) 0 0
sin (22.208°) –cos (22.208°) sin (22.208°) 0 0
0 0 0 1
0.926 0.134 0 0
[T] =
0 0.935 0 0
0.378 –0.327 0 0
0 0 0 1
The transformed position vectors [X'] are obtained by applying [T] on [X],
0.378 −0.327 0 1
1.304 −0.194 0 1
1.304 0.274 0 1
0.841 0.675 0 1
0.378 0.608 0 1
[X'] = [X] [T] =
0
0.926
0
0.134
0
0
1
1
0.926 1.069 0 1
0
1.115
0.935
0.905
0
0
1
1
(III) Isometric Projection :
In an isometric projection, all the three principal axes are foreshortened equally so that
relative proportions are maintained. This creates no confusion and no error in manual
construction. Obviously, this is not the case in previous projections where scaling factors are
different for the three principal axes.
Thus, isometric projection is the projection where all the three foreshortening factors are
equal. i.e. in isometric projection, fx = fy = fz
φ = sin–1 ±
1 = ± 45°
⇒
2
Note that there are four possible isometric projections.
The foreshortening factors for an isometric projection are
fx = fy = fz
2 2 2
⇒ fx = fz = fy
2 2 2 1 2
⇒ fx = fz = fy = cos2 θ = 1 – sin2 θ = 1 – =
3 3
2
⇒ fx = fy = fz = = 0.8165
3
Illustrative Examples
Example 3.7 : Obtain isometric projection of the line segment between the points A [1 –2 1]
and B [3 1 –6].
Solution : For isometric projection, fx = fy = fz = 0.8165
Let, φ = Rotation about y-axis = ± 45°
θ = Rotation about x-axis = ± 35.26°
Choosing θ > 0, φ > 0
∴ The transformation matrix [T] is
A
The projected terminal vertices A' and B' are obtained by applying [T] on .
B
A' A
Thus = [T]
B' B
1
0.7071 0.4082 0 0
⇒
A' 1 –2 1
=
0 0.8165 0 0
B' 3 1 –6 1 0.7071 –0.4082 0 0
0 0 0 1
A' 1.4142 –1.633 0 1
⇒ =
B' –2.1214 4.4903 0 1
Example 3.8 : Determine the isometric projection transformation for φ = – 45° and
θ = + 35.26439°. Apply it on the object [X], where,
0 0 1 1
1 0 1 1
1 0.5 1 1
0.5 1 1 1
0 1 1 1
[X] =
0
1
0
0
0
0
1
1
1 1 0 1
0
1
1
1
0
0.5
1
1
Solution : Here φ = – 45, θ = 35.26439
∴ The transformation matrix [T] is
0
cos (–45°) sin (–45°) sin (35.26439°) 0 0
=
cos (35.26439°) 0 0
sin (–45°) –cos (–45°) sin (35.26439°) 0 0
0 0 0 1
0.707 –0.408 0 0
=
0 0.816 0 0
–0.707 –0.408 0 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.19 Projection
The transformed position vectors [X'] are obtained by applying [T] on [X].
1
0 0 1 1
0 1 1
0.51 0.5 1 1 0.707 –0.408 0 0
0 0
1 1 1
1 1 0
1 0.5
1
1
−0.707 −0.408 0 1
0 −0.816 0 1
0 −0.406 0 1
−0.354 0.204 0 1
−0.707 0.408 0 1
=
0
0.707
0
−0.408
0
0
1
1
0.707 0.408 0 1
0
0.354
0.816
0.204
0
0
1
1
For φ < 0, θ > 0, the result is shown in Fig. 3.21 below.
Fig. 3.8
B
B
A A B
A
a C
b b
O a
X
D
–a
–b b A [0, 0, 1]
B [–a, –b, 1]
Z
Fig. 3.10
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.21 Projection
1 0 0
[T] =
0 1 0
–a –b 1
In three-dimensional space, translation in two-dimensions is nothing but shearing in x and y
directions by the factors proportional to z-co-ordinate in three-dimensional space. The resulting
transformation matrix is
10 0 0 0
[T] =
1 0 0
–a –b 1 0
0 0 0 1
10 0 0 0
[T] =
1 0 0 … (1)
–a –b 0 0
0 0 0 1
b
In ∆ OCD, sin α = ⇒ b = f sin α
f
a
cos α = ⇒ a = f cos α
f
10 0 0 0
[T] =
1 0 0 … (2)
–f cos α –f sin α 0 0
0 0 0 1
f = 0, β = 90°
f = 1, β = 45°
Illustrative Examples
Example 3.9 : Let
1
0 0 1 1
0 1 1
[X] =
5 5 1 1
01 0 0
0 0
1
1
5 5 0 1
Obtain the cabinet projection of [X] with α = 30°.
Solution : The transformation matrix for an oblique projection is
10 0 0 0
[T] =
1 0 0
– f cos φ – f sin α 0 0
0 0 0 1
1
For cabinet projection : f = , β = 30° (given)
2
0 10
1 0 0 0
0 0 0
∴ [T] =
3 1 0 0
= 1 0 0
– 4 –0.433
1
– 0 0 –0.25 0 0
1
4
0 0 0 1
0 0 0
1 0 1 1 1
0 0 1 1
0 0 0
=
5 5 1 1 0 1 0 0
01 00 00 11 –0.433
0
–0.25 0
0 0
0
1
5 5 0 1
0.567 –0.25 0 1
–0.433 –0.25 0 1
=
4.567 4.75 0 1
01 00 00 11
5 5 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.23 Projection
Example 3.10 : Obtain the transformation matrix for a cavalier projection for α = 45°.
Solution : The transformation matrix for an oblique projection is
10 0 0 0
[T] =
1 0 0
– f cos α – f sin α 0 0
0 0 0 1
For cavalier projection :
f = 1, here α = 45°
10 0 0 0
∴ [T] =
1 0 0
– cos 45° – sin 45° 0 0
0 0 0 1
10 0 0 0
=
1 0 0
– 0.707 – 0.707 0 0
0 0 0 1
Example 3.11 : Find the cabinet projection of the object represented by the following
position vector matrix [X] with a horizontal inclination α = 25°.
13 2 1
[X] =
4 –1
–1 –2 1
2 1 1
Solution : The transformation matrix for an oblique projection is
10 0 0 0
[T] =
1 0 0
–f cos α –f sin α 0 0
0 0 0 1
For cabinet projection :
1
f = , here α = 25°
2
0 1
1 0 0 0
0 0 0
cos 25° = 0
1 0 0
∴ [T] =
1 0 0
– 2 –0.4532 0
sin 25° –0.2114 0
– 0 0
1
2
0
0 0 0
0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.24 Projection
13 2 1 1
10 0 0 0
[X'] = [X] [T] =
4 –1 1
=
1 0 0
–1 –2 1 1 –0.4531 –0.2113 0 0
2 1 1 1 0 0 0 1
0.5469 1.7887 0 1
=
3.4531 4.2113 0 1
–1.4531 –2.2113 0 1
–1.5468 0.7887 0 1
Example 3.12 : Find the cavalier and cabinet projections of the unit cube determined by the
vertices A [0 0 0], B [1 0 0], C [1 1 0], D [0 1 0], E [0 1 1], F [0 0 0], G [1 0 1], H [1 1 1]. (Take the
horizontal inclination angle α = 30°)
10 0 0 0
[T] =
1 0 0
–f cos α –f sin α 0 0
0 0 0 1
10 0 0 0
10 0 0 0
∴ [T] =
1 0 0
=
1 0 0
–cos 30° –sin 30° 0 0 –0.8660 –0.5 0 0
0 0 0 1 0 0 0 1
1
0 0 0 1
1 1
0 0 1
1 0
10 0 0 0
=
0 1 0 1 1 0 0
00 1 1
0 1
1
1
–0.8660
0
–0.5 0
0 0
0
1
1 0 1 1
1 1 1 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.25 Projection
1
0 0 0 1
1 1
0 0 1
1 0
=
0 1 0 1
–0.8660
–0.8660
0.5
–0.5 0
0 1
1
0.1340 –0.5 0 1
0.1340 0.5 0 1
1
For cabinet projection : f = , here α = 30°
2
0 1
1 0 0 0
0 0 0
cos 30 = 0
1 0 0
∴ [T] =
1 0 0
– 2 –0.433 0
sin 30 –0.25 0
– 0 0
1
2
0
0 0 0
0 0 1
1
0 0 0 1
1 1
0 0 1
1 0
10 0 0 0
[X'] = [X] [T] =
0 1 0 1 1 0 0
00 1 1
0 1
1
1
–0.433
0
–0.25 0
0 0
0
1
1 0 1 1
1 1 1 1
1
0 0 0 1
1 1
0 0 1
1 0
=
0 1 0 1
–0.433
–0.433
0.75
–0.25 0
0 1
1
0.567 –0.25 0 1
0.567 0.75 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.26 Projection
Centre of the
projection
View plane
Fig. 3.11
10 0 0 0
[x y z 1]
1 0 0 = [x y z rz + 1] … (1)
0 0 1 r
0 0 0 1
where, rz + 1 ≠ 1.
10 0 0 0
1 0 0 0
=
1 0 0 0 1 0 0
0 0 1 r 0 0 0 0
0 0 0 1 0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.27 Projection
10 0 0 0
=
1 0 0 … (3)
0 0 0 r
0 0 0 1
Applying [T] on [x y z 1], we get
10 0 0 0
[x y z 1]
1 0 0 = [x y 0 rz + 1] … (4)
0 0 0 r
0 0 0 1
where, rz + 1 ≠ 1.
The ordinary co-ordinates are obtained by dividing rz + 1, we get
10 0 0 0
We have to show that [T] =
1 0 0 produces the perspective projection on z = 0
0 0 0 r
0 0 0 1
plane.
Y
y'
O X
x' S
z
P [x, y, z, 1]
y
R
x Q
Zc
Z
Fig. 3.12
Consider the point P [x z 1] in the space from the centre of projection at zc. The perspective
projection of the P (x y z 1) z = z' = 0 plane at point [x' y' z' 0 1].
The co-ordinates of the point P' are obtained in terms of Zc as follows,
∆ ZcRQ ≅ ∆ Zc OS
|OS| |OZc| |ZcS|
⇒ = =
|RQ| |RZc| |ZcQ|
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.28 Projection
x' zc
⇒ =
x zc – z
x – zc
⇒ x' =
zc – z
x
⇒ x' =
z
1–
zc
y
y' =
z
1–
zc
1
Choose r = – . The co-ordinates to the point P' can be written as
zc
P'
x y
0 1
1 + rz 1 + rz
10 0 0 0
Thus if [T] =
1 0 0
0 0 0 r
0 0 0 1
10 0 0 0
= [x y z 1]
1 0 0
0 0 0 r
0 0 0 1
= [x y 0 1 + rz]
Note : (i) If the centre of the projection is on x-axis at [xc 0 0 1] then the corresponding
transformation matrix is
0
1
0 0 –
0
xc
[T] = 1 0 0
0
0
0 1 0
0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.29 Projection
0
1 0 0 0
[T] =
0 0 –
1
yc
0
0
0 1 0
0 0 1
(iii) If the centre of the projection is on z-axis at [0 0 zc 1] then the corresponding
transformation matrix is
0
1 0 0 0
[T] =
0 0 0
1
0 0 1 –
z
0 1
c
0 0
Illustrative Examples
Example 3.13 : Obtain the concatenated matrix representation of the following
transformation in order :
(α) Rotation about y-axis by φ = – 30°
(β) Rotation about x-axis by θ = 45°
(γ) Projected onto z = 0 plane from a centre of projection z = zc = 2.5.
Solution : The concatenated matrix [T] is given by
[T] = [Ry] [Rx] [Tp]
where, [Ry] = Rotation matrix about y-axis
[Rx] = Rotation matrix about x-axis
[Tp] = Projection matrix
0
1 0 0 0
0 1 0 0 0
0
=
cos 45° sin 45°
1 0 0
1
0
0
– sin 45° cos 45° 0
1
0 0 1 –
2.5
1
0 0
0 0 0
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.30 Projection
0.866 0 0.5 0
1 0 0 0
10 0 0 0
=
0 1 0 0 0 0.707 0.707 0 1 0 0
– 0.5 0 0.866 0 0 – 0.707 0.707 0 0 0 0 – 0.4
0 0 0 1 0 0 0 1 0 0 0 1
10 0 0 0
1 0 0 0
∴ [T] =
1 0 0 0 1 0 0
0 0 1 0 0 0 0 – 0.02
2 3 4 1 0 0 0 1
10 0 0 0
=
1 0 0
0 0 0 – 0.02
2 3 0 0.92
Example 3.15 : Obtain perspective projection onto the y = 0 plane from the centre of
projection C' [0 5 0] of the ∆ ABC, where,
A 15 17 –20
B = 25 10 40
C 30 15 40
Solution : The centre of projection is on y-axis at C' [0 5 0 1], the corresponding
transformation matrix is
0
1 0 0 0
[T] =
0 0 –
1
5 [see note (ii)]
0
0
0 1 0
0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.31 Projection
A' A
B' = B [T]
C' C
1
1 0 0 0
15 17 –20
= 25 10 40 1
0 0 0 –
1
5
1 0
30 15 40
0
0 1 0
0 0 1
15 0 –20 –2.4
= 25 0 40 –1
30 0 40 – 2
A' –6.25 0 8.33 1
⇒
B' = –25 0 –40 1
C' –15 0 –20 1
3.7 The Effect of Perspective Transformations and Vanishing
Point
The Fig. 3.26 shows the perspective projection on the line AB parallel to z-axis on the z = 0
1
plane, into the line A* B* in the z = 0 plane, from the centre of projection at – on z-axis.
r
Obviously this transformation contains two steps: the perspective transformation and
orthographic projection. i.e. [T] = [Pr] [Pz]. The perspective transformation of the line AB yields the
line A' B' in three-dimensional space and the orthographic projection of the line A' B' in
three-dimensional space from the centre of projection at infinity of z-axis yields the line A* B*.
The line A'B' intersects the z = 0 plane (the line AB and the line A'B' intersect in z = 0 plane at
1
the same point). The line A'B' also intersects z-axis at point z = . The perspective transformation
r
has transformed the point of intersections at infinity of the line AB which is parallel to z-axis and
1 1
z-axis itself into finite point at z = , on z-axis. The point 0 0 1 is called the 'vanishing point'
r r
on z-axis. The vanishing point lies at equidistance on the opposite side of the plane of projection
from the centre of the projection.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.32 Projection
Z
Initial line
l
[0, 0, –,
r 1]
Vanishing
point
B' A y
l
— A'
r
B*
A*
l
–—
r
l
[0, 0, – –, x
Centre of r 1]
projection
Fig. 3.13
The perspective transformation of the point at infinity on positive z-axis is
10 0 0 0
[0 0 1 0]
1 0 0 = [0 0 1 r]
0 0 1 r
0 0 0 1
0
1 0 0 p
[x y z 1]
1 0 0 = [x y z (px + 1)]
0 0 1 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.33 Projection
[x* y* z* 1] =
x y z
1
px + 1 px + 1 px + 1
10 0 0 0
[x y z]
1 0 q = [x y z (qy + 1)]
0 0 1 0
0 0 0 1
[x* y* z* 1] =
x y z
1
qy + 1 qy + 1 qy +1
10 0 0 0
[x y z 1]
1 0 0 = [x y z r z + 1]
0 0 1 r
0 0 0 1
[x* y* z* 1] =
x y z
1
px + 1 px + 1 px + 1
Illustrative Examples
Example 3.16 : Perform the perspective projection onto the z = 0 plane of the unit cube
(whose position vectors are given below) from the centre of projection at zc = 10 on z-axis.
1
0 0 1 1
1 1
0 1 1
1 1
[X] =
0 1 1 1
01 0 0
0 0
1
1
1 1 0 1
0 1 0 1
10 0 0 0
10 0 0 0
[T] =
1 0 0
=
1 0 0 . . r = 1 = – 1 = – 0.1
.
0 0 0 r 0 0 0 –0.1 zc 10
0 0 0 1 0 0 0 1
1
0 0 1 1
1 1
0 1 1
1 1
1 0 0 0
[X'] = [X] [T] =
0 1 1 1 0 1 0 0
01 0 0
0 0
1
1
0
0
0 0
0 0
–0.1
1
1 1 0 1
0 1 0 1
1 0.9 1.11
0 0 0 0.9 0 0 0 1
1 0.9 1.11 1
0 0 0 0 1
1 0 1.11 0
=
0 1 0 0.9
=
0 1.11 0 1
01 0 0
0 0
1
1
0
1
0
0
0
0
1
1
1 1 0 1 1 1 0 1
0 1 0 1 0 1 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.35 Projection
H G D' C'
D C H' G'
E F
X X'
A' E' F' B'
A B
Z
Fig. 3.14
Example 3.17 : Obtain the principal vanishing points for the perspective transformations
given by
1 0 0 0
0.866 –0.354 0 –0.141
[VP] [T] = 0 1 0 0
0 0.707 0 –0.283
0 0 1 0
–0.5 –0.612 0 –0.245
0 0 0 1
–6.142 2.5 0 1 VPx
=
0 –2.5 0 1 VPy
2.04 2.5 0 1 VPz
Example 3.18 : Find the combined transformation matrix for the following sequence of
transformations : Translation in x, y and z directions by –1, 2 and 1 units respectively, followed by
1
scaling in x and y directions by factors 3 and respectively, followed by reflection through the
2
xy-plane. Apply it on the point [1 3 2]. (April 2008)
Solution : The transformation matrix for translation in x, y, z directions by –1, 2, 1 units is
1 0 0 0
[T1] =
0 1 0 0
0 0 1 0
–1 2 1 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.36 Projection
1
The transformation matrix for scaling in x and y directions by factors 3 and is
2
0
3 0 0 0
[T ] =
1
2
0 0
0 0
2
0 1
0 0 0 1
The transformation matrix for reflection through the yz plane is
–1 0 0 0
[T3] =
0 1 0 0
0 0 1 0
0 0 0 1
The combined transformation matrix is
[T] = [T1] [T2] [T3]
0 1 0 0 –10
3 0 0 0
1 0 0 0
0 0 0
∴ [T] =
0 1 0 0 2 1 0 0
0 0 1 0
0 0 1 0 00 0 1 0
–1 2 1 1 0 0 0 1 0 0 1
1
–3 0 0 0
1 0 0 0
0 1 0 0 0 0 0
∴ [T] = 2
0 0 1 0
0 0 1 0
1
0 0 0 1
–1 2 1
–3 0 0 0
∴ [T] =
0
1
2
0 0
0 0 1 0
3 1 1 1
The point P [1 3 2].
–3 0 0 0
*
[P ] = [P] [T] = [1 3 2 1]
0
1
2
0 0
0 0 1 0
3 1 1 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.37 Projection
∴ [P*] = 0
5
3 1
2
1 2 1
Example 3.19 : By considering the position vector matrix [X] =
3 4 –1 with
–1 –2 1
2 1 1
horizontal inclination angle α = 25°.
(a) Find the caviler projection. (b) Find the cabinet projection.
Solution : α = 25°, cos α = 0.9063, sin 25° = 0.4226, f = 1.
1 0 0 0
[T] =
0 1 0 0
– f cos α – f sin α 0 0
0 0 0 1
1 0 0 0
∴ [T] =
0 1 0 0
–0.9063 –0.4226 0 0
0 0 0 1
1 2 1 1
1 0 0 0
[X] [T] =
3 4 –1 1 0 1 0 0
–1 –2 1 1 –0.9063 –0.4226 0 0
2 1 1 1 0 0 0 1
0.9937 1.5774 0 1
∴ [X*] =
3.9063 4.4226 0 1
–1.9063 –2.4226 0 1
1.0937 0.5774 0 1
1
(b) α = 25°, cos α = 0.9063, sin α = 0.4226, f = .
2
1 0 0 0
[T] =
0 1 0 0
– f cos θ – f sin α 0 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.38 Projection
1 0 0 0
∴ [T] =
0 1 0 0
–0.4531 –0.2113 0 0
0 0 0 1
1 2 1 1
1 0 0 0
[X] [T] =
3 4 –1 1 0 1 0 0
–1 –2 1 1 –0.4531 –0.2113 0 0
2 1 1 1 0 0 0 1
0.5469 1.7887 0 1
∴ [X*] =
3.4531 4.2113 0 1
–1.4531 –2.2113 0 1
1.5469 0.7887 0 1
Example 3.20 : Find the concatenated transformation matrix for the following sequence of
transformation :
Solution : The transformation matrix for notation about x-axis by an angle 75° is;
1 0 0 0
[T1] =
0 cos 75° sin 75° 0
0 –sin 75° cos 75° 0
0 0 0 1
1 0 0 0
∴ [T1] =
0 0.2588 0.9659 0
0 –0.9659 0.2588 0
0 0 0 1
1 0 0 0
[T2] =
0 1 0 0
0 0 1 0
1 2 3 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.39 Projection
The transformation matrix for perspective projection onto y = 0 plane from the centre of
projection at the point [0 5 0] is
0
1 0 0 0
[T ] =
0 0 –
1
5
0
3
0 1 0
0 0 0 1
The concatenated transformation matrix is
[T] = [T1] [T2] [T3]
1 0 0 0
1 0 0 0
1 0 0 0
0 0
1
∴ [T] =
0 0.2588 0.9659 0 0 1 0 0 0 –
5
0 –0.9659 0.2588 0 0 0 1 0
0
1
0 1 0
0 0 0 1 1 2 3
0 0 0 1
1 0 0 0
1 0 0 0
∴ [T] =
0 0.2588 0.9659 0 0 0 0 –0.2
0 –0.9659 0.2588 0 0 0 1 0
0 0 0 1 1 0 3 0.6
1 0 0 0
∴ [T] =
0 0 0.9659 –0.0517
0 0 0.2588 0.1931
1 0 3 0.6
Example 3.21 : Consider a triangle with vertices A [2 2 1], B [1 – 1 4] and C [3 – 1 2]. Find the
perspective projection of ∆ ABC onto Z = 0 plane with centre of projection at Zc = 20 on the
Z-axis. (Oct. 2008)
1 1
Solution : Zc = 20 ⇒ – – = – 0.05.
Zc 20
1 0 0 0
[T] =
0 1 0 0
0 0 0 –0.05
0 0 0 1
A
* 1 0 0 0
2 2 –1 1
0 1 0 0
B* = 1 –1 4 1
C* 3 1
0 0 0 –0.05
–1 2
0 0 0 1
A
*
2 2 0 1.05
∴ B* = 1 –1 0 0.80
C* 3 –1 0 0.90
For normalization we divide in the first row by 1.05, in the second row by 0.80 and in the third
row by 0.90.
A
*
1.9047 1.9047 0 1
B* = 1.125 –1.125 0 1
C* 3.3333 –1.1111 0 1
Example 3.22 : Find the transformation matrix for the trimetric projection formed by a 40°
rotation about y-axis, followed by 75° rotation about x-axis and then parallel projection onto z = 0
plane. Also find all foreshortening factors. (Oct. 2007)
Solution : φ = 40°, θ = 75°, Given :
[T] = [Ry] [Rx] [Pz]
cos φ 0 – sin φ 0
1 0 0 0
1 0 0 0
[T] =
0 1 0 0 0 cos θ sin θ 0 0 1 0 0
sin φ 0 cos φ 0 0 – sin θ cos θ 0 0 0 0 0
0 0 0 1 0 0 0 1 0 0 0 1
cos 40° 0 – sin 40° 0
1 0 0 0
1 0
0 0
[T] =
0 1 0 0 0 cos 75° sin 75° 0 0 1 0 0
0
0.7660 0 –0.6427 0
1 0 0 0
1 0 0 0
[T] =
1 0 0 0 0.2588 0.9659 0 0 1 0 0
0.7660 0 –0.6427 0
1 0 0 0
[T] =
0 1 0 0 0 0.2588 0.9659 0
0.7660 0.6207 0 0
∴ [T] =
0 0.2588 0 0
0.6427 –0.7398 0 0
0 0 0 1
We apply [T] on the unit matrix [U].
0.7660 0.6207 0 0
1 0 0 1
0 0.2588 0 0
[U] [T] = 0 1 0 1 0.6427 0
0 –0.7398 0
0 1 1
0 0 0 1
0.7660 0.6207 0 1
= 0 0.2588 0 1
0.6427 –0.7398 0 1
fx = (0.7660)2 + (0.6207)2 = 0.5867 + 0.3852
∴ fx = 0.9719 = 0.9858
fz = (0.6427)2 + (– 0.7398)2
1 0 0 0
[T1] =
0 1 0 0
0 0 1 0
2 3 4 1
The rotation matrix for rotation about x-axis through πc is
1 0 0 0
1 0 0 0
[T2] =
0 cos π sin π 0
=
0 –1 0 0
0 – sin π cos π 0 0 0 –1 0
0 0 0 1 0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.42 Projection
The transformation matrix for single point perspective projection from the centre [0 0 5] is
0
1 0 0 0
[T ] =
1 0
1
0
0 5
3
0 0 –
0 0 0 1
1 0 0 0
=
0 1 0 0
0 0 0 –0.2
0 0 0 1
The concatenated transformation matrix is [T] = [T1] [T2] [T3]
1 0 0 0
1 0 0 0
1 0 0 0
∴ [T] =
0 1 0 0 0 –1 0 0 0 1 0 0
0 0 1 0 0 0 –1 0 0 0 0 –0.2
2 3 4 1 0 0 0 1 0 0 0 1
1 0 0 0
1 0 0 0
∴ [T] =
0 1 0 0 0 –1 0 0
0 0 1 0 0 0 0 0.2
2 3 4 1 0 0 0 1
1 0 0 0
∴ [T] =
0 –1 0 0
0 0 0 0.2
2 –3 0 1.8
We apply [T] on the point [1 2 3]
1 0 0
0
0 0 0 0.2
2 –3 0 1.8
∴ [P*] = [3 – 5 0 2.4]
For normalization we divide by 2.4.
Example 3.24 : The transformation matrix for single point perspective projection from the
1 0 0
0 1 0
0
0
1 0 0
0 1 0
0
0
centre [0 0 5] is [T3] =
0 0 0 −1/5
=
0 0 0 −0.2
0 0 0 1 0 0 0
1
Solution : The concatenated transformation matrix is
[T] = [T1] [T2] [T3]
10 0
1
0
0
0
0
10 0 0 0
−1 0 0
10 0
1
0
0
0
0
∴ [T] = 0 0
0 0 1 0 0 −1 0 0 0 −0.2
2 3 4 1 0 0 0 1 0 0 0 1
10 0
1
0
0
0
0
10 0
−1
0
0
0
0
∴ [T] = 0
0 0 1 0 0 0 −0.2
2 3 4 1 0 0 0 1
10 0
−1
0 0
0 0
[T] =
0 0 0 0.2
2 −3 0 1.8
We apply [T] on the point [1 2 3]
10 0
−1
0 0
0 0
*
[P ] = [P] [T] = [1 2 3 1] 0 0 0 0.2
2 −3 0 1.8
*
∴ [P ] = [3 −5 0 2.4]
For normalization, we divide by 2.4,
*
[P ] = [1.25 − 2.0833 0 1]
Think Over It
1. Find the perspective projection onto the view plane z = d; the centre of projection being
origin [0 0 0].
Points to Remember
1. A geometrical transformation in which one line, shape etc. is converted into another according
to certain geometrical rule is called a projection.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.44 Projection
2. An arbitrary point from which the lines are projected is called centre of projection.
3. If the centre of projection is located at infinity, then all the projections are parallel lines and
the resulting projection is called parallel projection.
4. If the centre of projection is located at finite point in three dimensional space, the resulting
projection is perspective projection.
5. The projection formed by parallel projectors, such that they are perpendicular to the
projection plane, is called orthographic projection.
6. The orthographic projection in which the direction of projection is not parallel to any of the
three co-ordinate axes, is called axonometric projection.
7. Principal forecasting factors.
8. Trimetric projection.
9. Oblique projection.
10. Cabinet projection.
Miscellaneous Exercise
(A) State whether the following statement is True or False :
1. The transformation matrix for reflection through YOZ plane is
−10 0
1
0
0
0
0
[T] =
0 0 1 0
0 0 0 1
π
2. The transformation matrix for rotation about X-axis through an angle is
4
0
1 0 0 0
1 1
2 2
0
.
0 −1
2
1
2
0
0 0 0 1
−10 0
1
0
0
0
0
3. The transformation given in [T] =
causes reflection through x = 0.
0 0 1 0
0 0 0 1
10 0
1
0
0
0
0
4. The matrix for projection onto Z = 0 plane is [P ] = z .
0 0 0 0
0 0 0 1
ANSWERS
1. - True 2. - True 3. - False 4. - True
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.45 Projection
(B) Multiple Choice Questions : Choose the correct alternative from given alternatives.
1. Axonometric projection is orthographic projection in which the direction of projection is not
parallel to ……
0 0 0
1 0 0 0 1 0 0 0
(a)
1 1
1
0
(b)
3 1 0 0
− 2 − 2
1
− 0 0 − 0 0
2 2
0 0 0 1 0 0 0 1
0
1 0 0 0 1 0 0 0
(c)
0
1
0
1
1
(d)
0 1
1
0 0
2 2
0 0
3
2
0 0
0 0 0 1 0 0 0 1
3. The transformation matrix for translation in x, y, z directions by −1, 2, 1 units is ……
10 0
1
0
0
0
0
01 1
0
0
0
0
0
(a) 0 0 1 0 (b) 0 0 1 0
−1 2 1 1 −1 2 1 1
10 0
1
0 −1
0 2
(c) 0 0 1 1 (d) none of these
−1 1 0 1
Answers
1 - (d) 2 - (b) 3 - (a)
(C) Theory Questions :
1. Give the classification of perspective parallel projection.
2. Explain parallel projection and transformation matrix.
3. What is homogeneous co-ordinate system ? Explain the need of homogeneous co-ordinates.
4. Explain the concept of vanishing point in perspective projection.
5. Explain the classification of parallel projection. Discuss the applications of parallel projections.
6. What are parallel perspective projections ? Give classification of both.
7. Derive the transformation matrix for perspective projection.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.46 Projection
8. Write definitions of :
(i) Parallel projection (ii) Perspective projection
(iii) orthographic projection (iv) Axonometric projection
(v) Isometric projection (vi) Diametric projection.
9. Derive the transformation matrix for oblique projection.
10. Write an algorithm for reflection of an object through an arbitrary plane in space.
11. State various types of axonometric projection.
12. What is the difference between cavalier and cabinet projection ? Derive the transformation
matrix for an oblique projection and hence find the conditions for cavalier and cabinet
projection.
13. Explain : (i) centre of projection, (ii) parallel projection.
14. Define orthographic projection. Write a matrix of orthographic projection.
15. With usual notations, derive the expression for
θ = angle of rotation about x-axis
φ = angle of rotation about y-axis for diametric projection
(D) Numerical Problems :
1. Determine the principle for shortening factors, if the matrix for axonometric projection is
given by;
−0.87
0.05
0
− 0.69
0
0
0
0
[T] =
0.08 − 0.74 0 0
3.1 2.7 0 1
2. In trimetric projection the rotation about y-axis through an angle 30° is followed by rotation
about x-axis through an angle 45° and then parallel projection onto the Z = 0 plane. Find the
matrix of transformation. Also find the foreshortening ratios.
3. Find the cavalier and cabinet projections of the unit cube determined by the vectors,
A[0 0 0], B[1 0 0], C[1 1 0], D[0 1 0], E[0 1 1], F[0 0 1], G[1 0 1] and H[1 1 1]. Take
the horizontal inclination angle α = 30°.
4. Determine the foreshortening factors fx, fy, fz if the transformation matrix for axonometric
0.5 0.43 0 0
0 0.86 0 0
projection is given by
0.86 0.25 0 0
.
3.58 0.75 0 1
5. Obtain isometric projection of the line segment between the points A[1 −2 1] and
B[3 1 −6].
6. Find the cavalier projection with α = 30° and cabinet projection with α = 25° of the object
1
7. Determine the diametric projection if the foreshortening factor along z-axis with θ > 0,
5
φ > 0.
8. Determine the isometric projection for φ = − 45°, θ = − 35.26°. Apply it on P[1 2 1].
9. Write the transformation matrix for perspective projection onto the z = 0 plane from the
centre of projection at the point [0 0 5].
3
10. Write the transformation matrix for diametric projection with fx = , φ > 0, θ > 0.
8
11. Obtain single point perspective projection onto z = 0 plane of the object represented by X
0 3 1
from the centre of projection Zc = 4 on z-axis. X = 1 1 0.
1.5 0 −2
12. Give an example of axonometric projection.
13. Develop the cavalier and cabinet projection for α = 120° of the object X =
1 2 2 1 .
0 1 2 1
14. Write the transformation matrix for orthographic projection to create bottom view of the
object.
15. Write the transformation matrix for the perspective projection from the centre of projection Zb
(0 50 0) onto the y = 0 plane.
16. Write the transformation matrix which is required to transform the plane z = 0 to the plane
x = 5.
Answers
0.8660
0
0.3535
0.7071
0
0
0
0
2. [T] = 0.5 − 0.6123 0 0
0 0 0 1
3. Cavalier projection Cabinet projection
0 0 0 1 0 0 0 1
1 0 0 1 1 0 0 1
1 1 0 1 1 1 0 1
0 1 0 1 0 1 0 1
− 0.866 0.5 0 1 − 0.866 0.5 0 1
− 0.866 − 0.5 0 1
− 0.866 − 0.5 0 1
0.134 − 0.5 0
0.134 0.5 0
1
1 0.134 − 0.5 0
0.134 0.5 0
1
1
4. fx = 4.2472, fy = 23.9253, fz = 4.5512
*
A 1.4142 − 1.633 0 1
5. * = − 2.1214 4.4903 0 1
B
6.
− 0.866 − 0.5 0 1 , − 0.4531 − 0.2113 0 1
0.134 0.5 0 1 0.5469 − 0.2113 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 3.48 Projection
0.9897
0
0.0201
0.9899
0
0
0
0
7. [T] =
0.1428 − 0.1399 0 0
0 0 0 1
*
8. P = [0 0.8168 0]
10 0
1
0
0
0
0
9. [T] =
0 0 0 − 0.2
0 0 0 1
0.9614
0
− 0.07330
0.9642
0
0
0
0
10. [T] =
0.2750 − 0.2550 0 0
0 0 0 1
0 − 2.4 0
*
11. X = 1 1 0
1 0 0
12. Following are some of the examples of axonometric projection :
(i) Shadow created by sun.
(ii) Image of plane occurred by telecasting.
10 0
0
0
0
0
0
14. [T] =
0 1 0 0
0 0 0 1
0
1 0 0 0
15. [T] =
0 0 −
1
50
0
0
0 1 0
0 0 1
10 0
1
0
0
0
0
16. [T] =
0 0 1 0
5 0 0 1
✍✍✍
Chapter 4…
Plane and Space Curves
(A) Plane Curves
He was a personal friend of Charles Hermite due to whose efforts he
obtained the post of professor of mathematics at Tavlouse. He made
research on Integration of Calculus. He discussed many mathematical
problems with Hermite by means of personal letters. They were so deep
rooted to mathematics that the contents of the letters were published as
"Correspondence" in 1905 after his death in which he made vivid and
elaborate discussions about complex variables. The integrals which he
T.J. Sleiltjes had indicated therein are now-a-days called "Steiltjes Integral".
(1856-1894 A.D.)
4.1 Introduction
We know that variety of techniques is available for drawing and designing curves. Here, we
are going to discuss two-dimensional curve generation techniques. A curve is two-dimensional if it
lies completely in one plane. In this chapter, we discuss only the conic sections.
4.2 Curve Representation
A curve may be represented as a collection of points, provided that the points are properly
spaced and are connected by short straight line segment. Even though the curve may be
adequately represented as a collection of points, the analytical representation has various
advantages. By an analytical representation, properties such as radius of curvature and scope can
be easily determined. When the curve is represented by a collection of points, the intermediate
points are obtained by using interpolation, whereas any point on an analytically represented curve
can be precisely determined.
There are various techniques for analytical representation of two-dimensional curves.
Analytical definition of curve from the known set of data points is the interpolation problem. A
curve that passes through all given set of data points is said to fit the given data.
If the curve does not pass through the given set of data points, the curve is said to fail the
data. The technique for it is the method of least squares approximation. This method gives curve
of the form y = f (x). For example, (y = axb, y = aebx) etc. where a, b are constant.
4.3 Non-parametric Curves
For a plane curve, the non-parametric form is given by,
y = f (x)
For example, equation of straight line y = mx + c is in the non-parametric form.
A general second degree equation
ax2 + by2 + 2hxy + 2gx + 2fy + c = 0 ... (1)
represents a conic, which is two-dimensional curve.
(4.1)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.2 Plane and Space Curves
The non-parametric representation of the unit circle in the first quadrant is,
y = 1 – x2 , (0 ≤ x ≤ 1) ... (1)
⇒ P (θ) = [x y]
For example,
Y
B
2
t
1+
2t
q
X
O 1–t
2 A R
Fig. 4.1
P (t) =
1– t2 2t
(0 ≤ t ≤ 1) ... (4)
1 + t 1 + t2
2
Illustrative Examples
Example 4.1 : Determine the value of y on the unit circle, given that x = 0.866.
Solution : The non-parametric representation of the unit circle in the first quadrant is given
by,
y = 1 – x2 , 0 ≤ x ≤ 1
⇒ y = 1 – (0.866)2
⇒ y = 1 – 0.7499
⇒ y = 0.5
First, we have to find parameter t in terms of x and then in terms of y.
The parametric representation of unit circle is,
x = cos θ, y = sin θ
⇒ θ = cos–1 (x)
⇒ θ = cos–1 (0.866) = 30°
y = sin 30° = 0.5
Thus, y = 0.5
Alternatively, we have
1 – t2 2t
x = 2 , y=
1+t 1 + t2
Solving these two equations for t, we get,
t =
1 – x
1 + x
⇒ t =
1 – 0.866
1 + 0.866
=
0.134
1.866
⇒ t = 0.2679
2t
Thus, y =
1 + t2
2 (0.2679)
= = 0.5
1 + (0.2679)2
⇒ y = 0.5
For finding the unknown value of an variable, an iterative technique is used for parametric
representations. Both representations (parametric and non-parametric) find useful applications in
computer graphics.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.5 Plane and Space Curves
Fig. 4.2
Let the point Pi (where i = 1, 2, 3, ..., n) lies evenly on the origin centered circle having radius r.
Since the points on the circle are uniformly spaced, there is an equal increment in the angle θ. Let
this increment be θ.
Now, at point Pi (xi, yi), we have,
xi = r cos θi
yi = r sin θi
∴ At point Pi + 1 (xi + 1, yi + 1), we have
xi + 1 = r cos θi + 1 ... (1)
yi + 1 = r sin θi + 1 ... (2)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.6 Plane and Space Curves
But θi + 1 = θi + δ θ
= xi cos δθ – yi sin δθ
= yi cos δθ + xi sin δθ
= xi sin δθ + yi cos δθ
xi + 1 = xi cos δθ – yi sin δθ
cos δθ sin δθ
[xi + 1 yi + 1] = [xi yi]
– sin δθ cos δθ
2π
Note : The increment δθ is constant and is given by δθ = , where n is the number of
n–1
uniformly spaced points on the circle.
Since a circle is a closed curve, the first point (θ = 0) and the last point (θ = 2π) coincide. Thus,
for getting n unique points on the circle, it is necessary to calculate (n + 1) points.
2π
Thus, δθ =
(n + 1 – 1)
2π
=
n
2π
Hence, for open curve, δθ =
n–1
2π
and for closed curve, δθ =
n
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.7 Plane and Space Curves
B
r
r
qn
q1
X
O D C
a
b
Fig. 4.3
Draw the circular arc of the origin centered circle of radius r in the first quadrant. Consider
uniformly spaced n points on the arc of the circle.
If arc lies in range a ≤ x ≤ b.
At point B, in a right angled ∆ OBC,
OC
cos θ1 =
OB
b
⇒ cos θ1 =
r
⇒ θ1 = cos–1
b
r
Therefore at point A, in a right angled ∆ OAD
θn = cos–1
a
r
Since n points are to be generated on this open arc, the range is uniformly divided into (n – 1)
parts.
θn – θ1
∴ δθ =
n–1
cos δθ sin δθ
Using [xi + 1 yi + 1] = [xi yi]
– sin δθ cos δθ
Step 5 : Represent the points generated by the position vector matrix [X].
Theorem 2 Obtain an algorithm to generate uniformly spaced n points on the circle
π 2 1
cos δθ = cos = =
4 2 2
x2 = x1 cos δθ – y1 sin δθ = (1)
1 –0 1 = 1
∴
2 2 · 2
y2 = x1 sin δθ + y1 cos δθ = (1)
1 1 1
+0 =
2 2 2
The remaining values of x and y are shown in the table below :
i xi yi
1 1 0
2 1 1
2 2
3 0 1
4 1 1
–
2 2
5 –1 0
6 1 1
– –
2 2
7 0 –1
8 1 1
–
2 2
9 1 0
Example 4.3 : Let [X] represent n points on the circle x2 + y2 = 1, obtain matrix representing
the circle (x + 3)2 + (y – 2)2 = 16.
Solution : Let [X]n × 3 + n points on the circle x2 + y2 = 1 and [X'] n×3 + n points on the circle
(x + 3)2 + (y – 2)2 = 1.
The combined 3 × 3 transformation is obtained, first scaling by the factor 4 and then
translating the origin (0, 0) to new origin (– 3, 2).
∴ [T] = [S] [Tr]
4 0 0
1 0 0
4 0 0
⇒ [T] = 0 4 0 0 1 0 = 0 4 0
0 0 1 –3 2 1 –3 2 1
Applying [T] on [X], we get,
[X'] = [X] [T]
4 0 0
⇒ [X'] = [X] 0 4 0
–3 2 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.10 Plane and Space Curves
Example 4.4 : Let [X] represents n points of the origin centered circle of radius 2. Obtain
matrix representing circle of radius 2 with centre located at (2, 2).
Solution : Let [X]n × 3 + n points on the circle x2 + y2 = 2 and [X'] n×3 + n points on the circle
(x – 2)2 + (y – 2)2 = 2.
The combined 3 × 3 transformation is obtained, first scaling by the factor 2 and then
translating the centre (0, 0) of the circle to the point (2, 2).
∴ [T] = [S] [Tr]
2 0 0
1 0 0
⇒ [T] = 0 2 0 0 1 0
0 0 1 2 2 1
2 0 0
[T] = 0 2 0
2 2 1
⇒ [X'] = [X] [T]
2 0 0
⇒ [X'] = [X] 0 2 0
2 2 1
Example 4.5 : Obtain 4 uniformly spaced points in the first quadrant of the unit circle with
centre at origin.
π
Solution : Since the arc of the circle lies in the first quadrant, here 0 ≤ θ ≤ .
2
π π
2 2 π
∴ δθ = = = (... n = 4)
n 4 8
For θ = 0
x1 = r cos θ1 = (1) cos (0) = 1
π
cos δθ = cos = 0.9239
8
The other uniformly spaced points are shown in the table below.
i xi yi
1 1 0
2 0.9239 0.3827
3 0.7070 0.7070
4 0.3827 0.9239
5 0 1
Y
1 E D
0.8 C
0.6
0.4 B
0.2
A
X
0 0.2 0.4 0.6 0.8 1
Fig. 4.4
Example 4.6 : Write an algorithm to generate 36 points on the circle (April 1995)
(x – 2)2 + (y + 2)2 = 25.
Solution : The given circle is, (x – 2)2 + (y + 2)2 = 25
Here,
(i) Number of points on the circle = n = 36.
(ii) Radius of given circle = r = 5.
(iii) Centre of the given circle = (h, k) = (2, – 2).
2π 2π π
Step 1 : Compute, δθ = = =
n 36 18
π
Step 2 : cos δθ = cos = 0.9848
18
π
sin δθ = sin = 0.1736
18
Step 3 : Generate 36 points on the circle x2 + y2 = 1.
Step 4 : Let [X]36 × 3 denote the 36 points on the circle x2 + y2 = 1, using
cos δθ sin δθ
[xi + 1 yi + 1] = [xi yi] =
– sin δθ cos δθ
⇒ where i = 1, 2, 3 ... 36 and initial points are,
x1 = 1, y1 = 0
i.e. [x1 y1] = [1, 0].
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.12 Plane and Space Curves
Step 5 : Scaling matrix [S], for scaling x and y directions by a factor 5 is,
5 0 0
[S] = 0 5 0
0 0 1
Step 6 : Translation matrix [Tr] by translating (0, 0) to (2, – 2) is,
1 0 0
[Tr] = 0 1 0
2
–2 1
Step 7 : The concatenated transformation matrix [T] is,
[T] = [S] [Tr]
5 0
1
0 0 0
⇒ [T] = 0 5 0 0 1 0
0 0 1 2 –2 1
5 0 0
⇒ [T] = 0 5 0
2 –2 1
Step 8 : The 36 points on the circle (x – 2)2 + (y + 2)2 = 25 are given by,
[X']36 × 3 = [X']36 × 3 [T]
Step 9 : Write [X'] with two-dimensional co-ordinates.
Example 4.7 : Generate 8 points on the circle, (x – 2)2 + (y – 4)2 = 25
Solution : The given circle is,
(x – 2)2 + (y – 4)2 = 25
Here, number of points = n = 8
radius = r = 5
centre = (h, k) = (2, 4)
2π π
δθ = =
8 4
8 points on the circle x2 + y2 = 1 are given below :
0.7071
1 0 1
0 1
0.7071 1
1
– 0.7071 0.7071 1
[X] = –1 0 1
– 0.7071
0
– 0.7071
–1
1
1
0.7071 – 0.7071 1
1 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.13 Plane and Space Curves
5 0 0
S = 0 5 0
0 0 1
Translating matrix [Tr] by translating (0, 0) to (2, 8/4)
1 0 0
[Tr] = 0 1 0
2
4 1
The combined transformation matrix [T] is,
[T] = [S] [Tr]
5 0 0
1 0 0
⇒ [T] = 0 5 0 0 1 0
0 0 1 2 4 1
5 0 0
⇒ [T] = 0 5 0
2 4 1
The points [X'] on the circle (x – 2)2 + (y – 4)2 = 25 are obtained by applying [T] on [X].
0.7071
1 0 1
0 1
0.7071 1
1
– 0.7071 0.7071 1
5 0 0
[X'] = –1 0 1
0 5 0
1
– 0.7071
0
– 0.7071 1
–1 1
2 4
0.7071 – 0.7071 1
1 0 1
5.5355 7.5355 1
7 4 1
2 9 1
– 1.5355 7.5355 1
= –3 4 1
– 1.5355
2
0.4645 1
–1 1
5.5355 0.4645 1
7 4 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.14 Plane and Space Curves
1 7 4
2 5.5355 7.5355
3 2 9
4 – 1.5355 7.5355
5 –3 4
6 – 1.5355 0.4645
7 2 –1
8 5.5355 0.4645
9 7 4
2 2
Example 4.8 : Generate 5 uniformly spaced points on the arc of a circle x + y = 49, in the
first quadrant. (March 2006)
2 2
Solution : Given circle x + y and n = 5.
π/2 π/2 π
Therefore, δθ = = =
n−1 4 8
π
Then cos δθ = cos = 0.9238
8
and sin δθ = 0.3826
The initial point is,
P1[x1 y1] = [7 0]
[x2 y2] = [7 0]
0.9238 0.3826
− 0.3826 0.9238
∴ [x2 y2] = [6.4666 2.6782]
= [xi yi]
0.9238 0.3826
− 0.3826 0.9238
∴ [x2 y2] = [7 0]
0.9238 0.3826
− 0.3826 0.9238
∴ [x2 y2] = [6.4666 2.6782]
i [xi yi]
1 [7 0]
2 [16.4666 2.6782]
3 [14.9492 4.9482]
4 [12.6789 6.4646]
5 [0 7]
Think Over It
Points to Remember
1. A geometrical transformation in which one line, shape etc. is converted into another according
to certain geometrical rule is called a projection.
Miscellaneous Exercises
(A) State whether the following statement are True or False :
1. In a parametric curve the curve end points and the length are fixed by the range of the
parameter.
2. The non-parametric representation of the unit circle in the first quadrant is
2
y = 1−x; −1≤x≤1
3. The parametric representation of unit circle in the first quadrant is
π
x = cos θ, y = sin θ; 0 ≤ θ ≤ .
2
ANSWERS
1 - (b) 2 - (c)
Answers
4. y = 0.866
5 3 3 − 4 1 3 3 − 4
5. [4 −2], , − , [2 −2],
2 2 2 2
1 3 3 − 4 5 3 3 + 4
− , −
2 2 2 2
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.19 Plane and Space Curves
4.6 Introduction
Space curves play an important role in engineering, the design of automobile bodies, aircraft
and space-craft surfaces, ship hulls. They also play an important role in medical science and
geology.
Space curves and surfaces can be generated from the given set of user-specific data points.
More precisely, the points that control the shape of the curve in a predictable ways, these points
are called control points. (See Fig. 4.5)
Fig. 4.5
(Control points indicated by dots govern the shape of a curve.)
A polynomial function of degree n in x given by,
n
∑ ai xi.
i=0
When n = 1, we get first degree equation; when n = 2, we get a quadratic; when n = 3, we get
a cubic polynomial and so on. Polynomials are useful in graphics, including the design of object
shapes. Designing object shapes is done by specifying a few points to define a general curve
contour, and then fitting the selected points with a polynomial.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.20 Plane and Space Curves
Fig. 4.7
When the polynomial sections are fitted to the general control point path without necessarily
passing through any control points, the resulting curve is said to approximate the set of control
points. See Fig. 4.20 below.
Fig. 4.8
A spline curve is defined, modified and manipulated with operations on the control points. A
spline curve can be translated, scaled or rotated with transformation applied to the control points.
A convex polygon boundary that encloses a set of control points is called a convex hull.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.21 Plane and Space Curves
A convex hull shapes for two sets of control points are shown by dotted lines in the Fig. 4.9 (a)
and (b).
B1
B2
B0 B3
B3
B0
B1
B2
(a) (b)
Fig. 4.9
There are three methods for representation of spline curve :
(i) Using the set of boundary conditions imposed on the spline curve.
(ii) Using the matrix which characterizes the spline curve.
(iii) Using the set of blending functions (or Bernstein basis functions) which determine how
specified geometric constrains on the curve are combined for calculating positions along
the curve path.
The mathematical description of a space curve is obtained without previous knowledge
regarding the shape of the curve.
In this chapter, we discuss two techniques : Be'zier curves and their generalization to B-spline
curves. These techniques are characterized by the fact that any points on the curve pass through
the control points used to define the curve.
4.7 Be'zier Curves
First, we discuss several properties of Be'zier curves.
Properties :
(i) It always passes through the first and last control points. See Fig. 4.10.
(ii) Be'zier curves has variation-diminishing property. This means it never oscillates widely
from its defining control points.
(iii) Bernstein basis functions are real.
B1 B2
B1
B0 B2 B0 B4
Be'zier curves
Fig. 4.10 : Be'zier curves
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.22 Plane and Space Curves
B0
B4
Be'zier curve
n i
Jn, i (t) = t (1 – t)n – i, i = 0, 1, 2, ..... n ... (2)
i
n n!
with = i ! (n – 1) !
i
and B0, B1, B2, ..., Bn are known as defining polygon.
n ! (1)0 (1 – 0)n – 0
Jn, 0 (0) = = 1, for i = 0
(1 !) (n !)
n ! 0i (1 – 0)n – i
and Jn, i (0) = = 0, for i ≠ 0
i ! (n – i) !
Thus, the first point on the Be'zier curve and the first point on its defining polygon are
coincident.
For the last point on the Be'zier curve i.e. at t = 1 :
n ! ti (1 – 1)n – i
and Jn, i (1) = = 0, for i ≠ n
n ! (1)
Thus, the last point on the Be'zier curve and the last point on its defining polygon are
coincident.
n
Note : ∑ Jn, i (t) = 1
i=0
Here we consider some cases (for n = 2, 3, 4 etc.) which will be helpful for solving some
examples.
When n = 2 :
(1) P (t) = B0 J2, 0 (t) + B1 J2, 1 (t) + B2 J2, 2 (t).
= B0 (1 – t)2 + B1 2t (1 – t) + B2 t2
= (t2 – 2t + 1) B0 + (– 2t2 + 2t) B1 + t2 B2 ... (4)
This can be written in matrix form as,
B
1 –2 1 0
P (t) = [ t2 t 1] – 2 2 0 B 1
1 0 0 B 2
B
B0
–1 3 –3 1
3 –6 3 0
0 B
1
P (t) = [ t3 t2 t 1]
–3 3 0
0 B
2
1 0 0 3
On expansion, we get
P (t) = (– t4 – 4t3 + 6t2 – 4t + 1) B0 + (– 4t4 + 12t3 – 12t2 + 4t) B1
B
B0
–4
1 –4 6 –4 1
6 B
12 –12 4 0 1
4 3 2
P (t) = [t t t t 1] –12 6 0 0
–4 0 B
2
4 0 0
1 0 B
3
0 0 0 4
Illustrative Examples
Example 4.10 : If B0 [1 1], B1 [2 3], B2 [4 3] and B3 [3 1] are the vertices of a Be'zier polygon,
∴ P
1 = (0.5)3 [1 1] + 3 (0.5) (0.5)2 [2 3] + 3 (0.5)2 (0.5) [4 3] + (0.5)3 [3 1]
2
= 0.125 [1 1] + 0.375 [2 3] + 0.375 [4 3] + 0.125 [3 1]
= [2.75 2.5]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.25 Plane and Space Curves
Example 4.11 : Find the parametric equation of a Be'zier curve determined by control points
B0 [2 1], B1 [4 3], B2 [6 0.5] and hence find the position vector of the point corresponding to
parameter value t = 0.43.
= (1 – t)2 B0 + 2t (1 – t) B1 + t2 B2
= (1 – t)2 [2 1] + 2t (1 – t) [4 3] + t2 [6 0.5]
= [28.4694 1.3151]
= [36.375 1.4375]
Example 4.12 : Find the parametric equation of a Be'zier curve determined by control points
B0 [1 0], B1 [2 3] and B2 [4 1] and hence find the position vector of the point corresponding to
parameter values t = 0.1, 0.2, 0.3, ... 0.9.
= (1 – t)2 B0 + 2t (1 – t) B1 + t2 B2
= (1 – t)2 [1 0] + 2t (1 – t) [2 3] + t2 [4 1]
Y
4
B1 [2, 3]
3
B2 [4, 1]
1
B0 [1, 0]
X
0 1 2 3 4
Fig. 4.12 : Be'zier curve and Be'zier polygon
Example 4.13 : Find the parametric equation of the Be'zier curve, where B0 [0 2], B1 [2 3],
B2 [3 2] and B3 [2 0] are the vertices of the Be'zier polygon. Also find the position vectors of the
points on the curve corresponding to parameter values 0.1, 0.2, 0.3, ..., 0.9.
= [0.569 2.41].
= [1.072 2.368].
= [1.503 2.387].
= [1.856 2.304].
= [2.125 2.125].
= [2.304 1.856].
= [2.387 1.503].
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.27 Plane and Space Curves
= [2.368 1.072].
= [2.241 0.569].
See Fig. 4.9.
Y
4
B1 [2, 3]
3
2]
[0,
B0
2 B2 [3, 2]
B3 [2, 0]
X
0 1 2 3 4
Fig. 4.13 : Be'zier curve and Be'zier polygon
Example 4.14 : Given B0 [1 1], B1 [2 3], B2 [4 3] and B3 [3 1] the vertices of the Be'zier curve at
t = 0, 0.15, 0.35, 0.5, 0.65, 0.85, 1.
Solution : The parametric equation of the Be'zier curve is,
P (t) = J3, 0 (t) B0 + J3, 1 (t) B1 + J3, 2 (t) B2 + J3, 3 (t) B3
= (1 – t)3 B0 + 3t (1 – t)2 B1 + 3t2 (1 – t) B2 + t3 B3.
= (1 – t)3 [1 1] + 3t (1 – t)2 [2 3] + 3t2 (1 – t) [4 3] + t3 [3 1].
P (0) = [1, 1] (... P (0) = B0)
P (0.15) = 0.674 [1 1] + 0.325 [2 3] + 0.058 [4 3] + 0.003 [4 3]
= [1.5 1.765]
P (0.35) = 0.275 [1 1] + 0.444 [2 3] + 0.239 [4 3] + 0.042 [4 3]
= [2.248 2.367]
P (0.5) = 0.125 [1 1] + 0.375 [2 3] + 0.375 [4 3] + 0.125 [4 3]
= [2.75 2.5]
P (0.65) = 0.042 [1 1] + 0.239 [2 3] + 0.444 [4 3] + 0.275 [4 3]
= [3.122 2.367]
P (0.85) = 0.003 [1 1] + 0.058 [2 3] + 0.325 [4 3] + 0.614 [4 3]
= [3.248 1.765]
P (1) = [3, 1] (... P (1) = B3)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.28 Plane and Space Curves
3.5
B1 [2, 3] B2 [4, 3]
3
2.5
1.5
1
B0 [1, 1] B3 [3, 1]
0.5
X
0 0.5 1 1.5 2 2.5 3 3.5 4
Fig. 4.14 : Be'zier curve and Be'zier polygon
n i
Jn, i (t) = t (1 – t)n – i ; 0 ≤ t ≤ 1.
i
is non-zero over the entire range of parameter. Thus, Be'zier curves do not allow for local control
of the curve shape. If we decide to change the position of the control points, the entire curve will
be affected.
The theory of B-splines was first introduced by Schoenberg. Let P (t) be the position vector of
any point on the curve, where t is a parameter. The parametric equation of B-spline curve is given
by,
n
P (t) = ∑ Ni k (t) Bi ; tmin ≤ t ≤ tmax ... (1)
i=0
i.e. 0 ≤ t ≤ (n – K' + 2)
where, Bi (i = 0, 2, ... n) be the control points and Ni, k are the normalized B-spline basis function
(or blending function).
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.29 Plane and Space Curves
The normalized B-spline functions of order k (degree k – 1) are defined by recursion formula
as follows.
Ni, 1 (t) = 1, if xi ≤ t, ≤ xi + 1
While calculating Ni, k (t), the denominator may turn out to be 0. So it should be noted that
0 0
the term is not meaningless, but it is assigned the value 0. Thus, here the convention = 0 is
0 0
permissible.
The parameter range [0 n – k + 2] is subdivided into (n + k) sub-intervals by the points x0, x1,
x2 ... xn + k, satisfying the relation xi ≤ xi + 1. These points are represented in the form of vector
[x0, x1, x2 ... xn + k] called as knot vector.
xi = i – k + 1 , if k ≤ i ≤ n ... (4)
xi = n – k + 2 , if i > n
where, i ≤ n ≤ n + k.
From the B-spline basis function formulas (2) and (3), it follows that the basis function Ni, k of
given order k depends on the basis functions Ni, k – 1, Ni – 1, k − 1 of order k − 1 for a given basis
function Ni, k. This dependence is shown in triangular term as under :
Ni, k
Fig. 4.15
For illustration, we prepare here, the parametric equation of the B-spline curve, where k = 2,
n = 5.
n = 5 ⇒ there are 6 control points, let it be B0, B1, B2, B3, B4, B5.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.30 Plane and Space Curves
= N0, 2 (t) B0 + N1, 2 (t) B1 + N2, 2 (t) B2 + N3, 2 (t) B3 + N4, 2 (t) B4 + N5, 2 (t) B5 ... (5)
We can subdivide the range [0, 5] by the knot vectors x0, x1, x2, x3, x4, x5, x6, x7 using equation
(4) as follows :
x0 = 0, x1 = 0, x2 = 1, x3 = 1, x4 = 3, x5 = 4, x6 = 5, x7 = 5
i.e. [x0 x1 x2 x3 x4 x5 x6 x7] = [0 0 1 2 3 4 5 5]
Here, we require basis function of order two, hence from equation (3), we have
N0, 2 (t) = (1 – t) N1, 1 (t)
N1, 2 (t) = t N1, 1 (t) + (2 – t) N2, 1 (t)
N2, 2 (t) = (t – 1) N2, 1 (t) + (3 – t) N3, 1 (t)
N3, 2 (t) = (t – 2) N3, 1 (t) + (4 – t) N4, 1 (t)
N4, 2 (t) = (t – 3) N4, 1 (t) + (5 – t) N5, 1 (t)
N5, 2 (t) = (t – 4) N5, 1 (t)
Substituting all these values in equation (5), we get the parametric equation of the B-spline
curve as follows :
P (t) = (1 – t) N1, 1 (t) B0 + [(t – 0) N1, 1 (t) + (2 – t) N2, 1 (t)] B1
+ [(t – 1) N2, 1 (t) + (3 – t) N3, 1 (t)] B2
+ [(t – 2) N3, 1 (t) + (4 – t) N4, 1 (t)] B3
+ [(t – 3) N4, 1 (t) + (5 – t) N5, 1 (t)] B4
+ (t – 4) N5, 1 (t) B5 ... (6)
Now, using equation (2) i.e.
Ni, 1 (t) = 1 ; if 0 ≤ t < 5
Ni, 1 (t) = 0 ; otherwise
From equation (6), we have,
P (t) = (1 – t) B0 + t B1, if 0 ≤ t < 1
P (t) = (2 – t) B1 + (t – 1) B2, if 1 ≤ t < 2
P (t) = (3 – t) B2 + (t – 2) B3, if 2 ≤ t < 3
P (t) = (4 – t) B3 + (t – 3) B4, if 3 ≤ t < 4
and P (t) = (5 – t) B4 + (t – 4) B5, if 4 ≤ 1 < 5 ... (7)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.31 Plane and Space Curves
When,
t = 0, (7) P (0) = B1
When, t = 5, (7) P (5) = B 5
This means that the B-spline curve always passes through the first and last control points.
The equation (7) is the parametric equation of B-spline curve of order 2, with 6 control points.
B-spline curves have the following properties.
Properties :
(1) The sum of the B-spline basis functions, for any parameter value t is equal to 1.
n
i.e. ∑ Ni, k (t) = 1
i=0
(2) Each B-spline basis function lies entirely within 0 and 1. i.e. 0 ≤ Ni, k (t) ≤ 1, for any
parameter t.
(3) For (n + 1) control points, the curve is described with (n + 1) basis functions.
(4) The B-spline curve generally follows the shape of the defining polygon.
(5) The B-spline curve lies completely within the convex hull of the defining polygon.
(6) Any affine transformation can be applied to the B-spline curve by applying it to the
defining polygon vertices (control points).
(7) The B-spline curve exhibits variation-diminishing property.
(8) Any control point can affect the shape of at most k curve sections.
(9) The parameter range [0 n – k + 2] is divided into (n + k) sub-intervals with the break-up
points x0, x1, x2 ... xn + k, satisfying the relation xi ≤ xi + 1. It is represented in the form of
vector [x0, x1 ... xn + k] called as knot vector.
Illustrative Examples
Example 4.15 : Find the parametric equation of a Be'zier curve determined by control points
B1 [1 0], B1 [2 3], B2 [4 1] and find the position vectors of the points on the curve corresponding
to the parameter values t = 0.3, 0.6, 0.9. (Oct. 2007)
Solution : The three control points B0 [1 0], B1 [2 3] and B2 [4 1] are given.
Therefore, n = 2
J2, 0 (t) =
2 t0 (1 – t)2 = (1) (1) (1 – t2) = (1 – t)2
0
J2, 1 (t) =
2 t1 (1 – t)1 = (2) t (1 – t) = 2t (1 – t)
1
J2, 2 (t) =
2 t2 (1 – t)0 = (1) t2 (1) = t2.
2
The parametric equation of Be'zier curve is
[P (t)] = J2, 0 (t) [B0] + J2, 1 (t) [B1] + J2, 2 (t) [B2]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.32 Plane and Space Curves
∴ [P (t)] = (1 – t)2 [1 0] + 2t (1 – t) [2 3] + t2 [4 1]
t = 0.3 gives
[P (0.3)] = (1 – 0.3)2 [1 0] + (2) (3) (1 – 0.3) [2 3] + (0.3)2 [4 1]
∴ [P (0.3)] = 0.49 [1 0] + 0.42 [2 3] + 0.09 [4 1]
= [0.49 0] + [0.84 1.26] + [0.36 0.09]
= [1.69 1.35]
[P (0.6)] = (1 – 0.6)2 [1 0] + (2) (0.6) (1 – 0.6) [2 3] + (0.6)2 [4 1]
∴ [P (0.6)] = 0.16 [1 0] + 0.48 [2 3] + 0.36 [4 1]
∴ [P (0.6)] = [0,.16 0] + [0.96 1.44] + [1.44 0.36]
∴ [P (0.6)] = [2.56 1.80]
[P (0.9)] = (1 – 0.9)2 [1 0] + (2) (0.9) (1 – 0.9) [2 3] + (0.9)2 [4 1]
∴ [P (0.9)] = 0.01 [1 0] + 0.18 [2 3] + 0.81 [4 1]
∴ [P (0.9)] = [0.01 0] + [0.36 0.54] + [3.24 0.81]
∴ [P (0.9)] = [3.61 1.35]
t Position vector
0.3 [1.69 1.35]
0.6 [2.56 1.80]
0.9 [3.61 1.35]
Example 4.16 : Find the parametric equation of the Be'zier curve with control points B0 [– 2 1],
B1 [1 3], B2 [6 –1]. Find the point corresponding to the parameter value t = 0.357. (Oct. 2008)
Therefore, n = 2
J2, 0 (t) =
2 t0 (1 – t)2 = (1 – t)2
0
J2, 1 (t) =
2 t1 (1 – t)1 = 2t (1 – t)
1
J2, 2 (t) =
2 t2 (1 – t)0 = t2
2
The parametric equation of Be'zier curve is
[P (t)] = J2, 0 (t) [B0] + J2, 1 (t) [B1] + J2, 2 (t) [B2]
Example 4.17 : If B0 [2 1], B1 [4 4], B2 [5 3], B3 [5 1] are the vertices of a Be'zier polygon, then
determine the points at t = 0.2, 0.4, 0.6, 0.8 of the Be'zier curve. Also trace the Be'zier curve.
Therefore, n = 3
J3, 0 (t) =
3 t0 (1 – t)3 = (1 – t)3
0
J3, 1 (t) =
3 t1 (1 – t)2 = 3t (1 – t)2
1
J3, 2 (t) =
3 t2 (1 – t)1 = 3t2 (1 – t)
2
J3, 3 (t) =
3 t3 (1 – t)0 = t3
3
The parametric equation of Be'zier curve is
[P (t)] = J3, 0 (t) [B0] + J3, 1 (t) [B1] + J3, 2 (t) [B2] + J3, 3 (t) [B3]
[P (0.2)] = (1 – 0.2)3 [2 1] + (3) (0.2) (1 – 0.2)2 [4 4]+ (3) (0.2)2 (1 – 0.2) [5 3] + (0.2)3 [5 1]
Y
B1
4
3 B2
1 B0 B3
X
1 2 3 4 5 6
Fig. 4.12
The encircled point give the shape of Be'zier curve.
Think Over It
• The mathematical description of a space curve is generated without any proper knowledge of
the shape of the curve.
• The Be’zier curves and their powerful generalization to B-spline curves are two techniques,
which are characterized by the fact that some points on the curve pass through the control
points used to define the curve.
Points to Remember
1. Polynomial of Be’zier curve for various number of control points (n)
Control points Be’zeir curve
B0 P(t) = B0 point itself
B0, B1 P(t) = (1 − t) B0 + B1 linear polynomial
2 2
B0, B1, B2 P(t) = (1 − t) B0 + 2(1 − t) (t) B1 + t B2
Quadratic polynomial
3 2
B0, B1, B2, B3 P(t) = (1 − t) B0 + 3(1 − t) t B1
2 3
+ 3(1 − t) t B2 + t B3
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.35 Plane and Space Curves
3
P(t) = [t t t 1]
2
3 3 0 0 B
1
−1 B
2
0 0 0 3
Miscellaneous Exercise
(A) State whether the following statement are True or False :
1. Be’zeir curve is a polynomial of degree one less than the number of control points.
2. Any Be’zeir curve lies within the convex hull of the control points.
3. In a Be’zeir curve, the degree of the polynomial defining the curve segment is one more than
the number of defining polygon points.
ANSWERS
1. - True 2. True 3. False
(B) Multiple Choice Questions
1. The control points of a Be’zeir curve are B0[2 1], B1[4 3] and B2[6 0.5]. The vector of the
point corresponding to parameter t = 0.5 is ……
(a) [3.8 1.85] (b) [1.66 0.8]
(c) [4 1.875] (d) [3 2.45]
2. For a cubic n = 3 the maximum value of J3, 1 is ……
9 4
(a) (b)
4 9
3 5
(c) (d)
5 3
Answers
1 - (c) 2 - (b)
(C) Theory Questions :
1. State the properties of Be’zeir curve.
2. Explain the term : Convex hull.
3. Explain : Interpolation and approximation of the set of control points.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. 4.36 Plane and Space Curves
4. State general parametric equation of the Be’zeir curve and obtain the matrix representation of
the Be’zeir cubic curve.
5. Write various properties of the Be’zeir curve.
6. Write the applications of Be’zeir curve.
(D) Numerical Problems :
1. Find the parametric equation of a Be’zeir curve, determine by the control points B0[2 1],
B1[3 5], B2[4 3] and find the position vectors of the points on the curve, corresponding to the
parameter values t = 0.24, 0.85.
2. Find the parametric equation of the Be’zeir curve determined by the control points B0[1 0],
B1[2 5], B2[4 6] and B3[6 2]. Also determine the position vector of a point on the curve, for
which the value of parameter is t = 0.4.
3. Find the parametric equation of the Be’zeir curve, determined by the control points B1[−1 2],
B1[2 4] and B2[4 1]. Also find the point on the curve corresponding to the parameter value
t = 0.75.
4. Find the parametric equation of a Be’zeir curve, determined by a Be’zeir polygon B0[−1 −1],
B1[2 3], B2[3 3], B3[5 2]. Also find P(0.6).
5. Find the parametric equation of the Be’zeir curve with control points B0[−2 1], B1[1 3],
B2[6 −1]. Also find the point corresponding to t = 0.357.
6. Find the parametric equation of a Be’zeir equation of a Be’zeir curve determined by control
points B0[0 2], B1[2 3] and B2[2 0]. Also find position vectors of points on the curve
corresponding to parameter value t = 0.2, 0.4, 0.6.
Answers
2 2
1. P(t) = (1 − t) [2 1] + 2t(1 − t) [3 5] + t [4 3]
[P(0.24)] = [2.48 2.5744]
[P(0.85)] = [3.07 2.415]
3 2 2 3
2. P(t) = (1 − t) [1 0] + 3t (1 − t) [2 5] + 3t (1 − t) [4 6] + t [6 2]
[P(0.4)] = [2.616 4.016]
2 2
3. P(t) = (1 − t) B0 + 2(1 − t) t B1 + t B2
P(0.75) = [2.9375 2.1875]
3 2 2 3
4. P(t) = (1 − t) B0 + 3(1 − t) tB1 + 3(1 − t) t B2 + t B3,
P(0.6) = [2.3177 1.6726]
2 2
5. P(t) = (1 − t) B0 + 2(1 − t) (t) B1 + t B2,
P(0.357) = [0.3968 1.6633]
3 2 2 3
6. P(t) = (1 − t) B0 + 3(1 − t) t B1 + 3(1 − t) t B2 + t B3,
P(0.2) = [1.072 2.368], P(0.4) = [1.856 2.305]
P(0.6) = [2.305 1.856]
✍✍✍
APPENDIX
PRACTICAL NO. 1 : PLANE CURVE
2 2
1. Find the equi-spaced points on the circle x + y = 9. C (0, 0), r = 3, n = 10.
θmax − θmin 360 − 0
Solution : δθ = = = 36°
n 10
2 2
(x − 2) (y − 1)
3. Find equally spaced 8 points on ellipse + = 1.
4 9
2 2
(x − 2) (y − 1)
Solution : + =1 … (1)
4 9
Let X = x − 2 and Y = y − 1
2 2
X Y
+ =1 … (2)
4 9
To generate 8 equispaced points on ellipse a = 2, b = 3, n = 8.
360
δθ = = 45°
8
cos δθ b
a
sin δθ 0.7071 1.0606
T = a = − 0.4714
0.7071
− b sin δθ cos δθ
[x0 y0] = [2, 0]
[xi+1 yi+1] = [xi yi] [T]
[x1 y1] = [1.4142 2.2121]
[x2 y2] = [− 0.0428 3.0640]
[x3 y3] = [− 1.4746 2.1211]
[x4 y4] = [− 2.0425 − 0.0641]
[x5 y5] = [− 1.4140 − 2.2116]
[x6 y6] = [0.0427 − 3.0635]
[x7 y7] = [1.4174 − 2.1209]
Translate in x and y direction by 2 and 1.
1 0 0
T1 = 0 1 0
2 1 1
1.4142
2 0 1
2.2121 1
− 0.0428 3.0640 1
=
− 1.4746 2.1211 1
−− 2.0425 − 0.0641 1
0.0427
1.4140 − 2.2116 1
− 3.0635 1
1.4174 − 2.1209 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.3 Appendix
X' = X [T]
1.4142
2 0 1
2.2121 1
− 0.0428 3.0640 1
− 1.4746 1 1
0 0
2.1211
= 0 1 0
−− 2.0425 − 0.0641 1
2 1 1
0.0427
1.4140 − 2.2116 1
− 3.0635 1
1.4174 − 2.1209 1
3.4142 1
4 1 1
3.2121
1.9572 4.064 1
=
0.5254 3.1211 1
− 0.586
0.0425 0.9359 1
2.0427
− 1.2116 1
− 2.0635 1
3.4174 − 1.1209 1
4. Generate equispace 6 points on the parabolic segment in the first quadrant for 2 ≤ y ≤ 10 on
2
parabola y = 4x.
2
Solution : y = 4x
a = 1
ymax = 10, ymin = 2, n=5
ymin ymax
θmin = = 1, θmax = =5
2a 2a
θmax − θmin 5 − 1
δθ = = =1
n−1 4
[x0 y0] = [1 2]
2
[xi+1 yi+1] = [xi + yi δθ + aδθ yi + 2δθ]
= [xi + yi + 1 yi+2]
[x1 y1] = [4 4]
[x2 y2] = [9 6]
[x3 y3] = [16 8]
[x4 y4] = [25 10]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.4 Appendix
st 2
5. Generate 5 equispace points on the parabolic arc in 1 quadrant 2 ≤ x ≤ 16, y = 8x, a = 2,
xmax = 16, xmin = 2, n = 5.
xmin 2
Solution : θmin = = =1
a 2
xmax 16
θmax = = = 2.8284
a 2
θmax − θmin 2.8284 − 1
δθ = = = 0.4571
n−1 4
[x0 y0] = [aθmin 2aθmin]
= [2 4]
3
[xi+1 yi+1] = [xi + yi δθ + a δθ yi + 2a δθ]
= [xi + y1x 0.4571 + 0.4178 yi + 1.8284]
[x1 y1] = [4.2462 5.8284]
[x2 y2] = [7.3281 7.6568]
[x3 y3] = [11.2451 9.4852]
[x4 y4] = [15.999 11.3136]
6. Generate uniformly spaced 5 points on hyperbola arc in the first quadrant for 6 ≤ x ≤ 12,
2 2
x y
− = 1.
9 4
Solution : a = 3, b = 2, xmin = 6, xmax = 12, n = 5.
θmin = sinh−1
xmin = sinh−1 (2) = 1.4436
2
θmax = sinh−1
xmax = sinh−1 (4) = 2.0947
a
θmax − θmin 2.0947 − 1.4436
δθ = = = 0.1627
n−1 4
cosh δθ b
a
sinh δθ
T = a
b sinh δθ cosh δθ
1.0132 0.1089
=
0.2451 0.0132
[xi+1 yi+1] = [xi yi] [T]
[x0 y0] = [6.7079 3.9998]
[x1 y1] = [7.7759 4.7830]
[x2 y2] = [9.0508 5.69291]
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.5 Appendix
1. Develop the concatenated matrix for the given sequence of transformation and apply the
combined transformation matrix. On the line segment between the points A [1 2], B [3, 0].
Solution : (a) (i) Reflection through line X = Y.
(ii) Scaling in X-co-ordinate by factor 1/3.
(iii) Shearing in X-direction by 2-units.
T = T1 ⋅ T2 ⋅ T3
0 1 0
1/3 0 0
1 0 0
= 1 0 0 0 1 0 2 1 0
0 0 1 0 0 1 0 0 1
0 1 0
1 0 0
2 1 0
= 1/3 0 0 2 1 0 = 1/3 0 0
0 0 1 0 0 1 0 0 1
(b) (i) Shearing in X-direction by 2 units.
(ii) Reflection through X-axis.
(iii) Rotation about origin through 270°.
T = T1 ⋅ T2 ⋅ T3
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.6 Appendix
1 0 0
1 0 0
0 −1 0
= 2 1 0 0 −1 0 1 0 0
0 0 1 0 0 1 0 0 1
1 0 0
0 −1 0
= 2 −1 0 1 0 0
0 0 1 0 0 1
0 −1 0
= −1 −2 0
0 0 1
X' = XT
1 2 1 0 −1 0
=
3 0 1 −1 −2 0
0 0 1
−2 −3 1
X' =
0 −3 1
2. Apply the following transformations on the point P [3 − 1] sequentially and obtain the final
transformed point.
X = [3 − 1 1]
Solution : (i) Rotation about the origin through 50°.
0.6427 0.766 0
[T1] = − 0.766 0.642 0
0 0 1
1 0 0
[T2] = 0 1 0
2 3 1
1 2.1 0
[T3] = 0 1 0
0 0 1
1 0 0
1 0 0
1 0 0
= 0 1 0 0 −1 0 0 1 0
0 −3 1 0 0 1 0 3 1
1 0 0
1 0 0
= 0 −1 0 0 1 0
0 3 1 0 3 1
1 0 0
[T] = 0 −1 0
0 6 1
4. Reflect ∆ ABC through the line x =− 2, where A [2, − 4], B [3 1], C [− 2 1].
A 2 −4 1
X = B = 3 1 1
C −2 1 1
Solution : Step 1 : Translate in X-direction by 2 units.
−1 0 0
[T1] = 0 1 0
0 0 1
Step 2 : Translate in X-direction by − 2 units.
1 0 0
[T3] = 0 1 0
−2 0 1
[T] = T1 ⋅ T2 ⋅ T3
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.8 Appendix
1 0 0
−1 0 0
1 0 0
= 0 1 0 0 1 0 0 1 0
2 0 1 0 0 1 −2 0 1
−1 0 0
= 0 1 0
4 0 1
X' = X [T]
2 −4 1
−1 0 0
= 3 1 1 0 1 0
−2 1 1 −4 0 1
−6 −4 1
= −7 1 1
−2 1 1
y =
1 x + 2
2
1
m = , k=2
2
m = tan θ
θ = tan−1
1 = 26.565
2
Step 1 : Translate the point in Y-direction by − 2 units.
1 0 0
[T1] = 0 1 0
0 −2 1
Step 2 : Rotate the result about origin through
∠ − θ = − 26.565
0.894 − 0.447 0
[T2] = 0.447 0.897 0
0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.9 Appendix
1 0 0
[T3] = 0 −1 0
0 0 1
Step 4 : Apply inverse rotation.
0.894 0.447 0
[T4] = − 0.447 0.894 0
0 0 1
Step 5 : Inverse translation
1 0 0
[T5] = 0 1 0
0 2 1
Step 6 : T = T1 ⋅ T2 ⋅ T3 ⋅ T4 ⋅ T5
0.599 0.799 0
= 0.799 − 0.599 0
− 1.599 3.199 1
Step 7 : X' = X T
2 −4 1
0.599 0.799 0
= 3 1 1 0.799 − 0.599 0
−2 1 1 − 1.599 3.199 1
− 3.597 7.193 1
X' = 0.997 4.997 1
− 1.998 1.002 1
6. (i) If the line seg AB is reflected through the line y − x = 6, find transformed object.
Solution : Given : L : y − x = 6, y = 6 + x.
Comparing with y = mx + k
m = 1, k = 6.
Step 1 : Translate in y-direction by − 6 units.
1 0 0
T1 = 0 1 0
0 −6 1
Step 2 : Rotate the line about origin through < − θ, where m = tan θ.
θ = tan−1 (m) = 45°
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.10 Appendix
cos θ = 0.7071
0.707 − 0.707 0
T2 = 0.707 0.707 0
0 0 1
Step 3 : Reflect through x-axis,
1 0 0
T3 = 0 −1 0
0 0 1
Step 4 : Rotate about origin through < θ.
0.707 0.707 0
T4 = − 0.707 0.707 0
0 0 1
Step 5 : Translate in y-direction by 6 – units.
1 0 0
T5 = 0 1 0
0 6 1
Step 6 : T = T1 ⋅ T2 ⋅ T3 ⋅ T4 ⋅ T5 ⋅ T6
0 0.998 0
= 0.999 0 0
− 5.998 6 1
X' = X [T]
2 −4 1
0 0.999 0
= 3 1 1 0.999 0 0
−2 1 1 − 5.998 6 1
− 9.994 7.998 1
= − 4.999 8.997 1
4.999 4.002 1
6. (ii) An object is rotated about the point P [4 3] through ∠ 30°. Find the concatenated matrix.
Solution : Step 1 : Translate in x and y-direction by − a, − b units.
Step 2 : Rotate about origin through ∠ θ.
Step 3 : Translate in x and y-direction by a, b units.
Step 4 : T = T1 T2 T3 T4
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.11 Appendix
1 0 0 0.866 0.5 0 1 0 0
T =
0 1 0 − 0.5 0.866 0 0 1 0
4 −3 1 0 0 1 4 3 1
0.866 0.5 0
= − 0.5 0.866 0
2.036 − 1.598 1
6. (iii) ∆ ABC is rotated through ∠ 45° about the point [− 1 − 2], find the transformed object.
A [0 0], B [3 1], C [0 1].
Solution : Step 1 : Translate in y-direction by − a, − b units.
1 0 0
T1 = 0 1 0
1 2 1
Step 2 : Rotate through ∠ θ.
0.707 0.707 0
T2 = − 0.707 0.707 0
0 0 1
Step 3 : Inverse translation
1 0 0
0
−1
T1 = 1 0
−1 −2 1
Step 4 : T = T1 ⋅ T2 ⋅ T3
1 0 0 0.707 0.707 0 1 0 0
=
0 1 0 − 0.707 0.707 0 0 1 0
1 2 1 0 0 1 −2 −2 1
0.707 0.707 0
= − 0.707 0.707 0
− 1.707 -0.121 1
0 0 1
0.707 0.707 0
Step 5 : X' = X T = 3 1 1 − 0.707 0.707 0
0 1 1 − 1.707 −0.121 1
− 1.707 0.121 1
= − 0.293 2.449 1
− 2.414 0.828 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.12 Appendix
7. Reflect the square with vertices O[0 0], A[3 0], B[3 3], C[0 3] through the line
3x − 2y − 4 = 0
Answer : O
* 24 − 16 , A* 9 20 , B* 45 35 , C* 60 − 1
13 13 13 13 13 13 13 13
PRACTICAL NO. 3 : 3-D TRANSFORMATIONS
1. Find the concatenated transformation matrix for the following sequence of transformation :
2 0 0 0
T1 =
0 1 0 0
0 0 3 0
0 0 0 1
cos θ 0 − sin θ 0
T2 =
0 1 0 0
sin θ 0 cos θ 0
0 0 0 1
0.8660 0 − 0.5 0
=
0 1 0 0
0.5 0 0.8660 0
0 0 0 1
1 0 0 0
T3 =
0 −1 0 0
0 0 1 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.13 Appendix
T = T1 ⋅ T2 ⋅ T3
2 0 0 0
0.8660 0 − 0.5 0
1 0 0 0
=
0 1 0 0 0 1 0 0 0 −1 0 0
0 0 3 0 0.5 0 0.8660 0 0 0 1 0
0 0 0 1 0 0 0 1 0 0 0 1
1.732 0 −1 0
1 0 0 0
=
0 1 0 0 0 −1 0 0
1.5 0 2.598 0 0 0 1 0
0 0 0 1 0 0 0 1
1.732 0 −1 0
=
0 −1 0 0
1.5 0 2.598 0
0 0 0 1
1
(b) (i) Overall scaling by units.
2
1 0 0 0
T1 =
0 1 0 0
0 0 1 0
0 0 0 1/2
1 0.4 0 0
T2 =
0 1 0 0
2.3 0 1 0
0 0 0 1
cos 45 sin 45 0 0
0.7071 0.7071 0 0
T3 =
− sin 45 cos 45 0 0
=
− 0.7071 0.7071 0 0
0 0 1 0 0 0 1 0
0 0 0 1 0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.14 Appendix
1 0 0
0
1 0.4 0 0
0.7071 0.7071 0 0
=
0 1 0 0 0 1 0 0 − 0.7071 0.7071 0 0
0 0 1 0 2.3 0 1 0 0 0 1 0
0 0 0 0.5 0 0 0 1 0 0 0 1
1 0.4 0 0
0.7071 0.7071 0 0
=
0 1 0 0 − 0.7071 0.7071 0 0
2.3 0 1 0 0 0 1 0
0 0 0 0.5 0 0 0 1
0.4243 0.9898 0 0
=
− 0.7071 0.7071 0 0
1.626 1.626 1 0
0 0 0 0.5
2. Rotate line segment AB about local X-axis passing through the point P [1 3 4] through 65°,
where A [1 − 1 1], B [2 3 1].
A 1 −1 1 1
Solution : X =
B 2 3 1 1
Step 1 : Translate in X, Y, Z direction by − a, − b, − c units respectively.
1 0 0 0
T1 =
0 1 0 0
0 0 1 0
−1 −3 −4 1
Step 2 : Rotation about X-axis through ∠ 65°.
0 0 0 0
T2 =
0 cos θ sin θ 0
0 − sin θ cos θ 0
0 0 0 1
1 0 0 0
=
0 0.4226 0.9063 0
0 − 0.9063 0.4226 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.15 Appendix
1 0 0 0
T3 =
0 1 0 0
0 0 1 0
1 3 4 1
Step 4 : The concatenated matrix is,
T = T1 ⋅ T2 ⋅ T3
1 0 0 0
1 0 0 0
1 0 0 0
T =
0 1 0 0 0 0.4226 0.9063 0 0 1 0 0
0 0 1 0 0 − 0.9063 0.4226 0 0 0 1 0
−1 −3 −4 1 0 0 0 1 1 3 4 1
1 0 0 0
1 0 0 0
=
0 0.4226 0 0.9063 0 1 0 0
−0 0.9063 0.4226 0 0 0 1 0
−1 2.3574 − 4.4093 1 1 3 4 1
1 0 0 0
=
0 0.4226 0.9063 0
0 − 0.9063 0.4226 0
0 5.3574 − 0.4093 1
1 0 0 0
1 −1 1 1
=
0 0.4226 0.9063 0
2 3 1 1 0 − 0.9063 0.4226 0
−0 5.3574 − 0.4093 1
1 4.0285 − 0.893 1
=
2 5.7189 2.7322 1
3. Rotate the line seg AB given above, about local Z-axis passing through the point P [− 2 3 − 1]
through θ = 90°.
Solution : P [a b c] = [− 2 3 − 1]
θ = 90°
1 −1 1 1
X =
2 3 1 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.16 Appendix
1 0 0 0
T1 =
0 1 0 0
0 0 1 0
2 −3 1 1
Step 2 : Rotate about Z-axis through θ = 90°.
0 1 0 0
=
−1 0 0 0
0 0 1 0
0 0 0 1
Step 3 : Inverse translation.
1 0 0 0
T3 =
0 1 0 0
0 0 1 0
−2 3 −1 1
Step 4 : T = T1 ⋅ T2 ⋅ T3
1 0 0 0
0 1 0 0
1 0 0 0
=
0 1 0 0 −1 0 0 0 0 1 0 0
0 0 1 0 0 0 1 0 0 0 1 0
2 −3 1 1 0 0 0 1 −2 3 −1 1
0 1 0 0
1 0 0 0
=
−1 0 0 0 0 1 0 0
0 0 1 0 0 0 1 0
3 2 1 1 −2 3 −1 1
0 1 0 0
=
−1 0 0 0
0 0 1 0
1 5 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.17 Appendix
0 1 0 0
Step 5 :
1 −1 1 1
X' = X [T] =
−1 0 0 0
2 3 1 1 0 0 1 0
1 5 0 1
2 6 1 1
X' =
−2 7 1 1
4. Reflect the object X through the line X = 3.
Solution : Step 1 : Translate in X-direction by – 3 units.
1 0 0 0
T1 =
0 1 0 0
0 0 1 0
−3 0 0 1
Step 2 : Reflection through the plane x = 0.
−1 0 0 0
T2 =
0 1 0 0
0 0 1 0
0 0 0 1
Step 3 : Inverse-translation.
1 0 0 0
T3 =
0 1 0 0
0 0 1 0
3 0 0 1
−1 0 0 0
Step 4 : T = T1 ⋅ T2 ⋅ T3 =
0 1 0 0
0 0 1 0
0 0 0 1
1 0 0 0
[T1] =
0 1 0 0
0 0 1 0
0 2 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.18 Appendix
1 0 0 0
[T2] =
0 −1 0 0
0 0 1 0
0 0 0 1
Step 3 : Inverse translation.
1 0 0 0
[T3] =
0 1 0 0
0 0 1 0
0 −2 0 1
Step 4 : T = T1 ⋅ T2 ⋅ T3
1 0 0 0
1 0 0 0
1 0 0 0
=
0 1 0 0 0 −1 0 0 0 1 0 0
0 0 1 0 0 0 1 0 0 0 1 0
0 2 0 1 0 0 0 1 0 −2 0 1
1 0 0 0
1 0 0 0
=
0 −1 0 0 0 1 0 0
0 0 1 0 0 0 1 0
0 −2 0 1 0 −2 0 1
1 0 0 0
=
0 −1 0 0
0 0 1 0
0 −4 0 1
6. Rotate the object X about a line passing through P (1, − 1, 2) having d.r.s. 1, 1, 1 passing
through the ∠ 45°.
Solution : Step 1 : Translate in X, Y, Z direction by − 1, 1, − 2 units.
1 0 0 0
[T1] =
0 1 0 0
0 0 1 0
−1 1 −2 1
Step 2 : The d.r.s. of the axis of rotation are a, b, c : 1, 1, 1.
a, b, c 1 1 1
CX, Cy, Cz = 2 2 2 = , ,
a +b +c 3 3 3
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.19 Appendix
2 2 1 1 2
d = Cy + Cz = + =
3 3 3
Let α be the angle of rotation about X-axis.
Cz 1/ 3 1
cos α = = =
d 2/3 2
Cy 1
sin α = =
d 2
1 0 0 0
T2 =
0 cos α sin α 0
0 − sin α cos α 0
0 0 0 1
1 0 0 0
=
0 0.7071 0.7071 0
0 − 0.7071 0.7071 0
0 0 0 1
Step 4 : Rotate the object about Y-axis through ∠ − β.
2 1
cos β = d = , sin β = Cx =
3 3
cos β 0 sin β 0
[T3] =
0 1 0 0
− sin β 0 cos β 0
0 0 0 1
0.816 0 0.577 0
=
0 1 0 0
− 0.577 0 0.816 0
0 0 0 1
Step 5 : Rotate about Z-axis through ∠ 45°.
cos β 0 − sin β 0
[T5] =
0 1 0 0
sin β 0 cos β 0
0 0 0 1
0.816 0 − 0.577 0
=
0 1 0 0
0.577 0 0.816 0
0 0 0 1
Step 7 : Inverse translation about X-axis i.e. Rotate about X-axis through ∠ α.
1 0 0 0
[T6] =
0 0.7071 − 0.7071 0
0 0.7071 0.7071 0
0 0 0 1
Step 8 : Inverse translation.
1 0 0 0
[T7] =
0 1 0 0
0 0 1 0
1 −1 2 1
Step 9 : The concatenated matrix is
[T] = [T1] [T2] [T3] [T4] [T5] [T6] [T7]
1 0 0 0
1 0 0 0
=
0 1 0 0 0 0.7071 0.7071 0
0 0 1 0 0 − 0.7071 0.7071 0
−1 1 −2 1 0 0 0 1
0.816 0 − 0.577 0
0 1 0 0
0.577 0 0.816 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.21 Appendix
1 0 0 0
1 0 0 0
0 0.7071 − 0.7071 0 0 1 0 0
0 0.7071 0.7071 0 0 0 1 0
0 0 0 1 1 −2 2 1
1 0 0 0
0.5769 0.5769 0.577 0
=
0 0.7071 0.7071 0 − 0.7071 0.7071 0 0
0 − 0.7071 0.7071 0 − 0.4079 − 0.4079 0.816 0
−1 2.1213 − 0.7071 1 0 0 0 1
–– –– i j k
AB × AC = − 0.5 0.5 0
0 0.5 − 0.5
= (− 0.25) i − (0.25) j + (− 0.25) k
d.r.s. of normal to the face ABC are
a = − 0.25, b = 0.25, c = − 0.25
1 1 1
Cx = , Cy = , Cz =
3 3 3
We consider normal to the plane passing through point A [3 1.5 2].
Step 1 : Translate in X, Y, Z direction by − 3, − 1.5, − 2 units respectively.
1 0 0 0
[T1] =
0 1 0 0
0 0 1 0
−3 − 1.5 −2 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.22 Appendix
2 2 2
a = Cy + Cz = = 0.816
3
Cz 1
cos α = = = 0.707
d 2
Cy
sin α = = 0.707
d
1 0 0 0
[T2] =
0 0.707 0.707 0
0 − 0.707 0.707 0
0 0 0 1
Step 3 : Rotate about Y-axis through ∠ − β.
cos β = d = 0.816, sin β = 0.577
0.816 0 0.577 0
[T3] =
0 1 0 0
− 0.577 0 0.816 0
0 0 0 1
Step 4 : Reflect through plane Z = 0.
1 0 0 0
[T4] =
0 1 0 0
0 0 −1 0
0 0 0 1
Step 5 : Inverse rotation about Y-axis through ∠ β.
0.816 0 − 0.577 0
[T5] =
0 1 0 0
0.577 0 0.816 0
0 0 0 1
Step 6 : Inverse rotation about X-axis through ∠ − α.
1 0 0 0
[T6] =
0 0.7071 − 0.7071 0
0 0.7071 0.7071 0
0 0 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.23 Appendix
1 0 0 0
[T7] =
0 1 0 0
0 0 1 0
3 1.5 2 1
Step 8 : T = [T1] [T2] [T3] [T4] [T5] [T6] [T7]
8. Perform the perspective projection onto the Z = 0 plane of the unit cube (vertices given
below) from the centre of projection at Zc = 8 on Z-axis.
1 0 1 1
0 0 1 1
10 11 11 11
[x] =
0 0 0 1
11 01 00 11
0 1 0 1
0 0 0 0.875 0 0 0 1
1 0 0 0.875 1.142 0 0 1
10 11 00 0.875 1.142 1.42 0 1
Answer :
1
=
0.875 0 1.42 0 1
0 0 0 0 0 0 1
11 01 00 11 11 0 0 1
0 1 0 1 0 1
1
0
0
1
1
PRACTICAL NO. 4 : PROJECTION
0
0 0 1
1 1
1 0 1
X =
1 1 1
00 0 2
1
1 2
0 2
1 1 2
Solution : (i) Concatenated transformation matrix
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.24 Appendix
1 0 0 0
T =
0 cos 90° sin 90° 0
0 − sin 90° cos 90° 0
0 0 0 1
1 0 0 0
1 0 0 0
1 0 0 0
T =
0 0 0 0 0 1 0 0
=
0 0 0 0
0 −1 0 0 0 0 0 0 0 −1 0 0
0 0 0 1 0 0 0 1 0 0 0 1
0
0 0 1 1
1 1 1
1 0 1 1
1 0 0 0
=
1 1 1 1 0 0 0 0
00 0 2 1
0
0
−1 0 0
1
1
1 2 1 0 0
0 2 1
1 1 2 1
0
0 −1 0 1
−1 0 1
1 −1 0 1
[X'] =
1 −1 0 1
00 −2 0 1
1
−2 0 1
−2 0 1
1 −2 0 1
(ii) Right view : T = [RY] (θ = 90°) ⋅ PZ
0 0 1 0
1 0 0 0
0 0 1 0
=
0 1 0 0 0 1 0 0 0
=
1 0 0
−1 0 0 0 0 0 0 0 −1 0 0 0
0 0 0 1 0 0 0 1 0 0 0 1
[X] = [X] [T]
0 1 1 1
0 0 1 1
1 0 1 1
1 1 1 1 00 0 1 0
= 1 0 2 1
1 0 0
−1 0 0 0
0 1 2 1 0
0 0 2 1
0 0 1
1 0 2 1
1 1 2 1
−1 1 0 1
−1 0 0 1
−1 0 1 1
=
−1 1 1 1
−− 22 01 00 11
−2 0 1 1
−2 1 1 1
2. Develop transformation matrix for trimetric projection obtained by rotation about Y-axis
through ∠ φ = 15° followed by rotation about X-axis through ∠ θ = 30° and the orthographic
projection on the plane z = 0. Apply it on the object X.
1
0 0 1 1
0.5 0.5
1
0
0
1
1
[X] =
0.5 0.5 1 1
0 1 0.5 1
1 0.5 0.5 1
Solution : φ = 15° and θ = 30°
sin φ = 0.258, sin θ = 0.5
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.26 Appendix
0.965 0.129 0 0
=
0 0.866 0 0
0.258 − 0.482 0 0
0 0 0 1
[X'] = [X] [T]
1 0.5 0 1 0.965
0 0 1 1
0.5 1 0 1 0 0.129 0 0
=
0.866 0 0
0.5 0.5 1 1 0.258 − 0.482 0 0
0 1 0.5 1 0 0 0 1
1 0.5 0.5 1
0.965 0.562 0 1
0.258 − 0.482 0 1
0.4825 0.9305 0 1
=
0.7405 0.0155 0 1
0.129 0.625 0 1
1.094 0.321 0 1
3. Obtain the diametric projection, if principle foreshortening factor 2 direction is 2/5 (Take θ >
0, φ > 0).
Solution : fZ = 2/5
fZ = 16.42°
φ = sin−1
2
fZ = 12.95°
θ = sin−1 2
2 − f Z
Now, let θ > 0, φ > 0.
0.7071 0.4081 0 0
[T] =
0 0.8165 0 0
0.7071 − 0.4081 0 0
0 0 0 1
X' = X [T]
0.7071 0.4081 0 0
1 −2 1 1
=
0 0.8165 0 0
3 1 1 1 0.7071 0.4081 0 0
0 0 0 1
1.4142 − 1.633 0 1
X' =
2.8284 1.6327 0 1
5. Determine the cavalier and cabinet projection for horizontal inclination angle α = 120° of
object X.
1 2 2 1
[X] =
0 1 2 1
Solution : α = 120°
cos α = − 0.5 and sin α = 0.8660
(i) For cavalier project : f = 1.
1 0 0 0
T =
0 1 0 0
− f cos α − f sin α 0 0
0 0 0 1
1 0 0 0
1 2 2 1 0 1 0 0
X' = XT =
0 1 2 1 0.5 − 0.8660 0 0
0 0 0 1
2 0.268 0 1
X' =
1 − 0.732 0 1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.28 Appendix
1 0 0 0
0 0 0 0
T =
0 1 0 0 0 1 0 0
− f cos α − f sin α 0 0 0.25 − 0.4330 0 0
0 0 0 1 0 0 0 1
X' = XT
1.5 1.134 0 1
=
0.5 0.134 0 1
6. Write transformation matrix for perspective projection from centre of projection Z [0, 50, 0] on
to the plane y = 0.
Solution : We know Z (0, 50, 0).
∴ b = 50
∴ Transformation matrix of perspective projection is,
1 0 0 0
1 0 0 0
1 0 0 0
T =
0 0 0 − 1/b
=
0 0 0 − 1/50
=
0 0 0 − 0.02
0 0 1 0 0 0 1 0 0 0 1 0
0 0 0 1 0 0 0 1 0 0 0 1
PRACTICAL NO. 5 : BEZIER CURVES
Non-negativity : J3, k ≥ 0 ∀k = 0, 1, 2, 3.
k
Maximum property : Maximum value of J3, k (t) occurs at t = for all k = 0, 1, 2, 3.
3
Symmetry : For all k = 0, 1, 2, 3, J3, k (1 − t) = J3, k (t).
Linear sum property : If x0, x1, x2, x3 are in arithmetic progression then
x0 J3, 0 + x1 J3, 1 + x2 J3, 2 + x3 J3, 3 = x0 + t(x3 − x0) for all t ∈ [0, 1].
Basis : J3, 0; J3, 1; J3, 2; J3, 3 forms basis for a vector space of all polynomials of degree atmost 3.
y J3,1 J3,2
1
J3,3
J3,0
x
0 1 1 2
3 2 3
Fig. A.1
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.30 Appendix
We can write as
3 2 3 T
P(t) = [(1 − t) 3t(1 − t) 3t(1 − t) t ] [P(0) P(1) P(2) P(3)] That is
−1 3 −3 1
P(0)
P(t) = [t
3 2
t t 1]
3 −6 3 0 P(1)
−3 3 0 0 P(2)
1 0 0 0 P(3)
4. Find the co-ordinate functions of Bezier curve with the control points (1, 1), (2, 3), (4, 3), (3, 1).
Also sketch the Bezier curve.
Solution : Let p(t) = (x(t), y(t)) be the Bezier curve with given control points.
3 2 2 3
Hence x(t) = (1) (1 − t) + 3(2) (1 − t) t + 3(4) (1 − t) t + (3) t
3 2 2 3
y(t) = (1) (1 − t) + 3(3) (1 − t) + 3(3) (1 − t) t + (1) t
y
5
4
3
2
1
x
-6 -5 -4 -3 -2 -1 1 2 3 4 5 6
-1
-2
-3
-4
-5
Fig. A.2
5. Plot the Bezier loop controlled by the points (1, 1), (2, 3), (4, 3), (1, 1).
where, s = 1 − t.
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.31 Appendix
4
3
2
1
x
-4 -3 -2 -1 1 2 3 4
-1
-2
-3
-4
Fig. A.3
6. The points B0[1 1], B1[2 3], B2[4 3], B3[3 1] are the vertices of a Be’zier curve. Find seven
points on the curve.
Answer : P0 = B0 = [1 1]
P(0.15) = [1.5 1.765]
P(0.35) = [2.248 2.367]
P(0.5) = [2.75 2.5]
P(0.65) = [3.122 2.367]
P(0.85) = [3.248 1.765]
P(1) = [3 1]
for(i=0;i<n;i++)
{
printf("\n Enter p(z[%d],y[%d])",i+1,i+1);
scanf("%f%f",&x[i],&y[i]);
}
d=((x[0]-x[1]) *( x[0] - x[1])) + ((y[0]-y[1]) *( y[0]-y[1]));
max=d;
//pos1=0;
//pos2=0;
for(i=0;i<(n-1);i++)
{
for(j=i+1;j<n;j++)
{
d=((x[i]-x[j])*(x[i]-x[j]))+((y[i]-y[j])*(y[i]-y[j]));
if(d>max)
{
max=d;
pos1=i;
pos2=j;
}
}
}
printf("\n The points which are almost mutual distance are p[%d],p[%d]\n",pos1+1,pos2+1);
printf("\n Maximum distance %f \n",sqrt(max));
}
Output :
/*
Enter the no. of points
5
Enter the co-ordinate points
Enter p(z[1],y[1])1
1
Enter p(z[2],y[2])2
2
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.33 Appendix
Enter p(z[3],y[3])3
3
Enter p(z[4],y[4])4
4
Enter p(z[5],y[5])5
5
The points which are almost mutual distance are p[1],p[5]
Maximum distance 5.656854
*/
PROGRAM 2:/*To find minimum distance between the points*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void main()
{
int n,i,j,pos1=0,pos2=0;
float x[20],y[20],min,d;
printf("\n Enter the no. of points \n");
scanf("%d",&n);
printf("\n Enter the co-ordinate points \n");
for(i=0;i<n;i++)
{
printf("\n Enter p(z[%d],y[%d])",i+1,i+1);
scanf("%f%f",&x[i],&y[i]);
}
d=((x[0]-x[1])*(x[0]-x[1]))+((y[0]-y[1])*(y[0]-y[1]));
min=d;
//pos1=0;
//pos2=0;
for(i=0;i<(n-1);i++)
{
for(j=i+1;j<n;j++)
{
d=((x[i]-x[j])*(x[i]-x[j]))+((y[i]-y[j])*(y[i]-y[j]));
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.34 Appendix
if(d<min)
{
min=d;
pos1=i;
pos2=j;
}
}
}
printf("\n The points which are almost mutual distance are p[%d],p[%d]\n",pos1+1,pos2+1);
printf("\n Minimum distance %f \n",sqrt(min));
}
Output :
/*
Enter the no. of points
5
Enter the co-ordinate points
Enter p(z[1],y[1])1
0
Enter p(z[2],y[2])2
0
Enter p(z[3],y[3])3
3
Enter p(z[4],y[4])4
4
Enter p(z[5],y[5])5
5
The points which are almost mutual distance are p[1],p[1]
Minimum distance 1.000000
*/
PROGRAM 3:/* Program to sort point with respect to rectangle */
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.35 Appendix
{
//clrscr();
int i,n;
float vx[4],vy[4],xmin,xmax,ymin,ymax,vmin,vmax,x[20],y[20];
printf("Enter the vertices of rectangle");
for(i=0;i<4;i++)
{
printf("\n p[%d]",i+1);
scanf("%f%f",&vx[i],&vy[i]);
}
xmin=vx[0];xmax=vx[0];
for(i=1;i<4;i++)
{
if(vx[i]<vmin)
{xmin=vx[i];
}
if(vx[i]>xmax)
xmax=vx[i];
}
ymin=vy[0];ymax=vy[0];
for(i=1;i<4;i++)
{if(vy[i]<ymin)
ymin=vy[i];
if(vy[i]>ymax)
ymax=vy[i];
}
printf("\n Enter the no. of points to be sorted\n");
scanf("%d",&n);
printf("\n Enter the co-ordinate of points \n");
for(i=0;i<n;i++)
{
printf("\n p[%d]",i+1);
scanf("%f%f",&x[i],&y[i]);
}
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.36 Appendix
for(i=0;i<n;i++)
{
if(x[i]>xmin && x[i]<xmax && y[i]>ymin && y[i]<ymax)
printf("\n p[%d],points inside the rectangle",i+1);
else
printf("\n p[%d],points is on the boundary of the rectangle",i+1);
}
}
Output :
/*
2
p[3]3
3
p[4]4
4
Enter the no. of points to be sorted
3
Enter the co-ordinate of points
p[1]1
0
p[2]3
6
p[3]7
8
p[1],points is on the boundary of the rectangle
p[2],points is on the boundary of the rectangle
p[3],points is on the boundary of the rectangle
*/
PROGRAM 4:/* Program to sort points with respect to polygon*/
#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
int i,n,flag=0;
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.37 Appendix
float a,b,x[20],y[20],d,di;
printf("\n Enter the number of vertices of polygon:\n");
scanf("%d",&n);
printf("\n Enter the co-ordinates of vertices of the polygon :");
for(i=0;i<n;i++)
{
printf("\np[%d]",i+1);
scanf("%f%f",&x[i],&y[i]);
}
printf("\n Enter the coordinate of Z:\n");
scanf("%f%f",&a,&b);
x[n]=x[0];
y[n]=y[0];
d=((x[1]-x[0])*(b-y[0])-(y[1]-y[0])*(a-x[i]));
for(i=0;i<n;i++)
{
di=((x[i+1]-x[0])*(b-y[i])-(y[i+1]-y[i])*(a-x[i]));
if(d*di<=0)
{
flag=1;
break;
}
}
if(flag==1)
{
printf("\n \n Point Z lies inside the polygon \n");
}
else
{
printf("\n \n Point Z lies outside the polygon \n");
}
}
Output :
/*
5
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.38 Appendix
if (L>0)
{ printf("P[%d] is on the left of the line \n",i+1);
}
if (L==0)
{ printf("P[%d] is on the line \n",i+1 );
}
}
}
Output
/*
Enter the two points A(a[0],b[0]) and B(a[1],b[1]) on line respectively
1
2
3
4
Enter the number of points to be sorted
5
Enter the points to be sorted
P[6]1
2
P[6] is on the line
*/
PROGRAM 6:/* Program to sort points with respect to cube */
#include<stdio.h>
#include<math.h>
void main()
{
int i,n;
float vx[4],vz[4],vy[4],xmin,xmax,ymin,ymax,zmin,zmax,x[20],y[20],z[20],vmax,vmin;
printf("\n Enter the co-ordinate of vertices of the cube \n");
for(i=0;i<8;i++)
{
printf("\n v[%d]",i+1);
scanf("%f%f%f",&vx[i],&vy[i],&vz[i]);
}
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.40 Appendix
xmin=vx[0];
xmax=vx[0];
for(i=0;i<8;i++)
{
if(vx[i]<vmin)
xmin=vx[i];
if(vx[i]>vmax)
xmax=vx[i];
}
ymin=vy[0];
ymax=vy[0];
for(i=1;i<8;i++)
{
if(vy[i]<ymin)
ymin=vy[i];
if(vy[i]>ymax)
ymax=vy[i];
}
zmin=vz[0];
zmax=vz[0];
for(i=0;i<8;i++)
{
if(vz[i]<zmin)
zmin=vz[i];
if(vz[i]>zmax)
zmax=vz[i];
}
printf("\n Accept the number of points to be sorted");
scanf("%d",&n);
printf("\n Enter the co-ordinate of the points");
for(i=0;i<n;i++)
{
printf("\n p[%d]",i+1);
scanf("%f%f%f",&x[i],&y[i],&z[i]);
}
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.41 Appendix
for(i=0;i<n;i++)
{
if(x[i]>xmin && x[i]<xmax && y[i]>ymin && y[i]<ymax && z[i]>zmin && z[i]<zmax)
printf("\n p[%d] inside",i+1);
else
{
if(x[i]<xmin || x[i]>xmax || y[i]<ymin || y[i]>ymax || z[i]<zmin || z[i]>zmax)
printf("\n p[%d] outside",i+1);
else
printf("\n p[%d] on the boundary");
}
}
}
Output :
/*
8
8
v[7]5
5
7
v[8]8
8
9
Accept the number of points to be sorted
2
Enter the co-ordinate of the points
p[1]2
2
3
p[2]3
4
4
p[1] outside
p[2] outside
*/
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.42 Appendix
for(i=0;i<n;i++)
{
d=(x[0]-x[i])*(x[0]-x[i])+(y[0]-y[i])*(y[0]-y[i]);
if(d<min)
{
min=d;
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.43 Appendix
pos=i;
}
}
temp=x[0]; x[0]=x[i]; x[i]=temp;
temp=y[0];y[0]=y[i];y[i]=temp;
printf("nearest neighbour of p[%d] is p[%d]\n",j+1,pos+1);
}
}
Output :
/*
Enter the number of points to be sorted
4
Enter the points to be sorted
p[1]
1
2
p[2]
3
4
p[3]
5
6
p[4]
7
6
nearest neighbour of p[1] is p[2]
nearest neighbour of p[2] is p[1]
nearest neighbour of p[3] is p[1]
nearest neighbour of p[4] is p[1]
*/
PROGRAM 8:/* to generate the equispaced points in the circle */
#include<stdio.h>
#include<math.h>
#include<graphics.h>
#define pi 3.142
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. A.44 Appendix
void main ()
{
int i, n, gd=DETECT , gm, m1, m2;
float a=500 , b=200, r, x[20], y[20], dt, p, q;
printf("Enter the radius :\n");
scanf("%f",&r);
printf("How many equispaced points on circle you have:\n");
scanf("%d",&n);
dt=2*pi;
p=cos(dt);
q=sin(dt);
x[0]=a;
y[0]=b;
printf("A[0]=[%f%f]\n",x[0],y[0]);
for (i=0;i<n;i++)
{
x[i+1]=p*(x[i])-q*(y[i]);
y[i+1]=q*(x[i])+p*(y[i]);
printf("A[%d]=[%f%f]",i+1,x[i+1],y[i+1]);
}
getch();
initgraph(gd,gm," ");
m1=getmaxx();
m2=getmaxy();
Line(m1/2, 0, m1/2, m2);
Line(0,m/2, m1, m2/2);
for (i=0;i<n;i++)
{
putpixel(x[i]+(m1/2), y[i]+(m2/2));
}
closegraph();
}
✍✍✍
MODEL QUESTION PAPER
Time : 2 Hours Maximum Marks : 35
12 2
3
(iii) What is the effect of the transformation matrix [T] = on a two dimensional
3 1
− 2 2
object ?
(iv) Determine the foreshortening factors fx and fy, if the transformation matrix for
axonometric projection is
0.5
0
0.43
0.86
0
0
0
0
[T] = 0.86 0.25 0 0
3.58 0.75 0 1
(v) Obtain the transformation matrix for a cavalier projection for α = 45°. Apply it on the
point [−2 5 7].
(vi) Write the equation of Be-zier curve with control points B0, B1, B2.
2
(vii) Determine the increment factor δθ to generate 7 points on the parabola y = 20x, for
10 ≤ y ≤ 40 in the first quadrant.
Q.2. Attempt any two of the following : [10 marks]
(i) Find the concatenated transformation matrix and apply it on the triangle having vertices
O[0 0], A[1 2], B[3 −1]. The sequence of transformations is as below :
(a) Rotation about origin through angle 50°.
(b) Shearing in y-directon by − 2.1 units.
(c) Uniform scaling by factor 2.
(M.1)
S.Y.B.Sc. (Comp. Sci.) Comp. Geo. M.2 Model Question Paper
(ii) Reflect the triangle ABC through the line y = −2; where A[2 3], B[0 5], C[2 2].
(iii) If two lines 2x − y = 7 and 3x + y = 3 are transformed under the transformation matrix
[T] =
3 4 , then find the point of intersection of transformed lines.
−1 2
Q.3. Attempt any two of the following : [10 marks]
(i) Find the trimetric projection formed by first rotation about the y-axis through an angle
75°, followed by rotation about x-axis through an angle 20°, followed by orthographic
projection onto the z = 0 plane. Determine principle foreshortening factors.
(ii) Derive the rotation angle φ about the y-axis and rotation angle θ about the x-axis in
diametric projection for the given principle foreshortening factor fz along z-axis.
(iii) Develop the transformation matrix for rotation about local x-axis passing through the
point [1 1 0] through an angle 50°.
Q.4. Attempt any one of the following : [10 marks]
2 2
x y
(a) (i) Generate uniformly spaced 5 points on the ellipse + = 1.
9 16
(ii) Find the parametric equation of the Be’zier curve determined by the control points
B0[−2 −3], B1[−1 2], B2[3 5] and B3[6 2].
Also, find the points on the curve corresponding to the parameter values t = 0.37,
0.65 and 0.2
(b) (i) Derive the iterative matrix for generation of uniformly spaced n points on the
2 2 2
circumference of circle x + y = r .
2
(ii) Determine the diametric projection if a foreshortening factor along z-axis is
3
(θ > 0, φ < 0).
✍✍✍
Notes:
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
Notes:
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________
___________________________________________________________________________________________________