CS 490 Human Motion Simulation

Philip Yen, Spring 1998


The goal of this project is to try and simulate human motion with a dynamically realistic model. Essentially, this requires two components, a human model capable of moving like a real human, and an animation model that naturally simulates human motion. This project is implemented using OpenGL for Windows NT/95. The project is written entirely in C, without using MFC for simplicity's sake, instead taking advantage of OpenGL's built in WGL functions for Windows interfacing.

The Model

For familiarization with OpenGL, a simple human model was created with 16 degrees of motion, providing for rotation at the shoulders, elbows, neck, back, hips, knees and ankles (in some cases along multiple axes). Appropriate limb length ratios are observed to make the model appear natural, though the arms seem slightly shorter than normal, due to the lack of hands. In order to better simulate the curvature of the spine, the back is split into two segments, rotated simultaneously. More segments were considered, but they added considerable work later when calculating positions based on joint rotations.

The model is a simple human skeleton built with low resolution cylinders and a 2-D circle for the head, all modelled hierarchically for proper limb movement. Each of the joints is limited to be capable of rotating only within a realistic human range. For example, the neck will only tilt forwards and backwards in a 90 degree range, from -30 degrees to 60 degrees.

This results in a fairly realistic representation of human motion, provided the limits are reasonably set.

The Method

In order to animate the model, some form of inverse kinematics is required, since the destination position and current angles are specified. The algorithm solution provides the angles required to reach the destination. Essentially, we are calculating the angles required, given the destination, as opposed to specifying the angles and calculating the final destination, which is foward kinematic.

The inverse kinematics are solved using a Jacobian matrix based approach. Basically, a Jacobian Matrix relates the changes in angle to the changes in position through the use of partial derivatives, so that the change in a given angle can be calculated from the changes in positions and the inverse of the Jacobian. In cases where the Jacobian is not nonsingular (i.e. square), the pseudo-inverse can be calculated, but, for the sake of simplicity and code reusability, all of the matrices in the code are chosen to be 3x3, limiting the model to 3 joints The process, as taken from the project code, is as follows:

// choose joints to move based on absolute position of cursor

	// set angles from inputs -- convert degrees to radians for trig fcns

	// find position from current angles; 
	// n.b. trigonometric equations formed by hand for each case and hardcoded

	// form jacobian [J] =  [Ja Jb Jc] <= [d(x0)/d(theta1) d(x0)/d(theta2) d(x0)/d(theta3)]
	//			[Jd Jd Jf]    [d(y0)/d(theta1) d(y0)/d(theta2) d(y0)/d(theta3)]
	//			[Jg Jh Ji]    [d(z0)/d(theta1) d(z0)/d(theta2) d(z0)/d(theta3)]
	// n.b. All partial derivatives calculated by hand and hardcoded

	//			  [deltax/n] 
	// find a small delta r = [deltay/n] e.g. a small portion of original difference
	//	        	  [deltaz/n]

	// while still too far away (but within reach of current limbs) calculate jacobian and 
	// solve for inverse of matrix using cramer's rule: ie J-1 = adj(J)/det(J)

	// calculate determinant of [J]
	// n.b. if det = 0, there exists no inverse...

	// inverse of [J] is (1/det)*adj(J)

	// straight matrix multiply, 	[    	][deltax/n]   [dtheta1]  , i.e. dtheta = J*r
	//			 	[   J-  ][deltay/n] = [dtheta2]
	//			 	[	][deltaz/n]   [dtheta3]
	// thus new_theta = theta + dtheta ( a.k.a. +=)

Model Implimentation Details

The Product

Initial 2-D Inverse Kinematics Model:
Initial Human Model:
Human Motion Simulator:


  1. Wright, R.; Sweet, M. OpenGL Superbible. Waite Group Press, Corte Madera, CA, 1996
  2. Graham, A. Matrix Theory & Applications for Engineers and Mathematicians. Ellis Horwood Ltd., Publishers, Chichester, UK, 1979
  3. Korein, J.; Badler, N. "Techniques for generating the goal directed motion of articulated structures." IEEE Computer Graphics and Applications, vol.2, no.9, p.71-81.