Computer Graphics Programming Assignments

Assignment 1


Assignment 2


Assignment 3


Assignment 4

You have a choice. Choose either A or B below:

A) Case Study 3.5 Part 3. This program involves drawing logic gates as explained in the Case Study. The user should be able to choose either a NAND or a NOR gate (a keystroke choice), an orientation (a keystroke choice), and a size (keystroke choice). The program should then draw the appropriate gate centered on the mouse position (left click). A new series of keystrokes followed by a left click should cause a new gate to be drawn. Do not erase the screen between drawings (i.e. the screen will eventually contain several gates of different types and various sizes and orientations.)
Hand in:

Send as an attachment to email

B) A variation on Case Study 3.8: Create a program which draws both Epicycloids and Hypocycloids. On each successive click of the mouse, the screen should be erased and a new figure drawn. The program should draw either an epicycloid or hypocycloid depending on whether the left or right mouse button is pressed. If it is the left button, a new epicycloid should be drawn with the a/b taking on successive values of 1, 2, 3, 4, etc. with each successive left mouse click. If it is the right button a new hypocycloid should be drawn with a/b taking on successive values of 1, 2, 3, 4, etc. with each successive right button click. The user should be able to alternate between left and right buttons and get the appropriate next epicycloid or next hypocycloid (i.e. keep a state variable to determine the current a/b ratio for each type of curve). Keep the size of the objects (either epi or hypo cycloid) constant, i.e. keep a constant sized bounding rectangle. If the user presses a key on the keyboard (anykey), the program should exit.

Send as an attachment to email


Assignment 5

Do Case Study 4.1. This is well described in the textbook and needs no further elaboration. Email me a zip file with your executable file (and any auxiliary files you may need such as a data file, etc.)


Assignment 6

Do Case Study 4.4 from the textbook. Create a data file which contains the pillars using the format you developed in Assignment 2. Include 3 or 4 pillars. Allow the user to specify the starting point of the ray and it's direction with two successive left mouse clicks. The first click establishes the starting position, the second click will give a direction when used in conjunction with the starting position.

So that a user can see the process unfold in this simulation you must slow down the drawing of the reflections. There are two main options. You may use the "sleep" function call to pause (for perhaps 0.5 sec) after drawing each successive reflection. Or, you may use a keystroke or mouse click to permit the simulation to draw the next successive reflection. Be sure to explain your method to the user in a README file.

Email me a zip file containing


Assignment 7

Case Study 5.7 from the textbook.

Email me a zip file containing:


Assignment 8

This assignment is a variation on Case Study 6.1. You are to complete Case Study 6.1 with the following changes:

Upon opening, the program should display the first mesh file which will be called mesh1.3vn. When the user presses enter, the program should display mesh2.3vn and when enter is pressed again, mesh3.3vn should be displayed. A final press of enter should end the program.

I will select 3 of the mesh files and rename them mesh1.3vn, mesh2.3vn and mesh3.3vn. They will be in directory c:\temp.

Send me a zip file as an attachment to email with your executable. I will unzip and run it from c:\temp

Extra credit. If you would like extra credit on this assignment (up to 50 points extra) add Case Study 6.10 parts a and b. It uses Case Study 6.1 but asks you to create a couple of geometries. Create fhe files truncube.3vn and buckyball.3vn and include them in your zip file. Your executable should display 5 objects (the original 3 followed by the two new ones): mesh1, mesh2, mesh3, truncube and buckyball.. Some assistance on the truncated cube is at http://mathworld.wolfram.com/TruncatedCube.html and for the buckyball at http://mathworld.wolfram.com/TruncatedIcosahedron.html If you can finish only one of these it is worth up to 25 pts.


Assignment 9

This assignment is essentially Case Study 7.1 which is to "fly" the camera around a teapot. It differs in only the following ways:

  1. You only need to include the teapot. You may include more objects if you wish, but only the teapot is necessary.
  2. You must give the user a key to get him back to the initial view of the teapot. This is needed since if a user "flies" erratically s/he could lose the teapot and have no idea how to return.
  3. Include documentation that explains how to use the keys to navigate his/her "airplane".