How to find first intersection of a ray with moving circles

╄→尐↘猪︶ㄣ 提交于 2019-12-03 03:39:23

You can look at this as static case in 3D with time as additional coordinate. Circle with path became frustum and ray is in a plane time=tk. If frustums are not positioned too dense than binary space partitioning (k-d tree, ...) can help.

To find all partitions crossed by ray first find partition where is origin and than traverse (in tree) by partition neighbour in ray direction. It depends on partitioning method used. It is linear in number of partitions crossed by ray.

Update: It is idea to put frustum in each partition it is touching. One frustum will be in more partitions.

This is an example in 1 dimension plus time. Everything is same, circles have starting and ending point and starting and ending radius.

1  |    E   /
   |   .   /
   |   .  / 
   |  .  /
   |  . /
0  | S /
t/X

Partitioning in X direction:

   |    E : /
   |   .  :/
   |   .  : 
   |  .  /:
   |  . / :
   | S /  :
          X

This trapezoid will go in both partitions.

Partitioning in time direction:

   |    E : /
   |   .  :/
   |   .  : 
t-------------------
   |  . / :
   | S /  :
          X

Trapezoid from X left partition will go in both time partitions, while in X right partition it will go only in upper partition.

To implement it it is needed to calculate is there an intersection between line and axis plane on some plane part and if there is no intersection on which side of a plane is a line. Calculation is same in 2D case, or even in higher dimensions.

(Thinking out loud) You might want to use an octree or multi-resolution grid with Bresenham's algorithm to quickly eliminate a lot of checks?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!