1
EE5808 Assignment 2 (Total marks = 100)
Qn 1 (20 marks)
a) What is the key difference between perspective and parallel projection? (5 marks)
b) What is the key difference between cavalier and cabinet projection? (5 marks)
c) Given the following OpenGL command:
glOrtho(-2, 2, -2, 2, -2, 2);
What is the equation of the view plane? What coordinates is the equation expressed in?
(5 marks)
d) A camera is positioned at (100, 100, 100). It is pointing at (0, 100, 0). The view up vector is
(0, 0, 1). Write an OpenGL command that defines the camera. (5 marks)
Qn 2 (30 marks)
The figure below shows a hierarchical object with three parts and its DAG. 𝑍𝑍 is pointing out of
the paper. There is no offset in 𝑍𝑍.
Part 1 is a cylinder with radius 2 and height 10. It has been implemented in a function Part ( ).
Part 2 is Part 1 scaled down by 0.5 in the 𝑋𝑋 and 𝑌𝑌 direction with no scaling in the Z direction.
Part 2 is also rotated (300) and translated as shown. Part 3 is rotated (300) and translated with
respect to Part 2 as shown.
a) Derive the 4 x 4 homogeneous transformation 𝑀𝑀2←3 .
(5 marks)
Part 1
Part 2
X
Part 3
Y
30o
Y X
Part 1
Part 2
Part 3
10
2
Y
X DAG 30o
2
b) Derive the 4 x 4 homogeneous transformation 𝑀𝑀1←2.
(5 marks)
c) Hence write an OpenGL program for the hierarchical object.
(10 marks)
d) If the object is to have the following motion:
– Part 3 rotated about its Y axis by 45𝑜𝑜
– Part 1 translated along its X axis by 10 unit
Add code to your program to realize the motion. Underline the added code.
(10 marks)
Qn 3 (50 marks)
a) Given the following OpenGL command
gluLookAt (0, 100, -100, 0, 0, 0, 0, 1, 0);
Derive the 4 × 4 homogeneous transformation 𝑀𝑀𝑉𝑉𝑉𝑉←𝑊𝑊𝑉𝑉. Evaluate the inverse.
(15 marks)
b) The projection vector of a Cavalier projection is (1,1,𝑉𝑉𝑝𝑝𝑝𝑝) and 𝑉𝑉𝑝𝑝𝑝𝑝 > 0. Let the view plane be
𝑍𝑍 = −5. Derive the 4 × 4 projection matrix. The third row of the matrix should record the
original 𝑍𝑍 value before projection.
(10 marks)
c) In the following figure, 𝑌𝑌 axis is pointing out of paper. Functions Part_1 ( ) and Part_2 ( )
have been written. Part 3 is Part 2 reflected about the Z axis of Part 1.
Fig. 2
Z
X
Z
𝛼𝛼
100
60
Part 1
Part 2
Part 3
X
3
Angle 𝛼𝛼 = 30𝑜𝑜
i) Derive the 4 x 4 homogeneous transformation 𝑀𝑀𝑃𝑃1←𝑃𝑃2. (5 marks)
ii) Write an OpenGL function object ( ) for the object. (10 marks)
iii) Suppose
– Part 2 rotates about its own axis X by 15𝑜𝑜. Note that Part 3 should rotate
symmetrically.
– The whole object translates by (10, 10, 10).
Add code to your function for the motion. Underline your code. (10 marks)
— END —