Math 155 - Computer Graphics
U.C. San Diego - Winter 2001

Programming Assignment #2
A more complex solar system.

Due date: Monday, January 29 (Midnight).

This assignment is a continuation of the Solar demo assignment.   You will use your Solar program from the first assignment and modify it to include a new planets and more moons, with more complicated rotations.  If you prefer you may modify Buss's SolarSolnA program instead (source code available approximately January 25, or earlier upon request).

1.  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).

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

• Make Planet X revolve around the sun at a rate different than the earth, so that it has a different length "year".  Also, make it rotate on its axis 20 times per "year" (20 times per one revolution about the sun).
• Give one of the moons a geostationary orbit; i.e., it stays in a fixed position above the new planet, keeping up with the rotation of the planet.
• Give the other moon a retrograde orbit, so that it rotates backwards, i.e., revolves around Planet X in the clockwise direction when viewed from above.
• Give the other moon a different orbital rate from the Earth's moon.   (I suggest a faster orbital rate).
• For full credit, give Planet X and its two moons a 45 degree tilt. See below for information on the tilt.

3. 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.

4. The 45 degree tilt. The assignment can be done without this part, but for full credit you should include this. The kind of tilt is similar to the somewhat smaller tilt of the earth that causes the earth to have seasons. 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.

A sample solution, showing the desired behavior is available as SolarSolnB in the public folder (P:).

Homework turn-in instructions. You will need to turn in

• An executable file and source files, plus any supporting files (if any) needed to run the program.  The files must be in a C++ workspace on the PC lab computers so that it can be run immediately by the TA or I when grading the code.  We will again do the grading in individual appointments.
• All files must be in the directory H:\Projects\Solar.  (On the Unix system insci14, this is Projects/Solar in your home directory.)  In particular, the source files must be in this directory, so that we can verify you completed the assignment in time.
• Be prepared to answer questions about your code, to explain how it works, and to be able to make modifications to the source code during the grading session if so requested.
• After the due date, do not modify any of your turned-in files.

This assignment is covered by the usual academic integrity guidelines for programming assignments.