A cell-based point-in-polygon algorithm suitable for large sets of points

Abstract The paper describes a new algorithm for solving the point-in-polygon problem. It is especially suitable when it is necessary to check whether many points are placed inside or outside a polygon. The algorithm works in two steps. First, a grid of cells equal in size is generated, and the polygon is laid on that grid. A heuristic approach is proposed for cell dimensioning. The cells of the grid are marked as being inside, outside, or on the polygon border. A modified flood-fill algorithm is applied for cell classification. In the second step, points are tested individually. If the tested point falls into an inner or an outer cell, the result is returned without any additional calculations. If the cell contains the polygon border, it is possible to determine the local point position. The analysis of time complexity shows that the initialization is finished in O(n n ) time, while the expected time complexity for checking an individual point is O( n ) , where n represents the number of polygon edges. The algorithm works with O ( n ) space complexity. The paper also gives practical results using artificial and real polygons from a GIS environment.

[1]  Václav Skala Line clipping in E2 with O(1) processing complexity , 1996, Comput. Graph..

[2]  G. Taylor,et al.  POINT IN POLYGON TEST , 1994 .

[3]  Borut Zalik,et al.  A topology construction from line drawings using a uniform plane subdivision technique , 1999, Comput. Aided Des..

[4]  Hanan Samet,et al.  Applications of spatial data structures , 1989 .

[5]  Borut Zalik,et al.  An Efficient Code‐Based Voxel‐Traversing Algorithm , 1997, Comput. Graph. Forum.

[6]  大野 義夫,et al.  Computer Graphics : Principles and Practice, 2nd edition, J.D. Foley, A.van Dam, S.K. Feiner, J.F. Hughes, Addison-Wesley, 1990 , 1991 .

[7]  Min Chen,et al.  Efficient and Consistent Algorithms for Determining the Containment of Points in Polygons and Polyhedra , 1987, Eurographics.

[8]  Takayuki Tanaka,et al.  ARTS: Accelerated Ray-Tracing System , 1986, IEEE Computer Graphics and Applications.

[9]  Les A. Piegl,et al.  Delaunay triangulation using a uniform grid , 1993, IEEE Computer Graphics and Applications.

[10]  Kenneth B. Salomon An efficient point-in-polygon algorithm , 1978 .

[11]  Joseph O'Rourke,et al.  Computational Geometry in C. , 1995 .

[12]  Francisco R. Feito-Higueruela,et al.  Orientation, simplicity, and inclusion test for planar polygons , 1995, Comput. Graph..

[13]  Borut Zalik,et al.  A universal trapezoidation algorithm for planar polygons , 1999, Comput. Graph..

[14]  Hanan Samet,et al.  The Design and Analysis of Spatial Data Structures , 1989 .

[15]  Jack Bresenham,et al.  Algorithm for computer control of a digital plotter , 1965, IBM Syst. J..

[16]  Tian-Yuan Shih,et al.  On the complexity of point-in-polygon algorithms , 1997 .

[17]  Václav Skala,et al.  O(lg N) line clipping algorithm in E2 , 1994, Comput. Graph..