Math155B - Introduction to Computer Graphics - Spring 2005
Instructor: Sam Buss,  Univ. of California, San Diego

Project #2 - Modify the Solar System Demo by adding planets and moons and a comet. 

Due Date: Wednesday, April 20, midnight.

Goals:  Learn more about how to use OpenGL and interrupt-driven programming.   Learn to use double buffering animation.  Program some additions to an animated solar system.  Use OpenGL commands to generate transformations that control the animation.

What to hand in:  Make a directory called Solar  in your home directory, also called the Math155A storage directory to hold your turned-in assignment.  (Your Math 155A directory on ieng9, under Class Resources, not your "My Documents" folder).  The file modification dates will serve as a time stamp so we will know files have been turned in on time.   Place in that directory, all your source files and project files (including .sln and .vcproj files).   Your folder should be named exactly "Solar" with that capitalization.  Do not name it anything creative like "Project1"!
    Grading will be personalized and one-on-one with the TA, Jefferson Ng, or with Sam Buss.  Your program must run on the PC lab, you must come into the PC lab and meet one of us.  You will have to show your source code, run the program, possibly make changes on the spot to your program and recompile as requested by the grader, and be able to explain how your program works and why it renders what it does.
Your files should be complete and the project must recompile in your home directory.   This grading MUST be done by Wednesday, May 4, and we prefer that it be done earlier.  If too many people procrastinate on getting graded, not everyone will have time to be graded!


1. Downloading files for Project #2.  Download the Solar program from the zip file  Extract these into a directory named Solar in your home directory.   It is the same as the Project #0 program, but since you changed the Solar program in Project #0, you should download it again to make sure you have the right version.

2. Understand the code in the Solar program. Compile and run the program.  Test out the keyboard controls.  When the program first starts, aliasing causes the planet to appear to not be rotating, but instead always keeping the same face to the sun.   Slow down the animation (up/down arrow keys) to see the "true" motion.  Figure out how the animation code works.  Understand what was meant by  "aliasing"  three sentences ago.
    Understand the interrupt-driven style of the program, and how the keyboard controls are handled by the program, and when drawScene is called..

3. Convert the sun to be a binary star.  Replace the existing single sun by two smaller suns that rotate around each other in the center of the solar system.  Give them a fairly high orbital rate.

4. Add another planet ("Planet X") with two moons.

5. Give the Earth's moon a satellite of its own.   This should be a small "moonlet" that orbits the Earth's moon four times every month.

6. Adjust the orbital radii, the orbital rates, view distance and view angle, etc. Make changes to the viewing distance, the viewing angle, and to the sizes of the suns, planets and moons and to the radii of the orbits, so as to make viewing the solar system convenient.  This probably includes placing the view point further away from the solar system to reduce the excess perspective.  You may need to adjust the field of view argument to gluPerspective.  Choose colors that make all planets and moons clearly visible and distinguishable.

7. The 40 degree tilt.   Give the Earth and its moon and moonlet a 40 degree tilt.  The kind of tilt is similar to the somewhat smaller tilt of our real earth that causes the earth to have seasons. The orbital path of the Earth should not be tilted; instead the tilt just applies to the orientation of the Earth and to the path followed by the moons.  Thus the tilt should always be in the same direction (in the direction of the positive x axis, for instance): it should not always be tilting at the same angle relative to the sun. 
     The orbits of the Earth's moon and its satellite should be tilted by the same amount so that they are always above the equator of the planet.  That is to say, the centers of the Earth, the moon and the moonlet are co-planar and rotation axis for the Earth is perpendicular to this plane.
     The visual effect is that the Earth systems is always leaning rightward 40 degrees.  The orbital paths of the Earth and Planet X should lie in the same plane.

8.  Add a comet in an elliptical orbit.    You have some freedom on the details of how you set this up, but the comet's path should be sufficiently elliptical to take the comet in close to the suns, and out further than the orbits of both planets.    Although the comet must follow an elliptical path, but it is not important that its velocity obeys Kepler's laws.   Extra credit (0.2 points): make the comet (approximately) obey Kepler's law's of motion.

Grading:  Grading will be on a scale of 1-10.  The extra credit can add at most 1/5 of a point to your grade.