CS 134
Assignment 1

Space-partitioning with BSP

(Due 4/28 at midnight)


In this assignment you will develop a BSP that splits the scene into sections according to the Binary Space Partitioning (BSP) approach described in class.

The program will read a simple datafile that describes the scene as a set of 2d lines or walls. Some sample files will be included for your testing but other files will be used in the assessment of your program. The format looks like the following:

x1 y1 x2 y2
x1 y1 x2 y2
x1 y1 x2 y2
x1 y1 x2 y2
where each line of the file represents the start and end of either a vertical or horizontal line that acts as a wall in the game scene.

Your program should read in an ascii text file (.txt) that will simply be a string of numbers like:
Simple Scene File (txt)

So, first this file must be parsed and drawn as the scene (10pts).

Next the program should use this scene as the 2D scene geometry and compute the BSP for the scene (40pts).

As in Lab 2, a visualization of the BSP should be drawn (20pts) and the ball will be moved around demonstrating what volume of the scene's BSP is the active region (20pts.)

Document your code and be neat (10 points). You may discuss the high-level concepts but you must write your own program, do not share code, do not sit together and code. Also, be cautious of your print-outs (used for debugging) as well, if someone copies your "thrown out" program, you will be held responsible. Finally, your code must be written in C and/or C++ and run on the linux machines in the lab by typing "assn1 scene.txt " at the shell command prompt.

Have fun!