D
D
Denis Savitsky2012-12-22 22:28:54
Mathematics
Denis Savitsky, 2012-12-22 22:28:54

Solution of the problem of absolutely elastic collision of two balls?

Is there a solution to the problem of absolutely elastic collision of two balls with initial position, velocity vector, radius in the system of linear equations by standard functions (ode45,..)?
Or just a system of linear equations?
Maybe there is an animation of this in MatLab?
Very necessary…

Answer the question

In order to leave comments, you need to log in

4 answer(s)
H
hacklex, 2013-01-06
@qweewq

I think if the author has not yet seen this article , you should definitely read it. At one time, I wrote code based on it.
Of course, no differential equations.
Plus, it may not immediately become obvious: to perform a truly accurate calculation, the procedure must be more complicated than just performing the calculation immediately after detecting the overlap of two circles on each other, due to the need to split the simulation step ∆t.
The article contains, among other things, the calculation of the distance of the run before the collision, therefore, without focusing on the formulas themselves, I will give a general plan for iterating the simulator (to implement the plan described below, you will need to borrow the procedures for determining the free run distance before the collision and calculating the velocity vectors after the collision):

  1. calculate the preliminary new position of each of the balls (add ∆t *V i to the current coordinates of each i-th ball), and in the case of overlapping "predicted" balls, calculate for each distance BEFORE touching (I will use the value of the fraction λ ij from ∆t ( simulation step);
    simulation step fraction (lambda) is a value from 0 (almost collided at the previous simulation step) to 1 (a little more, and there would be no collision at this step at all));
     
  2. sort the pairs of balls according to the received values ​​of the shares in order to consider first those collisions that happened before;
     
  3. for the next pair of colliding calculate
     
    (a) the positions at the moment of touching (t+∆t*λ ij ),
     
    (b) the velocity vectors (see the article at the link above),
     
    (c) the positions at the moment t+∆t (to the positions at the moment of touching add the value of the velocity vector after the collision , multiplied by ∆t*(1−λ ij ), thus correcting the position of the pair at the moment t+∆t, taking into account the collision;
     
  4. repeat the cycle for all pairs of balls, re-determining the overlaps after each refinement and starting the calculation of refinements from the beginning (for collisions with the smallest value of λ)
     
  5. if there are no more collisions among the set of predicted positions for t+∆t, then, ahem, we could call it a step.

Of course, this is still far from a Virtual pool, but visually, especially for models with a coarse simulation step, this will provide significantly more accuracy. Of course, such troubles are needed only if one is needed. If not, it is enough to borrow the formulas for calculating the rebound angles from the article above.
… In addition, when modeling the behavior of absolutely elastic balls, there is a subtle point associated with the exact calculation of the ball's rebound from any acute angle. If this question is suddenly also interesting (personally, this question arose for me immediately after solving the problem with ball collisions), I can show how to calculate the rebound for this case as well.

P
Prosolver, 2012-12-22
@Prosolver

I use this solution to emulate the movement and impact of fifteen balls (Object Pascal):

for i:=1 to 15 do   // просчитываем соударения шаров
for j:=i+1 to 16 do begin
 dist:=sqrt(sqr(balls[i].x-balls[j].x)+sqr(balls[i].y-balls[j].y)); //расстояние между центрами шаров
 if dist<diametr then begin //если расстояние меньше диаметра, значит есть факт соударения
  a:=balls[i].x-balls[j].x; //вспомогательные переменные типа extended
  b:=balls[i].y-balls[j].y;
  p1:=a*b/sqr(dist);
  p2:=sqr(a/dist);
  p3:=sqr(b/dist);
  d1:=balls[i].dy*p1+balls[i].dx*p2-balls[j].dy*p1-balls[j].dx*p2;
  d2:=balls[i].dx*p1+balls[i].dy*p3-balls[j].dx*p1-balls[j].dy*p3;
  balls[i].dx:=balls[i].dx-d1; //меняем значение приращения координаты шаров при движении
  balls[i].dy:=balls[i].dy-d2;
  balls[j].dx:=balls[j].dx+d1;
  balls[j].dy:=balls[j].dy+d2;

  p3:=(diametr-dist)/2; //при соударении шары всегда "проникают" друг в друга, поэтому раздвигаем их
  p1:=p3*(a/dist);
  p2:=p3*(b/dist);
  balls[i].x:=balls[i].x+p1;
  balls[i].y:=balls[i].y+p2;
  balls[j].x:=balls[j].x-p1;
  balls[j].y:=balls[j].y-p2;
 end;
end;

for i:=1 to 15 do
 balls[i].x:=balls[i].x+balls[i].dx;  //эмулируем движение
 balls[i].y:=balls[i].y+balls[i].dy;
end;

M
Muff, 2012-12-23
@Muff

For two balls, everything is solved exactly, without any systems of differential equations. Here, for example, uc.jinr.ru/mirea/classmex/gl_mex_5.pdf

F
Figurnov, 2013-01-25
@Figurnov

Formulas for calculating the elastic collision of particles are given in almost any book on theoretical mechanics. For example, Landau, Lifshitz "Mechanics", p. 62-65, or Yablonsky, "Course of Theoretical Mechanics", vol. 2 p. 284. Differential equations are not required, a school mathematics course is enough

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question