扫描飞机上的已知位置

时间:2013-02-01 03:11:59

标签: algorithm geometry

想象一下在已知位置有一些点的飞机。大多数聚集在一起,但有些是异常值,并且有大的区域根本没有点。我有多个客户可以通过矩形视口查看平面。每个客户端的视口可以具有不同的尺寸,并且可以立即移动到飞机上的任何位置。客户不知道积分的位置;只有服务器呢。当客户端连接时,它会将其视口的大小传达给服务器,服务器应响应一个位置,该位置将对该客户端的视口显示一个或多个点。客户端访问该位置,从访问这些点收集数据,将该数据发送回服务器,然后请求下一个位置访问。这一直持续到至少一个客户访问了所有点。

我需要一种有效的算法来选择要访问的位置。理想的解决方案是通过在视口位置包含尽可能多的未访问点,最大限度地减少对点的重复访问,以及不访问没有未访问点的位置,最大限度地减少客户需要访问的位置数量。你能推荐一种算法吗?

1 个答案:

答案 0 :(得分:0)

要做到这一点:

   1) generate a Dalauney triangulation for the points  
   2) sort the triangles by size    
   3) for each vertex in the largest triangle:  
       3a) locate a corner of the viewport at the vertex  
       3b) try each neighboring point on the longest diameter of the viewport
       3c) determine orientation which encloses the maximum number of points  
       3d) position viewport at that orientation
       3e) goto step (3b)  
   4) delete the visited points
   5) goto step (3)