[Paper Review] A correct even-odd algorithm for the point-in-polygon (PIP) problem for complex polygons
This paper presents a correct even-odd algorithm for the point-in-polygon (PIP) problem in complex polygons, operating in linear time. It simplifies implementation by handling all edge cases systematically, ensuring reliable point containment checks for computer graphics, games, and geoinformatics applications.
Determining if a point is in a polygon or not is used by a lot of applications in computer graphics, computer games and geoinformatics. Implementing this check is error-prone since there are many special cases to be considered. In this paper we present a simple even-odd algorithm to solve this problem for complex polygons in linear time.
Motivation & Objective
- To address the high error rate in existing PIP implementations due to numerous special cases.
- To develop a robust algorithm that correctly handles complex polygons with self-intersections and non-convex shapes.
- To ensure the solution runs in linear time, making it efficient for real-time applications.
- To provide a simple, correct, and maintainable implementation for practical use in computer graphics and geospatial systems.
Proposed method
- Uses the even-odd rule to determine point inclusion based on the number of edge crossings.
- Processes each edge of the polygon sequentially in a single pass.
- Counts intersections between a ray from the point and polygon edges, applying even-odd parity.
- Handles degenerate cases such as points on edges or vertices by consistent rules.
- Maintains O(n) time complexity by avoiding nested loops or complex data structures.
- Ensures correctness through systematic treatment of edge cases, including self-intersecting polygons.
Experimental results
Research questions
- RQ1How can a PIP algorithm be made both correct and efficient for complex, non-convex, and self-intersecting polygons?
- RQ2What are the key edge cases that commonly break existing PIP implementations?
- RQ3Can a simple even-odd rule be implemented reliably without sacrificing performance?
- RQ4How does the proposed algorithm maintain linear time complexity while ensuring correctness across all test cases?
Key findings
- The proposed algorithm correctly determines point-in-polygon status for all complex polygon types, including self-intersecting and non-convex shapes.
- The algorithm runs in linear time, O(n), making it suitable for real-time applications.
- It eliminates common implementation errors by systematically handling edge cases such as points on edges or vertices.
- The simplicity of the even-odd rule combined with careful case management ensures high reliability and maintainability.
- The method achieves correctness without requiring complex data structures or additional preprocessing.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.