This applet demonstrates how the JavaPool game calculates the point where the yellow and orange balls will collide. The simulation shows the starting and ending positions (assuming no collision) for both balls as solid circles connected by a colored line. The black outlined circles show the collision point and the position of both balls after the collision. The purple lines show the new velocity vectors for each ball after the collision. Experiment with the simulation by clicking and dragging with the mouse to reposition the solid-colored circles.

The source code.