# Discussion Forums: Open Discussion - multiple simultaneous collisions

 By: nobody ( Nobody/Anonymous ) What about multiple simultaneous collisions   2003-04-09 20:44 This is an issue I have not seen addressed often. For a practical application consider a rack of pool balls and the collision on the break. I have tried to model this by approximating 3 ball collisions which looks ok, but I think my method is incorrect. Solving for energy in these situations I think may be impossible. I really haven't looked into it that much. I know the basic 2 ball collision doesn't work in these situations. What I was really looking for was a fast way to distribute energy through a connected net of touching objects ( which I can build by detecting collisions over time intervals). I need to propagate energy through the net. Each object has different velocity. It could just be an approximation and does not have to solve for energy for my purposes. I also need an algorithm that does not get stuck in infinite loops and resolves so that the next instant in time does not result in a new collision within the network of objects. One that takes into account for different elasticity of objects would be impressive. Anyone ???
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2003-04-10 03:20 Yes, conservation of energy will give one equation (because energy is a scalar quantity) so, on its own, it will not be enough to calculate the resulting linier and angular velocities. Even if we include the equations from the conservation of angular and linier momentums (vector quantities) we will not have enough equations to solve all the unknowns. I think we need to construct all the impulses between objects, each impulse is between two objects but all these impulses combine in a similar way to a static framework of forces. There must be a way to solve this by starting at the outside so we do not get into loops? I think we also need to add in some random factors because the rack will not be precise and so there may be minute gaps between some pairs of balls, or some angles may not be exact. It seems to me that in multiple collisions small differences are greatly magnified, so if one collision happens a nanosecond before another this will have an enormous effect. I assume that is why games like pool and snooker are designed that way, so however good the players are, each game will still be different? Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2003-04-13 17:50 First I was thinking of keeping the collisions instantaneous because if you model things so that collisions take time then things get much more complicated. My program projects the balls ahead in time and finds their next collision. If two collisions occur within the same time step then I cheat and call them simultaneous. For things like pool balls this works ok but as things get more elastic/deformable and collisions take longer this would not be acceptable. You can still maintain a conservation of momentum in a multiball collision. I approximate the resulting velocities by first solving for all two ball collisions independently. Then I scale back all vectors to account for conservation of momentum. It makes sure that one ball colliding with 2 or more balls does not result in more force going out than going in. What makes this more complicated is that these resulting forces often generating new collisions in the net. I have a loop that keeps on solving the collisions this way for about 50 cycles then if it still isn't resolved ( In the worst case the collisions just go round and round in the net never stopping ) I kill the force in deadlocked balls so that others can move. This is very kludgy but surprisingly gives ok results. For pool balls there is also a special case which says that one ball cannot collide with more that 6 other balls as long as the balls stay on the table top.
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2003-04-14 09:09 Thank you very much for this, it is useful to get other peoples experience of what works in practice. Just from a purely theoretical point of view, I would have thought that it would be more accurate to treat a rapid sequence of collisions as seperate two-way collisions, where they are not actually in stationary contact, although I can see that this might be difficult to do. Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2003-04-15 00:02 I thought of trying the two-way collisions approach but it did not appear convincing. Consider the case where you have three balls in a triangle (all balls touching) and you hit the head ball with the cue ball head on. Force is distributed equally between the two balls touching the head ball. If you say one collision occurs before the other and redistribute the energy between the balls in the first collision before the second then the collision will not be symetric. If you try to treat the two collisions as simultaneous 2 ball collisions then this happens. The force is imparted from the head ball onto each back ball appropriately as if it had been in a 2 ball collision. If you add the momentum for the two back balls together will see that this vector is larger than the momentum for the cue ball going into the collision. In this case I find a scalling factor which makes the combined out vector the same size as the in vector. I think I change the head balls out velocity to 0 in these cases ( After all it has imparted all its momentum to the other balls ). If the combined out vectors are larger than the in vector then I then scale all out vectors by this scaling factor ( This is not the accurate way to model collisions: It is a home made symettry that probably is wrong and may not exist in nature ). If the angle between balls is very flat so the head ball does not impart all of its momentum into the other two balls then no scalling is needed and the head ball may even keep rolling. In these cases I would treat it the same as two seperate 2-ball collisions. Even if the cue ball hits the head ball at a strange angle this yields a visually appealing break. I will tell you though this is a kludge and is not pretty. Especially when you have to start dealling with multilple in and out vectors. I think this approach is definitely not the best especially when dealling with a network of touching balls. How is force distributed through a mesh when they do a simulation to stress test something? Isn't this the same situation??? A third case which made matters more confusing. If you rack all the balls in a rack with a small opening large enough so you can hit a balls inside thye rack but small enough so they cannot roll outside the rack. If you hit the cue ball into this exposed ball then what happens. If the walls of the rack absorb no force then should the cue ball rebound with the same momentum it had when it hit the exposed ball? Are there some other combined dissipating mechanism like sound ect. that will dampen the momentum so the cue ball will rebound with signifigantly less force? If this is a signifigant force in a real break then this makes modeling the break more complex. It seems like these issues should be well defined somewhere?
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2003-04-15 10:52 Thank you, these are really good examples. I need to think in pictures so I have drawn the first example here: http://www.martinb.com/physics/dynamics/collision/multiple/index.htm I have put my thoughts and ideas there and I would welcome any ideas about this. Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2004-01-24 08:26 Hi Martin, I'm responding mainly to your page and diagram at: multiple I think the calculation will be tricky without making assumptions or having more knowledge about the properties of the balls. While knowing that this is an elastic collision is good enough for a similar two-ball collision, for 4 balls things such as non-instantaneous and non-linear collision forces may affect things. But fortunately in your problem there's symmetry (as well as no friction, perfectly elasticity, equal masses and only A originally moving!), so the balls can actually only recoil along normals connecting their centres, no matter how complex the internals. There won't be any rotation because there's no friction. So here it's just a case of finding the speeds in known directions. Since that still leaves an infinite number of solutions, though in a known range and known angles, an assumption could be made on how real snooker balls react, based on what's seen, which is hopefully good enough. Since we know real snooker balls (well, I haven't checked this, but I guess it's approximately true) that if A,B,C and D were instead in a straight line, with A the one originally moving, after collision ball D would end up moving away at A's original velocity and the rest of the balls would be end up more or less stationary, like with Newton's cradle (or your second diagram). Or if two were coming in from the left, two would end up moving off to the right, etc. So for steel balls and snooker balls energy seems to transfer more or less completely from one ball to the next without more complex interactions going on, such as reflections off balls B to D and back to A while A's still doing its original collision with B, which would make A recoil a bit. Perhaps this is why snooker's more fun with hard balls than soft ones, or maybe with real snooker balls A does bounce backwards a bit. If we're being this precise perhaps we should also be handling friction and rotation too, which will no complicate a four ball collision no end :) Basically though it seems to me though that full exchanges of energy and momentum done between balls might approximate snooker balls. So in your scenario, Ball A would hit ball B and stop, ball B hit C & D simultaneously, which fly away, and ball B recoil to hit A again and B stops. This needn't be done by a series of impulses though, stiff springs or other methods could be used, but I think they would also require knowledge about snooker balls. In your scenario, B is touching two other balls though; can we handle that by doing two collisions one after the other? We can, but it wouldn't be quite right - though probably not as bad as might be expected, e.g. http://www.sriley.co.uk/chaotic . But since in your example there's symmetry a 3 ball collision can be calculated more or less the same way as usual. It's easy because the magnitudes of the impulses (changes in momentum) on C and D are equal, by symmetry - anything else would mean that they wouldn't move away at the same speed and that wouldn't be right of course. So we know the angles they fly off and we also know that their combined momentum plus B's momentum equals what was supplied initially by A, which is known. The only assumption we have to make is that all of A's momentum and energy are in B at this instant in time. After a calculation similar to that done for two balls, and with the initial value you give, A ends up moving backwards at (-0.2, 0) m/s, B at (0,0) m/s, C at (0.6, 0.3464) m/s and D at (0.6, -0.3464) m/s, this can be checked for energy and momentum conservation (and angular momentum too, though that won't change because friction is absent). Stephen Riley
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2004-01-25 10:40 Hi Stephen, Thanks very much for this, it looks right to me because all the impulses add up to zero: Impulse on A = (-0.12 , 0) Kg m/s Impulse on B = (0, 0) Kg m/s Impulse on C = (0.06 , 0.03464) Kg m/s Impulse on D = (0.06 , -0.03464) Kg m/s ---------------------------------------------- Total = (0,0) Do you have any thoughts on how this could be made a bit more general, for instance a lot of people seem to be building snooker games and would like to accurately model the situation where a number of snooker balls are touching but perhaps are not quite as symmetrical as in this case. I usually find I cant work out the impulses without knowing the final velocities and I cant work out the final velocities without knowing the impulses. I wonder if it could be done by having a set of impulses radiating out from the initial collision to the balls on the outside, and then another set of impulses being reflected back to account for the inertia of the balls? If that wont work then I guess it would have to be a complicated set of simultaneous equations? I tried: http://www.sriley.co.uk/chaotic but I got an error message "Not Found : The requested document or URL could not be found on this server" But I did try some of the other applets on your site and they are very good. I will link to your message from my web page if that's alright. Thanks, Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2004-01-26 07:48 Hi Martin, Oops, my link should've been all lower case: http://www.sriley.co.uk/chaotic . I do have thoughts about how this can be made more general, but only as far as elastic collisions are concerned, where friction and rotation are absent. In reality collisions occur over finite time of course, so for multiple touching balls it might well be easier just to integrate forces over time, as happens in a real collision. Or compromise by handling a 3-ball symmetric collision nicely as a special case and non-symmetric ones by one collision at a time. Just for interests sake I have an expression for a symmetrical elastic collision where balls C and D are at some arbitrary angle (other than 60 degrees as in your example) though. It'll be easier if I express this in terms of a 3 ball collision rather than 4, so the balls are A,B and C, with A the only one initially moving. The expression I came up with is : A.(n1 + n2) j = --------------- (n1.n2)+2 And the final velocities given by : A' = A - j*(n1+n2) B ' = j* n1 C ' = j* n2 Primed letters are post-collision velocities, n1 and n2 unit normals and j the impulse. "." is a dot product. Masses don't appear because they're all equal. Symmetric here means that A bisects n1 & n2, or equivalently n2 is a refection of n1 about A's direction. For example on your diagram n1 and n2 [ (0.866, 0.5) and (0.866, -0.5) ] were reflections of each other about the line (1,0) which is A's velocity vector, so that was a symmetrical collision - both balls receive equal impulse. So for example in your diagram the balls are at 60 degrees to each other we have: n1 = (0.866, 0.5) , n2 = (0.866, -0.5), A=(1,0) So j = (1,0).[ (0.866, 0.5) + (0.866, -0.5) ] / ((0.866, 0.5) .(0.866, 0.5) +2) = 0.6928 And the final velocities: A' = (1,0) - 0.6928 ( (0.866, 0.5) + (0.866, -0.5) ) = (-0.2, 0) B' = 0.6928 * (0.866, 0.5) = (0.6, 0.3464) C' = 0.6928 * (0.866, -0.5) = (0.6, -0.3464) I also have a more general result for a non-symmetrical collision of different masses and all 3 moving, but since I've done little checking on it, it's more complicated and isn't really applicable to snooker where rotation and friction needs to be handled I won't post that. Stephen Riley
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2004-01-27 01:11 Stephen, > Oops, my link should've been all lower case: http://www.sriley.co.uk/chaotic This is very good, is this a permanent page? as I'd like to link to it, if that's alright? Your expression for 3 ball collision is very interesting, how did you derive it? Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2004-01-27 14:13 Hi Martin, Yes, the page is permanent and I would be happy for you to link to it. I derived the expression from conservation of momentum and energy, as a fairly straightforward extension of the method used for two bodies. The following links go into the major issues for two bodies: impulse/index.htm http://www.d6.com/users/checker/dynamics.htm#samples http://www.cs.cmu.edu/afs/cs/user/baraff/www/pbm/pbm.html If a diagram is drawn similar to your first, but with just 3 balls (say ball A on the left, B & C to the right), it can be seen from that that the magnitude of the impulse acting between A and B must equal that between A and B, since it's a symmetric collision. Also that the impulse on A must be the vector sum of those two impulses, but oppositely directed, by conservation of momentum. Since the magnitude of the impulse is used in all three ball collisions and the directions (normal to the surfaces) are known beforehand, it's easier to solve for a scalar impulse, applied in known directions, to get a vector impulse later. Since I know masses are going to cancel (because they're all equal) I'm being lazy and not carrying mass around. A bit sloppy, but gives the same answer. Putting that algebraically: A' = A - j*(n1 + n2) B' = j * n1 C' = j * n2 Where primed values are post collision velocities. "." is a dot product, A,B and C pre-collision velocities, n1 and n2 normals and j the magnitude of the impulse. All are vectors except j. The only ball originally moving is A. The only unknown is j. Post collision velocities A', B', C' can be found once j is found. Conservation of energy gives another equation: A'.A' + B'.B' + C'.C' = A.A I've already divided this through by 0.5 (and mass again). This just says that the sum of the 3 balls kinetic energy after collision equals the original kinetic energy, that of the sole originally moving ball. If A', B' and C' from the first 3 equations are substituted into the last equation and solved for j we end up with a quadratic equation with solutions J=0 and the equation I posted last time. Stephen Riley
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2004-01-28 11:19 Hi Stephen, Thanks again, I've linked to your applet from the following pages: twod/index.htm multiple/index.htm openDiscussion.htm and included this discussion in the last one. I will work through this and update the contents of the pages, but that will take me a bit longer. cheers, Martin
 By: nobody ( Nobody/Anonymous ) RE: What about multiple simultaneous collisions   2004-01-28 18:21 Hi Martin, I've knocked up a fuller derivation, including masses this time, plus an applet showing the result for various angles entered (though still a symmetric collision). http://www.sriley.co.uk/Symmetric Stephen Riley (Now I really should get on with other things, was fun :)
 By: martinbaker ( Martin Baker ) RE: What about multiple simultaneous collisions   2004-01-30 03:28 Stephen, Ok, I'll let you get on with other things. The Symmetric page is great. Martin

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.   Dark Basic Professional Edition - It is better to get this professional edition    This is a version of basic designed for building games, for example to rotate a cube you might do the following: make object cube 1,100 for x=1 to 360 rotate object 1,x,x,0 next x

This site may have errors. Don't use for critical systems.