Snooker Balls


Every young boy whose seen snooker on the telly, would have felt the calling. Who hasn't seen those brave players and thought to themselves: 'I want to be a fighter pilot'. Not many I'll wager.
The occasional oddball would have thought: 'When I grow up, I want to be a computer programmer and write a simulation of colliding snooker balls.' If this sounds familiar, then this page is for you.


So, here's the maths. The two balls on the left have just collided. The blue one was traveling down, and the red one was moving upwards ( a and b vectors). At the collision, each sphere feels an impulse from the other one. Both impulses are equal in size, and exactly opposite in direction (Green line). The impulse vector is perpendicular to the contact surface of the two balls. Which basically means that it is along the line from the centre of one sphere to the center of the other.

The magnitude of this vector is obviously going to depend on the speed of the impact, the mass of the spheres and how direct the collision was.

Firstly, define some variables:

    points:  s1, s2
    vectors: a, b, c, d, impulse, impact
    floats:  ImpactSpeed, mass1, mass2

The speed of the impact is easy to calculate. The speed we're interested in is only that along the line of impulse. So first calculate the difference between the impact velocities and the impulse vector:

    impact  = b - a
    impulse = normalise(s2 - s1)	
Now, to calculate the component of one vector along another, we take a dot product:

    ImpactSpeed = dotproduct(impact, impuse)
Note: This is an unnormalised dot product. You do not divide by the magnitude of the vectors, so no square root is required.

Now, the impulse is multiplied by the impact speed and the masses:

    impulse = impulse * square_root(ImpactSpeed * mass1 * mass2)

and the impulse can be applied to the initial velocities to get the resultant velocities:

    c = a + impulse / mass1
    d = b - impulse / mass2