Old Exams

Here are the midterms and final exams that I have given previously in EECS 488 / CS 488 / AD 488:


Spring '96 Midterm:

1a. The Frame Buffer (20 points)

Assume you have a colour map with a depth of 6 (i.e. 6-bit) and a width of 8 (i.e. 8 bit). How many different colours can be shown simultaneously? How many possible colours are there?

1b. Screen Refresh (25 points)

Assume you have a sequence of 5 images to be shown as an animation. Assume that the screen refreshes 60 times per second and the images take the following amount of time to draw on the screen in seconds: 1/18, 1/31, 1/28, 1/16, 1/25. How long does it take to display the entire sequence of 5 images?

1c. Midpoint Line Algorithm (30 points)

Assume you have a line segment from (2,2) to (8,4). Using the final version of the Midpoint Line Algorithm discussed in class what are the values of:

deltaX, DeltaY, dinitial, deltaE, deltaNE

Apply this algorithm to the line segment and give me the values of X, Y and d for each iteration through the loop.

2a. Polygon Filling (20 points)

Given the following set of polygon vertices (assume vertex a connects to vertex a+1 and the last vertex connects back to the first): (0,30), (20,20), (30,30), (40,20), (80,40), draw the global Edge Table containing all these edges and then draw the Active Edge Table after the first edge(s) are moved into it and sorted.

2b. Line Clipping (25 points)

Given a clipping order of above, below, right, left and a clipping rectangle from (10,10) to (20,20). For each of the following line segments give me the code of each endpoint in the Cohen-Sutherland Line Clipping Algorithm. Then tell me if the line can be trivially accepted, trivially rejected, or if it must be subdivided.

(15,0) to (15,-20)

(-5,15) to (-15,25)

(40,40) to (40,0)

(12,15) to (18,15)

(15,25) to (30,15)

2c. Polygon Clipping (30 points)

Given the following set of polygon vertices (assume vertex a connects to vertex a+1 and the last vertex connects back to the first): (0,30), (20,20), (30,30), (40,20), (80l,40), a clipping order of above, below, right, left and a clipping rectangle from (5,25) to (50,50). Give me the sequence of vertices generated AFTER EACH PASS through the Sutherland-Hodgman Polygon Clipping Algorithm. You do not need to give me the exact coordinates of the new vertices, simply indicate their position on a diagram and give them a label (as we did in class.)

3a. Homogeneous Coordinates (15 points)

Assume you have the 3D point (15.0, 3.0, 5.0). What is this point in homogeneous coordinates? What is ANOTHER set of homogeneous coordinates representing the same point?

3b. Transformations (30 points)

Given the following set of polygon vertices (assume vertex a connects to vertex a+1 and the last vertex connects back to the first): (20,20), (30,20), (30,30), (20,30), what are the new coordinates after the following transformations are applied. Apply each of the transformations SEPARATELY to the original coordinates, do not apply them in sequence.

scale by (3,2)

translate by (10,-20)

3c. More Transformations (30 points)

Given the following set of polygon vertices (assume vertex a connects to vertex a+1 and the last vertex connects back to the first): (30,30), (40,30), (40,40), (30,40), give me the sequence of transformations to apply (in the order they should be applied) to make the new coordinates of the same polygon be: (50,70), (55,70), (55,100), (50,100).

4a. 3D (25 points)

Given a 2D polygon with vertices (0,0), (20,-10), (20,10), and (0,10) and assuming a Right Hand Coordinate System and perspective projection, give me the values for the following so that the polygon appears in the window as shown below:

VRP

VPN

VUP

PRP

window (umin, vmin) (umax, vmax)

4b. More 3D (25 points)

Where is the center of projection in parallel projection:

Where is the center of projection in perspective projection:

What is necessary to define the center of projection for parallel projection:

What is necessary to define the center of projection for perspective projection:

How is clipping in 3D different from clipping in 2D:


Spring '96 Final:

1a. Warnock's Algorithm (50 points)

