Abstract
This paper provides a full theoretical and experimental analysis of a serial algorithm for the point-in-polygon test, which requires less running time than previous algorithms and can handle all degenerate cases. The serial algorithm can quickly determine whether a point is inside or outside a polygon and accurately determine the contours of input polygon. It describes all degenerate cases and simultaneously provides a corresponding solution to each degenerate case to ensure the stability and reliability. This also creates the prerequisites and basis for our novel boolean operations algorithm that inherits all the benefits of the serial algorithm. Using geometric probability and straight-line equation F ( P ) = ( y i − y i + 1 ) ( x p − x i ) − ( y i − y p ) ( x i + 1 − x i ) , it optimizes our two algorithms that avoid the division operation and do not need to compute any intersection points. Our algorithms are applicable to any polygon that may be self-intersecting or with holes nested to any level of depth. They do not have to sort the vertices clockwise or counterclockwise beforehand. Consequently, they process all edges one by one in any order for input polygons. This allows a parallel implementation of each algorithm to be made very easily. We also prove several theorems guaranteeing the correctness of algorithms. To speed up the operations, we assign each vector a number code and derive two iterative formulas using differential calculus. However, the experimental results as well as the theoretical proof show that our serial algorithm for the point-in-polygon test is optimal and the time complexities of all algorithms are linear. Our methods can be extended to three-dimensional space, in particular, they can be applied to 3D printing to improve its performance.
Highlights
Many algorithms are available for the point-in-polygon test
The aim of boolean operations on polygons is to extract all contours of the resultant polygons or obtain all inner regions enclosed by the resultant polygons
The main problem encountered by boolean operation algorithms is that, because any two edges from different input polygons may overlap each other, the calculation of intersection points becomes more complicated and may cause program instability
Summary
From the online library [5], we select 11 algorithms for testing. In addition, we test [1,6] and efficient boundary methods [2], and CGAL4.2 [31] with a 2D Kernel. For all points in the MBB, the algorithm tested uses a timer to record the total execution time of the program. HOLE denotes that an algorithm can deal with polygons with holes(not nested). NHOLE denotes that an algorithm can deal with polygons with nested holes at any depth. DIR indicates that an algorithm must specify whether each contour of input polygons is oriented clockwise or counterclockwise. SENS indicates that an algorithm is sensitive to whether a polygon is oriented clockwise or counterclockwise. ON indicates that an algorithm can determine whether a point is on the polygon boundary.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.