CMPS 285 Final, Fall 2005
American University of Beirut · Computer Graphics · 12 pages
Showing the first 10 of 12 pages. Download the PDF to see all of it.
More CMPS 285 files
Show the text of this final exam
Faculty of Arts & Sciences
Department of Computer Science
CMPS 285 Computer Graphics
Final - Fall 2005-2006
Time: 2 hours
Ahmad Nasri
Student Id
....................................................................................................
Student Name
....................................................................................................
Signature
....................................................................................................
Question
Grade
1. General - 16 points
2. Transformations - 30 points
3. Texture Mapping - 10 points
4. Clipping - 14 points
5.Scan Conversion - 20 points
6. Curves and Surfaces - 10 points
Total /100
1
Important
PLEASE read the followings before you start:
1. Keep your eyes on your paper. Any attempt to cheat will result in failing the course
and may lead to disciplinary actions against the student.
2. You MUST NOT talk at all during the exam; any talk or chat will be considered as
a cheating attempt.
3. You MUST switch your mobile phone off. Silent mode is not enough
4. The use of calculator is NOT allowed.
1
General - 10 points
1. The following terms are possible answers for the questions listed below.
Use the
number corresponding to a term in the space provided before the question if you
think it is the BEST match for one of the terms. Each term may be used once, more
than once, or not at all.
number
term
1
rotation about x axis
2
rotation about y axis
3
bitmap
4
culling
5
z-buffer
6
flicker
7
Texture
8
alpha
9
antialiasing
10
screen window
number
term
11
pixel
12
refresh rate
13
viewport
14
window
15
delta
16
overall scaling
17
GLUT
18
interlace
19
affine
20
wireframe
..... The number of times per second that an image must be displayed on a screen in
order to maintain the illusion of a continuous image.
..... A 4 × 4 matrix such as
1
0
0
0
0
α
−β
0
0
β
α
0
0
0
0
1
where α2 + β2 = 1.
..... A 4 × 4 matrix such as
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
α
where α > 0.
..... Below the critical fusion frequency in a CRT suffer from this problem
2
..... A standard television set employs this technique to effectively double the rate at
which images seem to be displayed on the screen, thus providing a better illusion
of a continuous image
..... The frame buffer or pixel array associated with a ”bi-level” raster displays
..... This style of rendering draws only the edges of objects
..... The subset of the World Coordinate System that is eventually rendered as an
image on the face of the CRT
..... The portion of the face of the CRT that displays an image stored in the physical
frame buffer
..... This provides a set of ”widgets” and auxiliary functions for quickly building user
interfaces using lower-level functions in OpenGL and X Windows or some other
window system.
2. You need to design a graphics system with a 1024 color displayable simultaneously
out of a palate of 230 possible colors. Assuming the size of the frame is 80 MB, answer
each of the following (use power of 2 in your answers):
What is the maximum number of pixels your screen can have?
How many gray levels your system has?
What is the size in bytes of your color table?
2
Transformations
1. Consider a box formed by a unit cube with one face removed. Suppose that a call
to glLookat() with the parameters indicated below displays the box centered in the
3
middle of the screen, aligned with the three planes, xoy, xoz, and zoy, with its top
opening in normal orientation (Z axis coming out of the screen.), as indicated below:
x
y
z
Face OPEN
x
y
z
Face OPEN
Before
After
glLookAt (0., 0., 10., 0., 0., 0., 0., 1., 0.);
What changes to these parameters are needed in order to see the box upside down,
i.e. the opening is from below and still aligned with the planes.
glLookAt (........................................);
2. Give tree lines of OpenGL code that will transform the bigger triangle B to the smaller
triangle A.
A
B
C
4
.............................................
.............................................
............................................
DrawTriangle(); // draw the triangle
Show how to devise a transformation matrix to map the trianlge A to C which are
both arbitrary.
5
3. The following piece of code produces some levels of Pythagoras tree using an initial
shape shown in thick line (square with a half on one side).
Pythagoras(); // this is level 0
glTranslated(x1,y1,0);
glScale(sx,sy,1);
glRotatef(a,0,0,1);
glPhushMatrix();
Pythagoras(); // this is level 1
glLoadIdentity();
glTranslated(x2,y2,0);
for (i = 0, i < 2, i++){
glScale(sx,sy,1);
glRotatef(a,0,0,1)};
Pythagoras(); // this is level 2
glLoadIdentity();
glTranslated(x3,y3,0);
for (i = 0, i < 3, i++){
glScale(sx,sy,1);
glRotatef(a,0,0,1)};
Pythagoras(); // this is level 3
....
10
10
level 0
Level 1
Level 2
level 3
6
(a) Give the values of each of the parameters below in the table indicated.
Sx = ..........
Sy = ..........
a = ..........
x1 = ..........
y1 = ..........
x2 = ..........
y2 = ..........
x3 = ..........
y3 = ..........
(b) Is it possible to find a recursive formula for computing xi+1 and yi+1 from xi and
yi? If so what is it?
3
Texture Mapping
1. Consider the picture of the butterfly as a texture map T(s, t) to be mapped to a part
of the cylinder whose base is a circle centered at the origin and whose axis is aligned
with the z- axis. The part of the cylinder is limited by the height Z1 and Z2 and the
angle O1 and O2.
1
1
t
s
O
O2
O1
z1
z2
7
Explain how to get the texture value T(s0, t0) of a point P0) on this part of the
cylinder. Indicate those for the corners if the butterfly is to be seen upside down.
4
Clipping
1. In line clipping, a line segment is represented by a parametric equation using a pa-
rameter t ∈ [0, 1]. The line segment defined by the points A(−3, 2) and B(3, −1) is
to be clipped against the left window boundary shown in the figure below. Find the
coordinates of the intersection point and its corresponding parameter t.
Left Boundary
x
Y
A(-3,2)
B(3,-1)
(a) What is the region code of both vertices. Put that on the Figure provided
(b) The intersection point is:
8
(c) The value t is:
2. Given Sutherland-Hodgman algorithm to clip the polygon below. You must show the
results gradually by drawing the clipped polygon and give the resulting vertices for
each window boundary and in the proper order.
LEFT
Window
A
B
C
D
E
F
G
H
K
L
M
RIGHT
Window
A
B
C
D
E
F
G
H
K
L
M
BOTTOM
Window
A
B
C
D
E
F
G
H
K
L
M
TOP
Window
A
B
C
D
E
F
G
H
K
L
M
Put vertices in anti-clockwise order
Left Clipper Vertices: .................................
Right Clipper Vertices: .................................
Bottom Clipper Vertices: .................................
Top Clipper Vertices: .................................
9
5
Scan Conversion
1. Using the Brsenham’s line algorithm, fill in the table by the first six pixels generated
by the line between the two vertices (2, 2) and (9, 5) . You must give the precision
factor at each step.
X
2
Y
2
E(x, y)
2. In the scan conversion of the following polygon:
1
2
5
8
11
14
2
5
7
9
A
B
C
D
G
H
K
L
M
N
O
black circle indicates a filled pixel, for example pixel (1,5) is filled. Answer the fol-
lowing questions:
(a) Indicates on the picture the pixels that are NOT filled by the scan line conversion
algorithm using black circles.
(b) Give the active edge list for the scan line Y = 5.
How many spans will be
generated? Give your spans in terms on intervals such as [a, b[ or [c, d].
Active Edge
Ymax
X
1/m
AO
10
The spans are : ..............................................
(c) How many spans will be generated for the scan line Y = 2? Give your spans in
terms on intervals such as [a, b[ or [c, d].
The spans are : ..............................................
6
Curves and Surfaces
1. On the figure, we have a control polygon of the B´ezier curve defined by A,B,C,D and
a curve representing the digit 8.
1
2
5
8
11
14
2
5
7
9
A
B
C
A
(a) What is the degree of the curve defined by A,B,C,D. Show how to evaluate the
curve at the parameter t = 0.5. Just simplify the equation and no need for much
calculation.
11
(b) What is the coordinates of the tangent vector at the first point D? Show this on
the picture.
(c) How many pieces of B´ezir curve can be used to design the digit 8? Draw the
control polygons of these curves on the Figure.
12