Use Warnockj's Algorithm to assign values to the following scene. Recurse as far as necessary drawing in the divisions you are using and ensuring each box is labelled in one of four ways.

1. all disjoint

2. single contained or intersecting

3. single surrounding

4. front surrounding

5. needs further subdivision beyond the resolution of the diagram

1b. Depth Buffer (15 points)

Write a pseudo-code algorithm for a depth buffer.

1c. Back Face Culling (15 points)

How is a back-facing polygon determined? Be specific.

1d. Object Space VS Image Space (10 points)

What is the difference between Object Space techniques and Image Space techniques? Name one algorithm we have discussed for each technique.

1e. Visible Surfaces (10 points)

What are the two primary reasons for using hidden surface routines?

2a. 2D Depth Cues (20 points)

Name and describe 5 of the 8 2D cues to depth

2b. Human Vision (10 points)

What are the differences between rods and cones both in terms of function and location?

2c. Reflection (10 points)

What is the difference between diffuse reflection and specular reflection?

2d. Phong Shading (10 points)

How is Phong shading different from Goraud Shading? Be specific.

2e. Illumination Models (12 points)

For each of the following categories tell me whether they are important in each illumination model


no lighting ambient diffuse reflection specular reflection
position of polygon



orientation of polygon



position of viewer



2f. Terms (15 points)

Define the following terms:

Hue

Saturation

Brightness

Lightness

Dominant Wavelength

2g. Colours (10 points)

How would I define a blue-green colour in the RGB colour model? In the CMYK colour model?

2h. Light Sources (13 points)

Describe point lights, directional lights, and spot lights to highlight their differences.

3a. Implementing 3D Perspective (20 points)

List (in order) and briefly describe the 8 steps to implementing perspective projection

3b. Canonical View Volumes (15 points)

Draw and label the canonical view volumes for parallel and perspective projection

3c. Transparency (15 points)

What is the difference between interpolated transparency and screen-door transparency?

3d. Raytrracing (15 points)

Describe how ray tracing is used to draw a scene.

3e. Radiosity (15 points)

Describe how radiosity is used to light a scene. How does radiosity relate to ambient light. What can't radiosity do?

3f. OpenGl (20 points)

Write the OpenGL / C commands necessary to draw a red square with the following vertices:

(10,20,30), (10,25,30), (10,25,35), (10,20,35)\


Fall '99 Midterm:

1: Polygon Filling (75 points)

Show the contents of the ET, AET, along with the events that change them while filling the following polygon: (10,10), (100,55), (100,120), (50,70), (10,100) where an edge connects each point to the next and the last back to the first.

2: Polygon Clipping (75 points)

Show the steps in applying the Sutherland-Hodgman Polygon clipping algorithm to the following polgon: .(-20,-30), (-20, 30), (20, 30), (20, 50), (10,50), (10,120), (120, 120), (120, 80), (70, 80), (70, 30), (110, 30), (110, -30) where an edge connects each point to the next and the last back to the first. The clip rectangle stretches from x=0 to x=100, y=-10 to y=100, and the clipping should use the planes in the following order: Xmax, Xmin, Ymax, Ymin. You should use 1 (or preferably more) diagrams to show the state of the clipping after each pass, and label each of the new points

3: Transformations (75 points)

Say you have three polygonal drawing functions available to you:
void DrawSquare(void) //Draw a square centered at the origin with sides of length 1
void DrawCircle(void) //Draw a circle centered at the origin with diameter of length 1
void DrawTriangle(void) //Draw a triangle with the three corners (-1,0), (1,0), (0,1)

and two transformation functions Scale(X,Y) and Translate(X,Y) where scaling and rotation are performed about the origin as we discussed in class:

and LoadIdentity(), PushMatrix(), and PopMatrix() as described in class:

Give the sequence of those function calls to draw the following scene. Please comment your code so I know what you are trying to draw with each block of code.

4: 3D Graphics (75 points)

Assume you have the following two polygons defined by their coordinates in X,Y,Z:
Polygon 1: (10,0,0), (30,0,0), (30,10,0), (10,10,0)
Polygon 2: (30,0,0), (30,10,0), (30,0,10)

