CS 5600 - Spring 2013

Homework Assignment 2

Hierarchical Transformations (100 points)

Handed out: Jan 30, 2013
Due: 23:59pm, Wednesday, Feb. 20, 2013

You will write a program that makes a multi-pinwheel that spins.  You should have one gigantic pinwheel that turns around the center as indicated by the gray arrow shown below.  The pinwheel is composed of three other pinwheels which each are turning about their center in the direction indicated by the black arrows as shown below.  The pinwheel components are RGB cubes which are spinning around the vertical axis as shown by the white arrows (but all three groups of cubes must spin like this, the arrows are only show on the top cube).  The two vertical cubes have RGB on opposing faces (just three faces are shown).  The two horizontal ones are an RGB color cube as shown (which is in the CubeSpin example).

For example:

 

You should use OpenGL for drawing.  No lighting like in the example.  The CubeSpin example program provides the basis for this assignment. 

1. You program should compile and run on the CADE.  The background color can be white, black or grey, your choice.

2. Use the 'space key' to toggle the animation of the pin wheel on and off.

3. You should control the rotation speed with keystrokes: 'f' for faster, 's' for slower (look at the example code for '<' and '>'.  This speed controls all of the rotations.  That is, the individual cubes should rotate faster or slower (white arrows), the individual groups of four cubes should rotate faster or slower (black arrows) and the entire group of cubes should rotate faster or slower (black arrow).

4. The ‘x’, ‘y’, ‘z’ keys should rotate the individual cubes (all of them) 5 degrees about their respective centers but only when the pinwheel is in the ‘stop animation’ mode.  However, when not in animation and individual cubes are rotated with key-strokes and when the animation starts, the current position of the individual cubes should not change.

5. When you start the animation, the pinwheel should start animating with the last speed setting and start the animation from wherever the individual cubes were rotated to in step 4.  It should not jump to an initial state when starting/stopping animation.

6. You must use hierarchical transformations for the translation and rotation, you may wish to experiment with scaling over time as well.  Make it look nice!

7. Draw into a 512x512 window. 

8. You must document the hierarchy you used (draw the tree) in your writeup.

Output

The program should draw its output to an OpenGL window of size 512x512 as in the example program.

Submission

use the handin routine in the CADE Lab. You can with zip or tar your solution. You should comment your code appropriately and hand in a web-page that will serve as complete documentation. Please include a paragraph of difficulties and a paragraph of what you learned in this assignment.

The handin name for this lab is "lab2".

Windows users should use the Zip utility and handin a single zipped file. Unix users should use the tar program to do the same. We will recompile the programs to grade them. Make sure your workspace/program will compile for us. That is, be careful about your user-specific pathname variables! If you do this on a home machine, please allow sufficient time for porting to the CADE machines. We will grade based on compiling and running on the CADE machines.

Due to a bug in the handin program, do not include spaces in the names of the files that you submit, otherwise we will not receive them. For instance, "no spaces.txt" is not a valid filename and would not be received, while "no_spaces.txt" is valid. Please keep this in mind while handing in your assignment.