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:
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.
n%m
is n-((int)(n/m))*m
where, in the latter formula, m
and n
are float's (or double's).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.