The question of the closest approach for leaders of mathematics / physics

I use the Segment to Segment approach approach, which will output the smallest distance between two length segments. Each segment corresponds to the field of origin and destination. Speed ​​is just from one point to another.

The closest approach can be successful, even if there is no real collision. So, currently I am using a 10-step method and calculating the distance between two spheres as they move along two segments. Thus, basically the length of each segment is the course of the object at the physics step, and the radius is the radius of the object. While walking, I can tell where they collide, and whether they collide (in some way; for the MOST part.) ..

I have a feeling that something could be better. Although I in some ways believe that the first immediate call to the approach is required, I think the method immediately following it is a weak TAD. Can someone help me? I can illustrate this if necessary.

Many thanks! alt text
(source: yfrog.com )

+7
math physics
source share
2 answers

(I do not know how to publish graphics, carry me.)

Well, we have two spheres with radii r1 and r2, starting at locations X1 and X2, moving at speeds V1 and V2 (X and V are vectors).

The speed of sphere 1, as can be seen from sphere 2, is

V = V1-V2 

and his direction

 v = V/|V| 

The distance of ball 1 should move (within sphere 2) to the nearest approach

 s = Xv 

And if X is the initial separation, then the distance of the closest approach

 h = |X - Xv| 

This will help the graphics. If h> r1 + r2, there will be no collision. Let h <r1 + r2. During a collision, two spherical centers and a point of the closest approach form a regular triangle. The distance from the center of Sphere 1 to the point of closest approach is

 u = sqrt((r1 + r2)^2 - h^2) 

So, the traveled distance 1

 s - u 

Now just see if sphere 1 moves far beyond a given interval. If so, then you know exactly when and where the spheres were (you should go back from sphere 2 frames, but this is pretty easy). If not, then there is no collision.

+3
source share

The closest approach can be performed without time simulation if the position function is reversible and explicit.

  • Choose a path and an object.
  • Find a point on the path where the two paths are closest. If time has boundaries (for example, paths are line segments), ignore the boundaries of this step.
  • Find the time during which the object is at a point from the previous step.
  • If time has boundaries, limit the selected time to borders.
  • Calculate the position of another object at a point in time from the previous step.
  • Check if objects overlap.

This will not work for all paths (e.g. cubic), but should work for linear paths.

+3
source share

All Articles