Compile and run the OpenGL program robot.cpp (you will only
see a gray ground plane).
Run the executable versions to see the end results (and to
make sure you have GLUT installed properly).
robot.cpp contains display routines for all parts of the
robot arm. Roughly sketch each part to clearly show the dimensions. This
will give the local coordinates of each part of the robot.
From the executable version and the robot.cpp source code,
determine how the parts should be connected and what transformations are
necessary to support the given control variables. Sketch out a scene graph
(tree whose nodes are instances of parts of the robot arm and whose edges
represent transformations). The root is the world coordinate system. The
leaves are the primitives such as the unit sphere and unit cylinder. The
edge arrows point towards the parents to represent transformations of the
robot arm parts to the parent object's coordinate system. You can consider
the ground plane as being in the world coordinate system (it can be a child
of the world with the identity transformation).
The user interface that alters the control variables (as
shown in the executable demo) has already been implemented, your goal is
to implement the missing robot arm display routine using the OpenGL matrix
stack. Read chapter 3 in the OpenGL RedBook for more details. The resulting
program should be like the executable demo.
Part 2
Add a movable object to the scene graph (try glutSolidTeapot(0.2)).
It will connect directly to the root node.
Simulate grabbing the object with the robot arm and moving
it around.
We are not concerned with detecting collision between the
fingers and the object; instead, simply allow a press of the spacebar to
enable a mode where the object is anchored to the hands coordinate system.
This means that the object should move with the hand (not necessarily attached
or even anywhere near the hand). When the spacebar is pressed again, the
object should float in its current position and should not be affected
by the movement of the robot arm until the spacebar is pressed again.
We will need the current world coordinates of the teapot
in the coordinate system of the wrist. Use the scene graph to determine
the necessary transformations.
The current transformation of the movable object will have
to be stored and updated as necessary. You may need to use glLoadMatrix,
glMultMatrix, glGetFloatv(GL_MODELVIEW_MATRIX,…).
Turn in your sketches of the local coordinate systems, the
scene graph sketch, and a new robot.cpp with your completed DrawRobotArm
and the modifications to have a movable object.
Extra Credit Options
Easy:
Add reasonable constraints on the motion of each part (need
not avoid self-intersection for all configurations)
Add constraint that the tip of the fingers cannot cross through
the floor (y=0 plane)
Perform some form of collision detection (may be approximate)
so that the object can only be moved when the spacebar is pressed and the
fingers are close to the object
Difficult:
Perform exact collision detection between the fingers and
the object (using geometric intersection tests or image-based methods in
OpenGL)
Add constraint that the robot arm cannot self-intersect
Add textures, shadows, or reflections using OpenGL
Add "through the window" manipulation of the robot arm. The
user should be able to just directly drag a part of the robot (this may
be assisted by glReadPixels and gluUnproject).