# Simulation of bouncing circles

I want to simulate two circles bouncing off one another. For this I am not sure what I need to calculate. I couldn't find any useful information on the internet, so I have thought long and hard about how the velocities would be affected and I think it's a reflection on the tangent of the point at which they meet.

I have the position, velocity and radius of each circle... so can I calculate the tangent?

• I think this would be in better hands at physics.stackexchange.com? Commented Aug 26, 2011 at 9:39
• @joriki: I studied this while doing maths, I think it is appropriate for both sites. Commented Aug 26, 2011 at 9:42
• Have you tried looking up elastic collision of spheres?
– user856
Commented Aug 26, 2011 at 9:47
• I have looked around, everything I found was either badly explained or just useless.
– Luke
Commented Aug 26, 2011 at 9:54
• Sorry, thanks for that link. It's helped a bit... I'll think it over.
– Luke
Commented Aug 26, 2011 at 9:58

The link given by @Rahul has formulas, but I'd like to add a geometric interpretation (and have some answer recorded here). Suppose the circles/spheres are identical: same mass, same radius $r>0$. Let $(x_1,x_2)$ and $(x_3,x_4)$ be the coordinates of their centers. Then the configuration of both circles is encoded by a point in 4-dimensional space, namely $(x_1,x_2,x_3,x_4)$. This point can move freely (with constant velocity) within the domain $U=\{x: (x_1-x_3)^2+(x_2-x_4)^2\ge 4r^2\}$. This is simply the exterior of tubular neighborhood of a line in $\mathbb R^4$. When the configuration point reaches the boundary of $U$, it bounces back just as an elastic point mass would. Indeed, the speed must be preserved by the conservation of energy, and the tangential component of velocity is preserved by the conservation of momentum. Together these two facts imply that the incident angle is equal to the reflected angle. It is not hard to find the equation of the normal vector to $\partial U$ (hint: gradient) and use it to recalculate the velocity of the configuration point after collision.
With $n\gg 2$ circles/spheres we have a game of billiards in a high-dimensional space with a lot of concave boundaries: a good recipe for mixing things up. Hence, the behavior of gas molecules.