欢迎访问《图学学报》 分享到:

图学学报

• 专论:第12届中国计算机图形学大会 (CHINAGRAPH 广州) • 上一篇    下一篇

加强局部简便计算的点在多边形内的高效判定

  

  1. 1. 中国科学院软件研究所计算机科学国家重点实验室,北京 100190; 
    2. 中国科学院大学计算机科学与技术学院,北京 100190;
    3. 中国科学院动物研究所动物进化与系统学院重点实验室,北京 100101
  • 出版日期:2019-04-30 发布日期:2019-05-10
  • 基金资助:
    国家重点研发计划项目(2017YFB1002700);国家自然科学基金项目(61661146002,61872348)

Efficient Point-in-Polygon Tests with Local and Simple Computation

  1. 1. State Key Laboratory of Computer Science, Institute of Software, The Chinese Academy of Sciences, Beijing 100190, China;  
    2. School of Computer Science and Technology, University of Chinese Academy of Sciences, Beijing 100190, China;  
    3. Key Laboratory of Zoological Systematics and Evolution, Institute of Zoology, Chinese Academy of Sciences, Beijing 100101, China
  • Online:2019-04-30 Published:2019-05-10

摘要: 点在多边形内的检测是计算几何中的一个基本问题,有着广泛的应用需求。已提 出许多方法减少要测试的多边形的边以加速。其中,均匀网格法具有很好的作用,因为各网格 中的边很少,而测试点可迅即定位于一个网格。我们曾提出一种均匀网格法,预计算各网格中 心点位于多边形内/外的属性,然后将测试点与所在网格的中心点连线,检测该连线与多边形的 边的相交情况即可。其预处理和检测的复杂度分别为 O(N)和 O( N ),N 为多边形的边数。本 文在此基础上进一步改进,预计算网格交点位于多边形内/外的属性,然后将测试点与其邻近网 格交点的连线,转换为与坐标轴平行的两条相连直线段,以提高与多边形边求交计算的便捷性。 实验结果表明,可将检测速度提高 2 倍多。

关键词: 多边形, 网格, 简便计算, 点在多边形内的检测

Abstract: Determining whether a point is inside a polygon is a fundamental computation in computational geometry and is required in many areas including computer graphics, geography information systems, and so on. For efficient implementation, many methods have been proposed to manage the polygon optimistically for reducing the polygon edges to be checked in answering a query point, among which the grid-based methods are always regarded the fastest ones, as the grid cell containing the query point can be determined at once due to the same size for grid cells, and the edges in a grid cell are always in a very small number. In our previous works, we have proposed a very fast grid-based method. It determines the inclusion property of the center points of grid cells in preprocess, and then produces the testing line from the query point to the center point of the grid cell that contains the query point, for answering the query point. With our endeavors, we have reduced the expected time complexities for preprocessing and answering a query point to be O(N)  and O( N ) respectively, where N is the number of the polygon edges. In this paper, we propose  novel measures for further speeding up point-in-polygon tests via a grid. In preprocessing, we determine the inclusion property of the corners instead of the center points of the grid cells. In answering a query point, we employ two line segments aligned with the two axes as the testing lines to connect the query point and one of its nearby corners, for reducing intersection computation. Experimental results show that we can have point-in-polygon tests sped up by twice.

Key words: polygon, grid, simple computation, point-in-polygon tests