Prediction of Hard Disc Collision Time and Position

It is fairly simple to calculate the collision parameters by simply iterating the speeds of the particles. It is less simple to determine whether two particles will collide and then compute the time and center positions of the collision. This animation show how to determine parameters that will result in a collision. A collision of hard discs occurs when their centers are separated by the sum of their radii. The initial center posiitons and the initial velocities can be used to to predict when and if two discs will collide. After that the collision position will depend on the time, collTime, needed for the collision to occur. The relative postions relative to each other of the discs are chosen using a random angle 0->2pi. The velocity direction of the discs are chosen using a random angle in the ranre 0->2pi. It should be understood that most of these angles will not result in a collision. Therefore the while loop sifts through the candidates to find a set that will result in a collision. The animation iterates the position as defined by the velocities for the duration of collTime. The average disc speeds are the speed slider value and the speeds vary within a random range of 1.5 around the average; The average radii are the radius slider value and the radius varies within a random range of 20 around the average. The calculations here are an illustration of the use of the quadratic equation solution formula. If the discrimiant is positive then there are two solutions. One of these is where the particles first collide and the other is after the particles pass through each other and touch on the opposite side of the first collision. The learner is welcome to hit the F12 button in Windows to view the Javascript code used.