Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collision detection between two accelerating spheres with no initial velocity?

Initially, two non-touching spheres of radii R1 and R2 are lying in space at rest.
Both of them are then given accelerations a1 and a2 respectively at time=0.
Find whether they will ever come in contact. Their initial positions are represented as (x1,y1,z1)
and (x2,y2,z2) respectively. Accelerations have respective components in 3D. They are
represented as (a1i,a1j,a1k) and (a2i,a2j,a2k) respectively.

What is the mathematical condition for successful collision of spheres? Or what should be the programming thinking to solve this kind of problem.

Note: It would be great if you can give me the satisfying condition in terms of variables mentioned in the question i.e., r1,r2,x1,y1,z1,x2,y2,z2,a1i,a2i,a1j,a2j,a1k and a2k

like image 721
DOSHI Avatar asked Oct 21 '22 06:10

DOSHI


1 Answers

Using the given variable names:

  • The position of point 1 at time 0 is (x1,y1,z1)
  • The position of point 2 at time 0 is (x2,y2,z2)
  • The position of point 1 at time t is p1(t) = (x1,y1,z1) + 0.5 * (a1i,a1j,a1k) * t * t
  • The position of point 2 at time t is p2(t) = (x2,y2,z2) + 0.5 * (a2i,a2j,a2k) * t * t
  • The condition for an intersection at time t is | p1(t) - p2(t) | < r1+r2

The | ... | denotes the euclidean distance, that is | (x,y,z) | = sqrt(x*x+y*y+z*z)

This yields the condition:

sqrt((x1+0.5*a1i*t*t - x2+0.5*a2i*t*t)^2+
     (y1+0.5*a1j*t*t - y2+0.5*a2j*t*t)^2+
     (z1+0.5*a1k*t*t - z2+0.5*a2k*t*t)^2) < r1 + r2

When there is a t where this condition is true, then the spheres touch/intersect at this point in time.

I tried to feed this into WolframAlpha and solve for t, but did not succeed. Implementing a purely analytical solution will be hard, anyhow.

like image 101
Marco13 Avatar answered Oct 23 '22 04:10

Marco13