For each of the following conditions draw and label a diagram showing the 2 sets of axis, the polygons, the PRP, and the window. Also in a second drawing, show what will appear in the window.

VRP 30,0,0
VPN 1,0,0
VUP 0,1,0
PRP 20
U-25 to 25
V –25 to 25
perspective
VRP 30,0,0
VPN 0,0,1
VUP 0,1,0
PRP 20
U-25 to 25
V –25 to 25
perspective
VRP 30,0,0
VPN 0,1,0
VUP 1,0,0
PRP 20
U-25 to 25
V –25 to 25
perspective


Fall ‘99 Final Exam

1: Warnock's Algorithm (75 points)

Use Warnock's Algorithm to assign values to the following diagram where you should assume the triangle is in front of the rectangle. Recurse as far as necessary drawing in the divisions you are creating and ensuring each box you create is labeled in one of five ways.

  1. all disjoint
  2. single contained or intersecting
  3. single surrounding
  4. front surrounding
  5. needs further subdivision beyond the resolution of this diagram

2: 2D Cues to Depth (75 points)

a. Using examples from real life, i.e. by describing an image you may see in a photograph, explain how each of the eight 2D cues to depth work:

  1. Overlap
  2. Apparent Size
  3. Differential Size
  4. Linear Perspective
  5. Motion Parallax
  6. Aerial Perspective
  7. Texture
  8. Shading and Lighting

b. Explain WHY the dominant cue within 12" is stereo vision – that is, explain why EACH of the other cues less effective.

3: Lighting (75 points)

  1. Explain the differences between the following: no lighting model, diffuse reflection, specular reflection. Then give 2 example objects that would look most appropriate for each type of lighting model.
  2. Explain the differences between the following types of shading in terms of both their overall effect and the way that they are implemented: none, flat, Goraud, Phong
  3. Explain the differences between ray-tracing and radiosity

4: OpenGL (75 points)

In the 4th assignment you wrote an OpenGL program allowing you to drive/fly through a computer graphics small town. In this question you are to write a complete C/C++ OpenGL program to open a window to give us a perspective view (you can use the AUX routines here), draw a green plane to be the ground and then draw three white buildings on the ground in the shape of ‘488’. Everything (the buildings and the plane) should be drawn using only cubes, and the various OpenGL transforms.


Fall '00 Midterm:

1: Polygon Clipping (75 points)

Show the steps in applying the Sutherland-Hodgman polygon clipping algorithm to the polygon described below where an edge connects each vertex to the next and the final vertex back to the first. The clip rectangle stretches from x=10 to x=70, and y=40 to y=110. The clipping edges should be checked in the order: Ymax, Xmax, Ymin, Xmin. List each of the points (including coordinates) and draw a diagram showing the state of the clipping after each pass labeling all the points.

Initially:
A (0, 125)
B (75, 125)
C (75, 100)
D (25, 100)
E (25, 75)
F (50, 75)
G (50, 50)
H (25, 50)
I (25, 25)
J (75, 25)
K (75, 0)
L (0, 0)

2: 3D Graphics (75 points)

Assume you are creating a perspective view of the following two polygons defined by the following coordinates in X, Y, Z assuming a right-handed coordinate system:

Polygon 1: (10,10,0), (20,10,0), (20,20,0), (10,20,0)
Polygon 2: (10,10,0), (10,10,10), (10,20,0)

For each of the following conditions draw and label a diagram showing the X, Y and Z axis, the U, V, and N axis, the two polygons, the PRP, and the window. In a second drawing, show what will appear inside the window. Note that the position of the objects within the window is critical.

VRP 10,10,0
VPN 0,0,1
VUP 0,1,0
PRP 0,0,20
U -11 to 11
V –11 to 11
VRP 10,10,0
VPN -1,0,0
VUP 0,1,0
PRP 0,0,20
U -11 to 11
V –11 to 11
VRP 10,10,0
VPN 0,1,0
VUP 1,0,0
PRP 0,0,20
U -11 to 11
V –11 to 11

