CSE 480/580  PROJECT #2
                              =======================
                Online submission by midnight         Friday, Mar 30,  2001
                 Hard copy due in class next day      Tuesday, April 03, 2001
===============================================================================

        This project introduces you to
                (1) Graphic User Interface design
                (2) 3-D Hierarchical Model
                (3) viewing, modeling, projection and viewport transformation

THE PROBLEM
===========

Part I  Building a Tin Man
--------------------------

In this project, you are going to build a 3-D model of Tin Man, a
robot constructed mainly by cylinders and balls of different sizes and
orientations. We will use a  hierarchical object model to represent
Tin Man. The various parts of Tin Man form the following hierarchy:
 

                                --       torso      (root)
                             /              |             |             |       \
                          /                 |             |             |        \
                       /                    left      right     left      right
                    /                     upper  upper upper  upper
                neck                 arm       arm   leg       leg
                  /                           |            |          |             |
                /                             |            |          |             |
               /                              left      right   left      right
             head                      elbow  elbow knee  knee
         /      /      |   \                    |              |           |           |
       /      /        |    \                  left       right     left        right
    /        |         left  right        lower  lower   lower   lower
nose  mouth eye  eye        arm     arm       leg        leg
trunk                                        |            |              |             |
   |                                              |            |              |             |
 nose top                              left        right      left       right
                                             wrist      wrist     ankle   ankle
                                                |                |              |             |
                                                left        right         left      right
                                                hand    hand         foot     foot

In the above tree, the link from a child to its parent denotes
"connectivity".  Thus, a child is connected to its parent in the
model.  For example, in the fist level of the tree, neck, left upper arm,
right upper arm, left upper leg, right upper leg are all connected to
torso; in the second level,  head is connected to  neck, and so on.

We have designed the hierarchy in this way to facilitate modeling
movements of the body-parts of Tin Man.  Moving a body-part also
requires moving all parts that are its descendents in the tree. For
example, rotating the upper left arm would also rotate the following
parts: left elbow, lower left arm, left wrist and left hand.  Your
implementation should take advantage of the hierarchy as much as
possible to efficiently and elegantly model Transformations on Tin Man
(your grades will be based on this also). It is also advisable to use
OpenGL display lists (see Programming Manual).

All the parts of Tin Man--except eyes and nose top, which are
spheres, and mouth which can simply be a line or curve--can be modeled
as cylinders.  For cylinders and spheres, you are *not allowed* to
call a higher level function such as gluCylinder to create them
directly. Instead, you are asked to create them bottom up as polygonal
meshes using the OpenGL primitives for drawing polygons, lines, and
points.

The above hierarchy is only a general guide line. You can come up with
your own model as long as you can make your Tin Man more realistic.
For example, you may want to add fingers to Tin Man or model elbows by
a more complex object to smoothen the connection between the upper and
lower arms, or to make movements appear smoother, actually create two
models for each body-part--a more refined model to display it when it
is still and a less complex model when it is moving.  The enhancements
that can possibly be done are quite unlimited.  We encourage you to be
creative within the following bounds: whatever you do, the primary
concern should be to enhance realism of the tin man, and the work you
put in should be commensurate with the grade-weight for this project.
Don't over do it, especially at the expense of other academic work!

This project also shows you aspects of interactive computer graphics.
The user can change the view of the Tin Man and do some operations of
the body parts of the Tin Man through its GUI (Graphical User Interface).
For your GUI design, please follow the style in the  given GUI to get  15 extra
credit points or you could use a pop-up menu for which there will be no extra
credit points.
 

Part II  Viewing Navigation
---------------------------

The following description is based on the given GUI .
Suppose we have such a fixed coordinate system with x axis horizontal to your
right, y axis directly upward and z axis horizontal toward you. The Viewing
Navigation Buttons will make it possible for the user of your program to orbit
the "camera" around the Tin Man, which you build at the origin. This part is
shown in lower left window "Camera View". In the following, the "Rotary
Button" is similar to the dial on the radio.

