Detect when 2 moving objects in the 2d plane are close

Imagine that we have a two-dimensional sky (coordinates 10000x10000). Anywhere in this sky can be an airplane indicated by its position (x, y). Any aircraft can start moving to other coordinates (in a straight line).

There is only one component that controls all this positioning and movement. When the plane wants to move, he sends him a message in the form (start_pos, speed, end_pos). As I can say in the component, when one plane will move along the line of another (each plane has this property as a radius of view) to notify about it. Please note that many planes can move at the same time. In addition, this algorithm is good to be efficient sa, it can handle ~ 1000 planes.


If there is any restriction, this limits your decision - it can probably be removed. The problem is not resolved.

+3
source share
5 answers

I really found the answer to this question.

, . 223. : , 2D- - . ( ), , , , . - .

-1
  • .
  • , . "close" ( , ).
  • :
    • , .
      • , , . ( ), .
+3

( , ), , ( - , , 2D, 3D).

, () . n ^ 2; , .

+3

Wikipedia: Quadtree , , . O (N ^ 2) .

+2

, , ,

  • , (start_pos, speed, end_pos)
  • , , , , , /

, , , - ​​ , ~ 1000 .

, ,

  • , (quadtree, octree, kd-),
  • ,

Of course, the conversion time to the third dimension turns planes from points to lines, and you end up finding the closest points between two three lines (here are some math )

+1
source

Source: https://habr.com/ru/post/1779155/


All Articles