pointwithinpolygon
Point within polygon, or point-in-polygon (PIP), is a classic problem in computational geometry. Given a polygon defined by an ordered list of vertices, the question is whether a query point lies inside the polygon’s interior, on its boundary, or outside. Depending on the application, boundary points may be treated as inside, outside, or as a separate category.
The most common method is the ray casting algorithm. A horizontal or vertical ray is projected from
Performance and data considerations: for a polygon with n vertices, a straightforward PIP test runs in O(n)