**Problem**

Two spheres with radii and , masses and , velocities and located at and collide. Considering a coefficient of restitution find the velocities after the collision! Assume planar 2D collision.

**Data**

– , , ,

– , , ,

–

– ,

**Solution**

First let us calculate a vector from the center of the first sphere to the center of the second and normalize it:

Collision occurs if the spheres are in contact

and if the projections of the two velocities onto the normal direction such that their difference is positive. We calculate the projection via dot product and establish the collision criterion as:

The contact point is at

A tangent vector to the surfaces of the spheres from the contact point is .

We now decompose the velocity vectors into normal and tangential directions

During the collision the tangential components are preserved

In the normal direction, the momentum is conserved

The coefficient of restitution , is the ratio of the final to initial relative speed between two objects after they collide. It normally ranges from 0 to 1 where 1 would be a perfectly elastic collision.

Thus, we end up with a system of equations

The solution is

Finally, the velocities after collision are

In the billiards case, where the spheres have equal mass, only one sphere is moving and the collision is perfectly elastic (, , ) the equations simplify to:

**Example in MATLAB**

```
%
% Coefficient of restitution
%
eps=1;
%
% Define Sphere 1
%
u1=[1;1];r1=[0.7;1];R1=1;m1=1.3;
%
% Define Sphere 2
%
m2=1;u2=[-1.4;1];R2=2;th=35/180*pi;
r2=[r1(1)+(R1+R2)*cos(th);r1(2)+(R1+R2)*sin(th)];
%
% unit normal
%
n=(r2-r1)/norm(r2-r1);
%
% unit tangent
%
t=[-n(2);n(1)];
%
% Contact point
%
rc=r1+R1*n;
%
% velocity components in the normal direction
%
u1n=dot(u1,n);
u2n=dot(u2,n);
%
% velocity after collision in the normal direction
%
v1n=m2/(m1+m2)*((m1/m2-eps)*u1n+(1+eps)*u2n);
v2n=m1/(m1+m2)*((1+eps)*u1n+(m2/m1-eps)*u2n);
%
% velocity after collision in the tangential direction
%
v1t=dot(u1,t);
v2t=dot(u2,t);
%
% velocity after collision
%
v1=v1n*n+v1t*t;
v2=v2n*n+v2t*t;
%
% plot the result
%
hold on
circle(r1(1),r1(2),R1);
circle(r2(1),r2(2),R2);
quiver(r1(1),r1(2),u1(1),u1(2),0,'-r')
quiver(r2(1),r2(2),u2(1),u2(2),0,'-r')
quiver(rc(1),rc(2),n(1),n(2),0,'--b')
quiver(rc(1),rc(2),t(1),t(2),0,'--b')
quiver(r1(1),r1(2),v1(1),v1(2),0,'-g')
quiver(r2(1),r2(2),v2(1),v2(2),0,'-g')
axis equal
grid on
hold off
function h = circle(x,y,r)
th = 0:pi/50:2*pi;
xunit = r * cos(th) + x;
yunit = r * sin(th) + y;
h = plot(xunit, yunit,"black");
end
```