3: 2D OpenGL (150 points)

Given the standard shell we have been using for the homework assignments (given on the next page), and the three polygonal drawing functions given here:
void DrawSquare(void) /* Draw a square centered at the origin with sides of length 1 */
void DrawCircle(void) /* Draw a circle centered at the origin with diameter of length 1 */
void DrawTriangle(void) /* Draw a triangle with the three corners (-1,0), (1,0), (0,1) */

and the typical OpenGL translation, rotation and scaling functions, and the ever popular LoadIdentity(), PushMatrix(), and PopMatrix(), write the code to draw the following scene on the screen. Please comment your code thoroughly so I know what you are trying to draw with each block of code. The scene shows a minimalistic house, tree, and car which should be drawn as shown below – you should use the grid system as a guide to positioning and sizing the objects correctly. The house and tree remain stationary each frame, but the car should move left and right under user control using the ‘j’ and ‘l’ keys respectively. The entire car should always remain on the screen so you should not allow it to move past the edge of the screen.

/* EECS 488 Fall 2000 Midterm shell */


#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>

/********** keyboard **********/
void keyboard(unsigned char c, int x, int y)
{
/* update stuff goes here */
}

/********** update **********/
void update(int value)
{
/* update stuff goes here */

glutTimerFunc(5, update, 1); /* at the end of this function reinstate the timer callback */
}

/********** display **********/
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT); /* clear the screen to the clear colour */

/* display stuff goes here */

glutSwapBuffers(); /* swap buffers */
}

/********** main **********/
int main(int argc, char **argv)
{
glutInit(&argc, argv); /* deal with any GLUT command Line options */

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); /* create an output window */
glutInitWindowSize(500, 500);
glutCreateWindow("EECS 488 - Midterm");

glutKeyboardFunc(keyboard); /* set up for accepting keyboard commands */

glMatrixMode(GL_PROJECTION); /* set up the logical graphics space */
glLoadIdentity();
gluOrtho2D(-200, 200, 200, -200);
glClearColor(0.0, 0.0, 0.0, 1.0);

glutDisplayFunc(display); /* assign the display function */
glutIdleFunc(display); /* assign the idle function */
glutTimerFunc(5, update, 1); /* set up a timer to regularly update the scene */

glutMainLoop(); /* set everything going */

return 0;
}


Fall '00 Final: version 1

1. BSP Trees

Given the following set of 6 polygons with front-facing normals shown, generate the BSP tree starting with A and adding polygons in alphabetical order. Once that is done generate the far to near sequence of polygons for each of the eye positions (1 and 2).

2. Shading Methods

For each of the following shading models, show how the colour is calculated at the grey point near the center of the triangular polygon.

You can define the normal for the polygon as Np, and the normals at each of the vertices as N1, N2, and N3 respectively.

If any interpolation is used, show which values are used in the computation and how the values for interpolation are defined on the diagram (ie you will need to define some new points on the diagram and draw a line or two).

Flat Shaded

Goraud Shaded

Phong Shaded

3. OpenGL

One of the types of games that we did not code in the course is the ‘fixed gun emplacement’ game, where the player has a cannon at a fixed location, and things are moving towards the player and the player must blow them up by getting the angle right on the projectiles. You can decide what these things are (rocks, aliens, tomatoes) depending on your personal preferences. In this question you are to write the complete code for such a game given the following constraints.

- the cannon should look like a simple cannon – you can assume you have a drawCube() function that draws a cube centered at 0,0,0 with a side of length 2 to help create it.

- the cannon sits in the center on top of a large square green plane

- you can elevate or lower the barrel to change its angle using the I (elevate) and K (lower) keys

- you can rotate the gun to change the direction of the shot using the J (counterclockwise) and L (clockwise) keys

- the canon should show the change in elevation or direction by tilting or moving

