Programming assignment 1 - Menger Sponge

CS 354 - Introduction to Computer Graphics
Spring, 2007
Don Fussell

DUE Monday February 12 at Midnight

You are to modify the gasket3 program from the book (or, alternatively just start from scratch) to produce a a Menger sponge as shown below:

Menger <P>
Sponge
Like the Sierpinski tetrahedron, this is a 3 dimensional fractal, defined recursively. Unlike the tetrahedron, it is probably best defined by taking a cube, shrinking it to 1/3 its size, and then replacing the original cube with a collection of the smaller cubes in the proper arrangement, rather than subdividing the cube (although that can be done as well).

You should allow the level of recursion to be varied as in the gasket program. You should also start with this gasket program rather than the one in the book, since it has some slight improvements. You can use a similar orthographic view as for the gasket, and a similar coloring scheme for the faces.

For extra credit, try one or more of these:

You make it possible for the user to control the drawing with a mouse-based interface and menu-based system. The recursion level along with any extra credit options like viewer's position, inverse mode vs. sponge mode, lighting, etc. must be controlled via mouse/menu. Here is some example source code that uses openGL and glut for a variety of functions including mouse-based control.

Oh, and be careful not to allow a user to specify a large number of recursion levels. To see why, tell me how many cubes would be required at level 5 and at level 10.

Notes