CSE 167 - Introduction to Computer Graphics - Fall 2003
Instructor: Sam Buss,  Univ. of California, San Diego

Project #1 - Modify the Solar System Demo by adding planets and moons. 

Due Date: Friday, October 17, midnight.

Late breaking update: the meaning of geostationary has been clarified below.

Goals:  Learn how to use OpenGL and interrupt-driven programming.   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 (or something similar) in your home directory.  (The CSE 167 home 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.   Please in that directory, all your source files and project files (including .dsp and .dsw files).  
    Grading will be personalized and one-on-one with a TA 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 project must recompile in the ieng9 directory.   You will then make an appointment to see a TA to get your work graded.  This grading MUST be done by Friday, October 24, and we prefer that it be done earlier.  If too many people procrastinate on getting graded, not everyone will have time to be graded!

    If you want to work on your home machine or other machine:  OpenGL will run on many environments, including linux, unix and macintosh.  You may do development on other machines, but will be responsible for getting your system to work with OpenGL, plus, you must transfer everything back to the PC lab for grading purposes.  If OpenGL or GLUT is not installed on your machine, you will need to download the header files, library .lib files and dynamic library .dll files.  See the "Graphics resources on the main course web page for help on where to find these.


1. Downloading files for Project #1.  Download the Solar program from the zip file  Fall03SolarProjectZero.zip.  Extract these into a directory named Solar in your home directory.  If you have problems downloading this zip file, you may instead copy the Solar folder from the public directory.   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 it 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 (arrow keys) to see the "true" motion.  Figure out how the animation code works.  Understand what was meant by  "aliasing"  three sentences ago.

2.  Modify the program to give the existing moon a satellite of its own.   The existing planet "Earth" and its moon can keep their current movements.   Add a small satellite to the moon, which revolves around the moon 4 times each time the moon revolves around the earth.  Make the new satellite bright red (still a wireframe sphere).

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

4. Adjust the view distance and view angle, etc. Make changes to the viewing distance, the viewing angle, and possibly to the sizes of the sun, planets and moons and to the radii of the orbits, so as to make viewing the solar system convenient.

5. The 45 degree tilt.   Give the new planet (Planet X) and its two moons a 45 degree tilt.  The kind of tilt is similar to the somewhat smaller tilt of the earth that causes the earth to have seasons. The orbital path of Planet X should not be tilted; instead the tilt just applies to the orientation of Planet X.  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 two moons' orbits should be tilted by the same amount so that the two moons of Planet X are always above the equator of the planet.
     The visual effect is that Planet X and its two moons are always leaning rightward 45 degrees.  The orbital paths of the Earth and Planet X should lie in the same plane.

6. (Extra credit).  Modify the period of the earth.  Modify the animation so that the Earth revolves around the sun exactly once every 365.25 days.  You must be careful that there are not any discontinuities in the position or orientation of the Earth at the end of a year.  In addition, you should design the animation code so that the program will work far into the future and will not ever suffer from floating point overflow problems.  As part of this, clamp AnimateIncrement to avoid underflow and overflow.

Grading:  Grading will be on a scale of 1-8.  These should be interpreted on the following scale:  7-8 is A- to A;  5-6 is B- to B+;  3-4 is C- to C+; 1-2 is D/F.  The extra credit in 6. can add at most 1/2 extra point to your grade.