- you can change your viewpoint on the scene using the A key to rotate the plane (and everything on it) counterclockwise and D key to rotate the plane (and everything on it) clockwise. Your viewpoint will always be slightly above the height of the plane. (It would be better for you to be able to look over the plane from above and then tilt the plane but we’ll skip that to make the problem easier)

- the F key fires a shot. There can be a maximum of 10 shots on the screen at once

- the shots should follow parabolic paths (like in the real world) so your cannon imparts an initial horizontal and vertical velocity and then gravity pulls the shell back down to the plane

- the ‘bad guys’ come in from the edges of the plane at a random place on the edge

- only one bad guy can be on the screen at any given time (out of a total of 20 bad guys in the game)

- if the bad guy gets hit by a shot the bad guy is destroyed

- if the shot hits the ground then the shot is destroyed

- if any of the bad guys get to the center (where the canon is) then the player loses

- if the player destroys all 20 bad guys then the player wins

- simple sound effects would be nice

- the program should use diffuse lighting, back face culling, z-buffering and perspective viewing

- literate programming is really valuable here so I get a good idea what you are doing

Half of your score is based on the implementation and half of the score is based on your design so I would work out the design first and how you are going to break the program into modules before coding.


Fall '00 Final: version 2

Q1: Shading Methods

For each of the following shading models, show how the colour is calculated at the grey point near the center of the triangular polygon.

You can define the normal for the polygon as Np, and the normals at each of the vertices as N1, N2, and N3 respectively.

If any interpolation is used, show which values are used in the computation and how the values for interpolation are defined on the diagram (ie you will need to define some new points on the diagram and draw a line or two).

Flat Shaded

Goraud Shaded

Phong Shaded

Depth Sort

2: Depth Sort

Here is the algorithm we discussed in class:

1. Sort all polygons based on their farthest z coordinate
2. Resolve ambiguities
3. Draw the polygons in order from back to front

Where step 2 deals with any polygons whose z extents overlap. We start with the furthest polygon and call it P. Polygon P must be compared with every polygon Q whose z extent overlaps P's x extent. 5 comparisons are made. If any comparison is true then P can be written before Q. If at least one comparison is true for each of the Qs then P is drawn and the next polygon from the back is chosen as the new P.

1. do P and Q's x-extents not overlap.
2. do P and Q's y-extents not overlap.
3. is P entirely on the opposite side of Q's plane from the viewport.
4. is Q entirely on the same side of P's plane as the viewport.
5. do the projections of P and Q onto the (x,y) plane not overlap.

If all 5 tests fail we quickly check to see if switching P and Q will work. Tests 1, 2, and 5 do not differentiate between P and Q but 3 and 4 do. So we rewrite 3 and 4

3’ is Q entirely on the opposite side of P's plane from the viewport.

4’ is P entirely on the same side of Q's plane as the viewport.

If either of these two tests succeed then Q and P are swapped and the new P (formerly Q) is tested against all the polygons whose z extent overlaps it's z extent.

On the next page draw me an example for each of these 6 cases (1, 2, 3, 4, 5, 3’ or 4’) to illustrate the condition where that case is satisfied but the previous conditions were not. For example for #3 you need to draw a scene where condition 1 and 2 are false, but 3 is true.

Make sure the drawings are clear.

3. OpenGL

One of the types of games that we did not code in the course is the ‘lunar lander’ game, where the player has control of, well, a lunar lander. The lander is falling towards the lunar surface and the player must bring it to a gentle landing. In this question you are to write the complete code for such a game given the following constraints.

- the lunar lander can be a pretty simple model – you can assume you have a drawCube() function that draws a cube centered at 0,0,0 with a side of length 2 to help create it.

- the lunar surface is square, but not flat. An ASCII data file defines the elevated plane as a 50 by 50 grid and gives the height of each element – 0 through 9 with 0 being the surface and 9 being a mountain peak

- the lander starts off in the center of the plane N meters above the grayish lunar surface

- gravity is pulling the lander downwards

- you can thrust upwards using the K key

- you can thrust laterally using the J, L, I, and M keys to move west, east, north, south respectively