(1) Rotary Button Y
This button let the user rotate the camera around y axis. Specifically,
The user can click on a point in the mouse and drag the mouse to the right,
the camera will rotate around Y axis to the right of the scene; Similarly,
clicking on a point in the mouse and dragging the mouse to the left will
rotate the camera around Y axis to the left of the scene.

(2) Rotary Button X
This button is similar to Rotary Button Y, except that it is put vertically and
if the user click one point on the button and drag the button upward, the
camera rotate upward around the X axis.

(3) Rotary Button Z
Clicking and dragging the mouse on this button will rotate the camera around
the Z axis. Specifically, clicking on a point in the button and dragging the
mouse, the camera will rotate clockwise around the Z-axis if the drag is
towards right and will rotate counterclockwise if the drag is towards left.

(4) Zoom Button
If the user click the left or right part of Zoom Button, the camera moves
toward or away from the scene.

(5) Reset
The Reset Button let the user to undo all the camera rotations along X, Y
and Z axis and Zoom operations if any. That is to say, the camera will restore
to the original position when the program is first started.

Note that to make it easy to debug, for part II, you can just build
a simple 3-D object such as a cube to test if this part of your program
functions correctly.
 

Part III Object Manipulation
---------------------------
 

The GUI components for this part are shown in the top menu and in the
lower window "Object Rotation" and "Object Translation".  You should
also allow the user to select one part of the tin man and do the
translation, rotation, deletion.

(1) Object Selection

The user should select which part of tin man he/she intends to do the one of
the following object operations by mouse-clicking the intended part or by using
pop-up menus to select the intended part.
Some  parts of Tin Man might be hidden by its other parts in some situations, for
example, when left or right hand side of Tin Man is toward you. You
have to make sure the most front part of Tin man is selected in these
situations. You are advised to use Z-buffer algorithm or ray tracing for this purpose.
You are not allowed to use OpenGL function "glUnproject".

(2) Delete and Undo Delete

The user can delete the part selected. Note that both the part selected and
all parts connected to it as its descendents should be deleted. The user can
also undo the last delete operation.

(3) Object Rotation

Rotary Button X, Y and Z are responsible for rotating the selected part of Tin
Man around X, Y and Z axis respectively. Note that both the part selected and
all parts connected to it as its descendents should be rotated together.
Clicking on a point in the Button Y and dragging the mouse to right will rotate
the selected object/objects in the same direction around Y axis. Dragging the
mouse in the reverse direction should make the rotation also reverse its
direction. Rotary X works in the similar way. For Rotary Button Z, clicking
on a point in the button and dragging the mouse, the selected object/objects
will rotate clockwise around the Z-axis if the dragging is towards right and
will rotate counterclockwise if the dragging is towards left.  Clicking the
reset button will undo *all* the rotations done on the selected object since
its selection.
 

(4) Object Scaling

If the user select the cylinder part of Tin Man, clicking Rotary Button R
will change the radius of the cylinder (you can choose either side of button
for enlarging, the other for shrinking). Clicking Button L will change the
height of the cylinder part.  If the user select the sphere part of Tin Man,
clicking Rotary Button R will change the Radius, clicking Rotary Button L will
have no effect. Note that in this operation, the selected part will not
include its descendents. To complete scaling of a part, you have to first
translate it back to origin, scale it and translate back to the proper
position. The descendents might also need translation to accommodate the new
size of scaled part.  Clicking the reset button will undo *all* the scaling
done on the selected object since its selection.
 

At last, Button "Quit" will let the user quit the program. if the user clicks
Button "Home", the Tin Man and the camera will restore to the state when the
program is first started.
 

EXTRA CREDIT
=============
1. 15 extra credit points for using a GUI interface.
2. For making your tin man more realistic.
3. 10 extra credit points for using mouse-clicking for object selection.
4. Anything else that you think may deserve extra credit in your project. This must
     be mentioned in your technical report.
 

The following information is regarding submission and technical report.

****** Please add your username on the front page of your project report ****
 

HOW TO SUBMIT
==============

HEADER BOXES:
--For all projects, the following information is REQUIRED to be in a comment
header box within the code of your program.

