A summary of my programming assignment. The source file for the main animation is available: motion.c, as well as the executable

Part 1: Reading in Motion Capture Data

My program is capable of reading in specific files in .bvh (Biovision Hierarchy) format, with certain restrictions: I assume that all limbs are fixed length (or remain attached) (i.e. there are no translational components), except for the root node, which is allowed to translate. I also assume that all joints can make rotations, and that these rotations are Euler angles, and in zxy order (which they were for the 4 files I looked at the most). The bvh file should be given as a command line argument.

I wrote several files that helped with this. They are:

Part 2: Displaying the Data

My program used OpenGL do display the motion. I represented all of my limbs as sticks, with orange boxes at the joints, and lavender spheres as the end effectors. I made little effort to control the frame rate: using certain parts of the program features seemed to eliminate the need for this (at least on the cool Intel machines in 1351 and 1363). The user can pause the animation by clicking the left button in the window. Once the motion is paused, the user can then use the middle button to go back one frame, and the right button to advance one frame.

The sequence always looks at (using gluLookAt()) the root node of the image. The user can choose to pan and tilt the camera around the figure (4 and 6 on the keypad to pan, 2 and 8 to tilt). The user can also zoom in by hittng +, or zoom out by hitting -. The user may return to the default view by hitting 5.

Part 3: Computing the Forward Kinematics

The program computes the forward kinematics of the end effectors. It does this by using the transformation matrices provided by OpenGL, and caching them. To view the end effectors, the user need hit t (for toggle end effectors, obviously). To stop viewing end effectors, hit t again.

Part 4: Convert to Quaternions

There is an option to view all rotations as quaternions: the user needs to hit q to begin this feature.

Part 5: Compare Interpolation

The user can also compare the view the motion using interpolation of angles. The user must first specify a start frame by hitting s, and then an end frame by hitting e. To view the effects of interpolation, the user should hit i. Interpolation done using slerps for the quaternions, and linear interpolation for the Euler angles.


User interface summary
Key Effect
Camera Control
4 Pan left
6 Pan right
8 Tilt up
2 Tilt down
5 Restore original view
+ Zoom in
- Zoom out
Quaternions, end effectors, and interpolation
q Use Quaternions
s Beginning frame for interpolation
e Ending frame for interpolation
c Clear beginning and end frames
t Toggle viewing of end effectors
Frame Advancement
Left Mouse Pause (or restart) the animation
Middle Mouse Rewind animation one frame
Right Mouse Advance animation one frame

Available Files
motion.c OpenGL program to display the motion captures
Bone.h, Bone.c File for the bone hierarchy
BVH.h, BVH.cUsed to read in a bvh file
MCWString.h, MCWString.c Parsing the file
Vector.h A 3D vector
quaternion.h, quaternion.c Quaternions
motion.dsw The visual C++ workspace file