Math 155 - Computer Graphics - Winter 2001
Programming assignment #1 - Expanded Explanation.

In this assignment you will learn to use the computers and the Microsoft Visual C++ compiler, and will modify the Solar program so that it uses better animation controls and supports a "single-step" mode. 

Due date: Wednesday, January 17.

Academic integrity guidelines: You are expected to do your own, individual work.  We will not have team projects in this course.  For more details, see the academic integrity guidelines.

For this assignment you should do the following:

  1. Learn how to use the APM lab computers and the compiler.  Follow the instructions in the Solar Demo instructions.  You will probably also want to become familiar with the elementary uses of the debugging environment in Visual C++; namely, how to set breakpoints, examine variables, and single-step through your program's execution.  You insert breakpoints by right-clicking on a line, or using the F9 key.  When a program is executing, you may use the debug menu to step through your code: note that F10 and F11 are useful shortcut keys.  Variables can be examined or even changed in the two windows at the bottom of the screen in debug mode.
  2. Modify the animation controls to use floating point numbers instead of integers, so that you have finer control over the animation speed, and can run the animation with time increments less than 1 hour.  Fix the animation so that the moon does not move jerkily.
  3. Add a "single-step" mode to the animation.  The user types an "s" to enter single-step mode, and each time "s" is pressed, the animation is advanced a single time step.
  4. You should observe the effects of aliasing.
  5. The final result should be source code that is easily examined and an executable that can be easily run to demonstrate the functionality of your code.

More details:

Smoothing the animation:  There are several problems with the animation in the Solar demo as currently written, these are mostly due to the fact that the author of the program used integers to control the speed of the animation, and further his implementation was poorly done and causes the moon to move in jerks rather than moving slowing.  You can see these problems by slowing down the animation until it almost stops (it might help to make the window larger so as to slow down the execution speed of the animation). 
    You are asked to fix these problems by converting the program to use float's instead of int's for the variables that control the state of the animation and the speed of the animation.  For this, you do not need to understand the details of how OpenGL uses rotations, but only that the variables TimeOfDay and DayOfYear are used to position the planet and the moon; and that AnimateIncrement is used to control the rate at which these variables change.  Note that AnimateIncrement is equal to the number of hours between each frame displayed in the simulation.  This will require various changes to the code --- the code should not get much longer, only different!  The changes are however a little tricky since you may not have coded this kind of functionality before.
    Your code should support the following:

Some technical issues that will come up as you smooth the animation.

Single-step mode: This allows the user to use the "s" key to enter single step mode.  If the animation is running, it is stopped.  Then each time "s" is pressed, the simulation advances a single time step.  You should add a new function Key_s to process these key strokes.  Examine the existing C code to see how to do this glut function calls.

Aliasing  The term ''aliasing'' refers to visual artifacts caused by the digitalization of image displays.  In this Solar demo you will see several examples of aliasing.

In your programming assignment does not need to address aliasing issues, except that you should observe and try to understand the aliasing that is present.

Demo solution:  Professor Buss's solution to this homework assignment can be found in the public P: folder in SolarSolnA.   You may run this program to see the desired functionality.

Turn-in procedures.  You do not need to actively turn in your program.  Instead, I will ''ls'' your directories to record the fact you have stopped modifying your program, and we will set up times for you to demo your code and its functionality to the TA.  You should not modify your code or recompile or anything after the due date.  The source code must be easily readable (no bad problems with line spacing, or overly long lines) and your C++ project workspace must be already setup so that we can easily run, or modify and run your code.  The grading will be done individually in appointments with the TA.