(1) Title "cse480 project2" or "cse580 project2",
(2) Your Full Name,
(3) Person No..
(4) Where Compiled,
        tell us what architecture you compiled your program under, or
        else on what machine. (For example: SPARC, sun4, lictor, SunCluster,
        MIPS, hadar, armstrong.)
(5)Workstations Used,
        tell us EXACTLY the type AND location of all the
        workstation set-ups that you KNOW your program will run
        correctly on. (For example: Sparcstations in Bell 338,
        X Terminals in Bell 338, Sun workstations in Bell 226 etc).

If you do the project at home on Linux/Windows, you should make sure your project
runs on CS machines.

ONLINE SUBMISSIONS:
-------------------
As mentioned in the project descriptions, you must, by midnight of the due
date, submit online your source code file(s).
If you are in CSE480, you can submit  by running:

                submit_cse480 <file1> <file2> ... <fileN>

If you are in CSE580, you can submit  by running:

                submit_cse580 <file1> <file2> ... <fileN>
 

We will compile and test-run your programs.  Any special information
we need to know should be provided, for example, if you use different
compile command than the one described above, you should specify
clearly within the header box.

Please ensure that the version of your program, which you submit, does
actually compile and run. If you add comments after you get the
program working, recompile the commented code before you submit it.
The submit_cse480 and submit_cse580 programs will accept new versions
of file. So if you submit a file, and then make changes to it, you may
resubmit it, and the new version will replace the old.
 

HARDCOPY SUBMISSIONS: (NON-CODE SUBMISSIONS)
--------------------------------------------

You are required to hand in a hard copy of your Technical Report of the
Project on the due date for hard copy submission. Note that you are not required to
submit hardcopy listings of your programs. Staple one cover sheet, of some
description (either a header page from comxps, harpo or chico, or a sheet you
generate yourself) on the top. On the header page, you should include the
usual information such as your name, course number, etc.

You are strongly encouraged to typeset your Technical Report. Programs that
you can use to do this include TeX, LaTeX, FrameMaker, IslandWrite and
ditroff. If you cannot typeset (for some reason??) then the report is required
to be typed. No handwritten reports will be accepted (except for drawings /
diagrams).

TECHNICAL REPORT
================

TECHNICAL REPORTS: What is Expected?
===============================================================================

This  is a graduate level  class  in  Computer Science,  where competent
technical writing skills are expected.
 

THE STRUCTURE OF YOUR REPORT
============================
Your  report should contain the User Manual as described below.

The User Manual:
Computer Graphics is  inherently a very  interactive  application  area.  User
Manuals,  therefore have a  great impact  on   user efficacy in utilizing  the
features of your  program.  Write the  user manual  at  the level of a  novice
user, in a manner that one can  sit down with  it at  a terminal and  run your
program.  Describe all features and options of your implementation.  Criterion
for what belongs here -- what is needed to effectively use your program?

Also write down in a separate section of your report, the features
that you think should qualify you for getting extra credit.
 

CITATIONS
=========
In this class, the concern of the instructor is primarily to teach the
concepts of computer graphics,  not  programming.  Therefore, it  is perfectly
acceptable to use pieces  of code in your  project that have  been taken (even
verbatim) from published literature.  However, you MUST  CITE these sources in
your technical report.  Otherwise, it is  plagiarism.  If  you take ideas from
published literature and improve upon them, cite the sources  and explain your
adaptation of those ideas to this project.   Use standard methods of technical
citation in your technical report.
 

INTRODUCTION and CONCLUSION
===========================
Every  technical report    must have  an   introduction   that briefly
describes what the project is all about.  (Please do not reproduce the project
description here).  Mention highlights  of your program, if  any, like special
user-friendly features, or   efficiency properties.   The  conclusion   should
contain  any   thoughts you may have  about   your current implementation, and
suggestions  for possible  future  enhancements and  modifications.  Write the
conclusion as if you were a critic of your own program and design.
 

LAST WORD
=========
Please spend some effort in producing  the  technical report.  Make it
worthy of  publication.  Check for spelling  and grammatical errors;  use text
formatters  and/or    type-setters.  Nothing pleases   graders  more than good
presentation.

End of Project #2 description.