- you can change your viewpoint on the scene using the A key to rotate the scene counterclockwise and D key to rotate the scene clockwise. Your viewpoint will always be situated 50 meters above the surface. (It would be better if you could tilt the plane but we’ll skip that to make the problem easier)

- if the player lands in the center of an area of the plane that is flat for 9 squares (ie in the center of a 3X3 cluster of squares that all have the same height) and has vertical velocity < A meters per second, and horizontal velocity < B meters per second then the player wins

- the player has limited fuel and each use of a thruster costs fuel

- if the player runs out of fuel then the player can’t use any of the thrusters

- if the player hits the surface in the center of an area that is not flat for 9 squares (3X3) or hits the surface with a vertical velocity is >= A meters per second, or hits the surface with a horizontal velocity >= B meters per second then the player loses

- simple sound effects would be nice

- the program should use diffuse lighting, back face culling, z-buffering and perspective viewing

- literate programming is really valuable here so I get a good idea what you are doing

Half of your score is based on the implementation and half of the score is based on your design so I would work out the design first and how you are going to break the program into modules before coding.


Spring '03 Midterm:

1: Polygon Filling – 50 points

Show the contents of the ET, AET, along with the events that change them and which pixels are filled in, scanline by scanline, while filling the following polygon: (10,10), (20,10), (20,16), (16,16), (13,13), (10,16) where an edge connects each point to the next and the last back to the first.

2: 3D Graphics – 120 points

Assume you have the following two polygons defined by their coordinates in X,Y,Z, assuming a right handed coordinate system (Z coming out of the screen, same as used in class) and no clipping

Polygon 1: (20,0,0), (20,20,0), (20,20,20), (20,0,20)
Polygon 2: (20,0,0), (40,0,0), (20,20,0)

For each of the following conditions draw and label a diagram showing the 2 sets of axis, the 2 polygons, the PRP, and the window. Also in a second drawing, show what will appear in the window. So you should have 6 drawings total.

VRP 20,0,20
VPN 1,0,0
VUP 0,1,0
PRP 0,0,25
U -25 to 25
V –25 to 25
perspective

VRP 20,0,0
VPN 0,0,1
VUP 0,1,0
PRP 0,0,25
U -25 to 25
V –25 to 25
perspective

VRP 20,0,20
VPN 0,1,0
VUP 1,0,0
PRP 0,0,25
U -25 to 25
V –25 to 25
perspective

3: OpenGL

Assume you have the same shell that you used in the first Assignment with the camera projection set up as follows:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-200, 200, 200, -200);
glClearColor(0.0, 0.0, 0.0, 1.0);

and the following functions for drawing:
void DrawSquare(void) /* Draw a square centered at the origin with sides of length 1 */
void DrawCircle(void) /* Draw a circle centered at the origin with diameter of length 1 */
void DrawTriangle(void) /* Draw a triangle with the three corners (-1,0), (1,0), (0,1) */

Write a program to create the following scene:


Spring 03 Fianl Exam: Version 1

Question 1: BSP Trees – 75 points

Given the following set of 6 polygons with front-facing normals shown, generate the BSP tree starting with A and adding polygons in alphabetical order. Then generate the BSP tree starting at F and adding polygons in reverse alphabetical order. Once that is done generate the far to near sequence of polygons for each of the eye positions (1 and 2) using the first BSP tree.

Question 2: Depth Sort – 75 points

1. Sort all polygons based on their farthest z coordinate
2. Resolve ambiguities
3. Draw the polygons in order from back to front

Where step 2 deals with any polygons whose z extents overlap. We start with the furthest polygon and call it P. Polygon P must be compared with every polygon Q whose z extent overlaps P's x extent. 5 comparisons are made. If any comparison is true then P can be written before Q. If at least one comparison is true for each of the Qs then P is drawn and the next polygon from the back is chosen as the new P.

1. do P and Q's x-extents not overlap.
2. do P and Q's y-extents not overlap.
3. is P entirely on the opposite side of Q's plane from the viewport.
4. is Q entirely on the same side of P's plane as the viewport.
5. do the projections of P and Q onto the (x,y) plane not overlap.

