Family
Name:_____________________________
First
Name:
_____________________________
Student
ID:
_____________________________
Instructions:
Attempt all questions.
There are five questions.
The total mark is 24.
You have 60
minutes to complete the test.
Aids allowed: Calculators
Textbooks and notes are NOT allowed.
1: /4
2: /5
3: /5
4: /5
5: /5
_________
Total: /24
1. Colour: [4 marks] A sheet of white paper
is printed with four circles, coloured Yellow, Cyan, Magenta and Black. A Green
light shines on the paper. Here is an RGB cube as a reminder:
a.
[0.5
mark] What colour does the White background appear?
b.
[0.5
mark] What colour does the Black circle appear?
c.
[0.5
mark] What colour does the Yellow circle appear?
d.
[0.5
mark] What colour does the Cyan circle appear?
e.
[0.5
mark] What colour does the Magenta circle appear?
f.
Now
suppose a Yellow light shines on the paper.
[0.5 mark] What colour does the Yellow circle appear now?
g.
[0.5
mark] What colour does the Cyan circle appear now?
h.
[0.5
mark] What colour does the Magenta circle appear now?
2.
Projection:
[5 marks] A unit cube lit by a point light at L(1,1,2) casts a shadow on the
x-y plane:
a.
[2
marks] What are the coordinates of A', B' and C', the three corners of the
shadow?
b.
[3
marks] For an arbitrary point P(x,y,z), what are the coordinates of its shadow
point P'(x,y,0) on the x-y plane?
3.
Visibility:
[5 marks] Consider a set of polygons, represented in 2D cross-section as line
segments. Arrows represent front-facing normals.
a.
[3
marks] Draw the BSP tree obtained by inserting the polygons in alphabetical
order. Left subtrees correspond to the front side, and right subtrees to the
back. If any polygons are split, label the fragments on the diagram and the
tree.
b.
[2
marks] For the given camera eye point, list polygons in the order they are
drawn by the BSP traversal algorithm.
4.
Clipping:
[5 marks]
a.
[2
marks] Describe the trivial accept/reject test for Cohen-Sutherland clipping.
b.
[3
marks] Suppose we clip a polygon with n sides against a
rectangular window. The clipped polygon will have m sides, and
often n ≠ m.
If n = 3, what values can m have?
Give a sketch for each value of
m.
5.
Modeling:
[5 marks] For this question, use the following openGL-like function calls:
trans(tx,ty) |
scale(sx,sy) |
rotz(ang) |
glBegin() |
push() |
pop() |
In this question, you will
write code to draw a fractal “meander”.
|
|
|
Order 1 |
Order 2 |
Order 3 |
a.
[1
mark] Write code to draw an order-1 meander.
order1 () { glBegin(GL_LINE_STRIP); vertex(0,0); vertex(0.3333,0); vertex(0.3333,0.3333); vertex(0.6666,0.3333); vertex(0.6666,0); vertex(1,0); glEnd(); }
b.
[4
marks] As you can see, an order-1 meander consists of 5 segments,
each length 1/3. If we replace each segment with a whole meander
scaled down by 1/3, we obtain a higher-order meander.
Write a function meander(int n)
which draws an order-n
meander. It is easiest to
define the function recursively.
meander (int n) { if (n == 1) { order1(); } else { push(); scale(0.3333,1); meander(n-1); pop(); trans(0.3333,0); rotz(90); push(); scale(0.3333,1); meander(n-1); pop(); trans(0.3333,0); rotz(-90); push(); scale(0.3333,1); meander(n-1); pop(); trans(0.3333,0); rotz(-90); push(); scale(0.3333,1); meander(n-1); pop(); trans(0.3333,0); rotz(90); push(); scale(0.3333,1); meander(n-1); pop(); } }