Advertisement

Collision between two spheres - new velocities?

Started by February 13, 2002 12:38 PM
12 comments, last by BeanDog 23 years ago
Given I have two spheres of equal mass, and they collide at a given point, how do I determine the velocities of the spheres following the collision? I have vectors that define the spheres positions and vectors defining their velocities and the time of impact. How do I find their post-collision velocities? ~BenDilts( void );
There is a section in LaMaoth''s book "tricks of the windows game playing gurus" exactly on this topic. The section provides the maths and some code - and it works since I''ve tried it out.

Henry
HenryLecturer in Computer Games TechnologyUniversity of Abertay DundeeScotlandUK
Advertisement
Just thought I''d add that the stuff in the LaMoth book is only in 2D. You will need to extend this if you want 3D although 3D is a much more mathematically difficult problem to solve - possibly best doing 2D first.

henry
HenryLecturer in Computer Games TechnologyUniversity of Abertay DundeeScotlandUK
Find the plane tangential to the point of contact. Convert the velocity components into 3 new components, where one of them is a normal to the plane.

Switch that component for between the two spheres, and then convert back to vx, vy, vz.

- seb
Assuming no energy loss during the collision then conservation of momentum ensures a simple solution to the problem. Since the spheres have equal mass then the problem is simpler since the magnitude of their velocities after collision will be the same as before collision. Additionally, and most importantly, the velocity of the centre of mass will not be affected by the collision (this is true even if the masses are different).

Therefore, an easy way to process the reflection is to convert velocity vectors into coordinates relative to the centre of mass of the two objects.

For instance, if two spheres are travelling with velocities V 1 and V 2 then the centre of mass is travelling with velocity

V com = 1/2(V 1+V 2)

and the unit vector in this direction is (pardon the notation please)

v com = V com / |V com|

The component of V 1 in the direction of v com is given by

compVcom V 1 = ( V 1.v com ) v com

and hence the component of V 1 that is orthogonal to v com is given by

V *1 = V 1 - compVcom V 1


After the collision, this component has simply reversed sign, giving the new velocity of sphere1 as

V 1_new = -1*V *1 + compVcom V 1

which turns out to be

V 1_new = 2(compVcom V 1) - V 1


The same method can be used to find the new velocity of sphere2

Have fun,

Timkin

Edited by - Timkin on February 13, 2002 12:44:05 AM
Here''s a very simple, and surprisingly good looking way of doing it that I discovered while making a little 2D string simulator with balls attached to the ends of the strings to make it more interesting. You just swap the velocities of the circles.
I was thinking it''d only work if I did some sort of thing like v1 = v1*0.75 + v2*0.25 and the other way around for v2, but when I tried it it they''d slowly move through eachother. Then I tried the plain swap and they bounce, settle together, and can push eachother around. That is, if you have some sort of damping. Otherwise they''ll just keep flying apart exactly the same way.



-Deku-chan

DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)
Advertisement
Thanks Timkin for the swift and useful reply. Too often people try to look intelligent by offering slightly related answers (I didn''t ask for 2-dimensional collisions, for instance). I''ll attempt to put this into effect after work today.

Thanks again,



~BenDilts( void );
Yea, but you didn''t ask for 3-dimensional neither. And anyway, 2D is a good base to start from, if you want to understand the basics, so don''t be thankless!


Yesterday we still stood at the verge of the abyss,
today we''re a step onward!
Yesterday we still stood at the verge of the abyss,today we're a step onward! Don't klick me!!!
My mistake, I didn''t realize spheres could be two-dimensional.



~BenDilts( void );
Actually, spheres can be n-dimensional... it''s just that in most schools the common usage is for a locus of points in 3 spatial dimensions at a fixed distance from an origin. Anyway...

If you look at my answer carefully, you''ll note that nowhere does it mention the dimensions of the space in which the problem is being considered. Given a Euclidean geometry, my solution is as valid in 10 dimensions as it is in 1!

Cheers,

Timkin

This topic is closed to new replies.

Advertisement