Tutorial (Lecture 2)
Tut 1
Qn 1
The three dimensional coordinates of the house-shaped object below are as follows:
a = (0, 0, 0) b = (10, 0, 0) c = (10, 0, -20)
d = (10, 10, -20) e = (5, 15, -20) f = (5, 15, 0)
g = (0, 10, 0) h = (0, 10, -20) i = (0, 0, -20) j = (10, 10, 0)
The front face is denoted by 1F , the right face 2F , the left face 3F , the back face 4F ,
the right roof 5F , the left roof 6F , and the ground face 7F .
a) Construct the vertex, edge, face, and attribute table of a polygonal model of the
object.
b) Determine the outward unit surface normal of the left roof face.
c) Derive the equation of the face d e f j in the form
A x + B y + C z + D = 0
such that if the (LHS > 0) ⇔ (Outside) and vice versa.
d) Suggest a method for determining whether a point is inside or outside the house.
e) Suggest a general method for determining whether a point is inside or outside any
volumetric object.
f) Suggest an application for the function in e).
a
b
i
j
g
f
e
d
h
c
right left
front
2
Qn 2
a ( 0, 0, 0) e ( 0, 0, 5)
b (10, 0, 0) f (10, 0, 5)
c (10, 4, 0) g (10, 4, 5)
d ( 0, 25, 0) h ( 0, 25, 5)
Two popular object representation methods are tables and quadrilateral mesh.
a) Using tables, write C code to represent the face � bcgf in the form of vertex table,
edge table and face table. Use vertices to form the face table.
b) Represent the object above, except the top and bottom face, as a quadrilateral
mesh. To save time, you are only required to draw a 2D array and put the alphabet
(e.g. a) to each of the vertex of the array to show your idea.
c) Derive the plane equation of �cdhg.
d) Give an advantage of using the mesh representation compared to using the table
representation.
Qn 3
a) In CG, the parametric form is used instead of the non-parametric form. What is
the reason(s)?
b) The non-parametric form of a superellipsoid is given by
1
1
1
2
22
222
=
+
+
s
z
s
s
s
y
s
x r
z
r
y
r
x
a
b
c
d e
f
g
h
3
Derive its equivalent parametric form. Give the physical meaning of any
additional variables you introduce.
Qn 4
Consider the following program fragment:
void calculate_mesh (void)
{
for (int i=0; i