All examples By author By category About

boeric

Point in Polygon

Point in Polygon

The visualization demonstrates the use of a ray casting algorithm to determine whether a point lies inside or outside of a polygon. If the ray emanating from the test point crosses an odd number of polygon line segments, then the test point lies within the polygon, else the point lies outside.

Some descriptions of the algorithm are here, here and here.

See the visualization in action here.

Use the mouse to drag the test point around. Use the drop down to clamp the ray's end point to one of the corners.