Homework #3: Constraints

The goal of this project is to introduce constraints in a dynamic system. A bead is placed on a wire and is constrained to move on a circular wire under the influence of gravity. The basic approach is to solve for a constraint force that when added to other forces on the bead, maintains the constraints. The constraint I used was C(x) = 0.5 * ( xx - 1). All forces are calculated in local coordinate frame where the ring lies at the origin in the x-y plane. To constrain the bead to the plane of the ring I set the z-component of the constraint force to the opposite of the z-component of the external forces acting on the bead. I also used feedback to control numeric drift.

The correct behavior for the bead in this simulation is to oscillate back and forth. I have added a dissipation force that causes the bead to come to rest. By rotating the ring it is possible to accelerate or decelerate the bead. Care must be taken to choose an adequate time step. If it is too large, the simulation can blow up, as shown in the following figure.


This project was built on top of the code for the last project with very few modifications.

Source code and executable (64K)
Qt and GLUT DLLs (1.5M)