Colliding Balls

The first step is to get ball objects to properly bounce off of the walls.

Then we added a calculation of the intersection of the relative path of one ball with respect to the other with a circle equal to the sum of the two radii. We made the animation "pause" momentarily at the intersection point.

Finally we added the equations for the changed velocity after impact. There are still some obvious problems - due to a somewhat subtle bug (not yet fixed)

The equations for collisions between elastic particles can be modified to use the COR, thus becoming applicable to both elastic and partially inelastic collisions as well. Note that these equations give the velocity change along the line of centers. The transverse velocities are unchanged.

V_{1f}=\frac{(C_R + 1)M_{2}V_2+V_{1}(M_1-C_R M_2)}{M_1+M_2}
and
V_{2f}=\frac{(C_R + 1)M_{1}V_1+V_{2}(M_2-C_R M_1)}{M_1+ M_2}

where

V1f is the final velocity of the first object after impact
V2f is the final velocity of the second object after impact
V1 is the initial velocity of the first object before impact
V2 is the initial velocity of the second object before impact
M1 is the mass of the first object
M2 is the mass of the second object

Reference: Coefficient of Restitution, Wikipedia article

Because there were bugs in our original code for transforming to and from the "line of intersection" coodinate system, we tested just the part where we transformed coordinates - but without actually changing velocity. Ideally, there should be no change (or interaction) between the balls now.


Maintained by John Loomis, last updated 5 April 2008