If all 5 tests fail we quickly check to see if switching P and Q will work. Tests 1, 2, and 5 do not differentiate between P and Q but 3 and 4 do. So we rewrite 3 and 4

3’ is Q entirely on the opposite side of P's plane from the viewport.
4’ is P entirely on the same side of Q's plane as the viewport.

If either of these two tests succeed then Q and P are swapped and the new P (formerly Q) is tested against all the polygons whose z extent overlaps it's z extent.

On the next page draw me an example for each of these 7 cases (1, 2, 3, 4, 5, 3’, 4’) to illustrate the condition where that case is satisfied but the previous conditions were not. For example for #3 you need to draw a scene where condition 1 and 2 are false, but 3 is true.

Make sure the drawings are very clear, and unambiguous. You may want to have multiple drawings showing different views of the same case if that helps. Be sure your axis are labelled

Question 3: OpenGL - 150 Points

One of the types of games that we did not code in the course is the ‘tetris’ game, where there are bricks falling from the top of the screen down towards the bottom and piling up. In this question you are to write the complete code for such a game (including all the GLUT code) given the following constraints:

- The playing field is 8 squares wide by 20 squares tall
- One brick will fall every second from the center of the top of the screen
- All of the bricks will be square and take up one square on the screen (which greatly simplifies the game compared to the original where there were multiple brick shapes)
- Each brick moves slowly downwards and lands on top of whatever is beneath it (perhaps another brick, perhaps the bottom of the window)
- The user can move the brick left and right one square at a time using the arrow keys while it is falling
- Whenever a complete row of 8 squares is filled then that row disappears. All bricks above that row drop down one row.

Half of your score is based on the implementation and half of the score is based on your design, so I would work out the design first and how you are going to break the program into modules before coding. Comments are also a very good idea so I know what you are trying to do …


Spring 03 Final Exam: version 2

Closed Book, Closed Note, Closed Neighbour, Closed Electronic Devices & no tinkertoys
Please turn off all cell phones and pagers for the duration of the exam

Question 1: BSP Trees – 75 points

Given the following set of 6 polygons with front-facing normals shown, generate the BSP tree starting with A and adding polygons in alphabetical order. Then generate the BSP tree starting at F and adding polygons in reverse alphabetical order. Once that is done generate the far to near sequence of polygons for each of the eye positions (1 and 2) using the first BSP tree.

Question 2: Warnock’s Algorithm – 75 points

Use Warnock's Algorithm to assign values to the following scene. Recurse as far as necessary drawing in the divisions you are using on the diagram below and ensuring each of your boxes is labeled in one of five ways.

1. all disjoint
2. single contained or intersecting
3. single surrounding
4. front surrounding
5. needs further subdivision beyond the resolution of the diagram

Question 3: OpenGL - 150 Points

One of the types of games that we did not code in the course is a ‘breakout’ game, where the screen looks similar to the pong screen except that in front of the top wall there are several rows of bricks, and when the ball hits one of those bricks the brick is destroyed. The goal is to destroy all the bricks. In this question you are to write the complete code for such a game (including all the GLUT code) given the following constraints:

- The player’s paddle moves left/right across the bottom of the screen
- There will be 4 rows of bricks stretching left to right across the upper half of the screen
- There are 10 bricks in each row
- If the ball hits a brick then the brick is destroyed at the ball’s Y velocity is reversed. Note that the ball may hit the brick from the top or bottom
- The ball will have a constant horizontal and vertical speed
- The ball bounces off the sides of the screen as in the Poing assignment – by reversing the appropriate velocity
- There is a bottom wall below the paddle so the ball can never leave the playing field (so its impossible to lose the game)
- The ball starts out moving downward at 45% starting out inbetween the bricks and the player’s paddle.

Half of your score is based on the implementation and half of the score is based on your design, so I would work out the design first and how you are going to break the program into modules before coding. Comments are also a very good idea so I know what you are trying to do …