Ray Tracing for Points in a Polygon
This Demonstration uses the ray tracing method to determine whether points on a plane lie inside or outside a given polygon.
In computational geometry, there is a classical problem of partitioning a set of points in 2D into those enclosed by a polygon and those outside. Currently, the best known way is a ray-tracing method, in which a ray is drawn from a candidate point in the positive direction and the number of intersections with the polygon is counted. If the number is odd, the point is inside, if it is even, it is outside.
In this Demonstration, starting with a simple triangle, you can add vertices to a polygon and drag them to see how the points are classified to be inside (green) or outside (red). Notice, however, that the ordering of the vertices is important, since the polygon is shaped by both position and ordering of the vertices.
 Wikipedia. "Point in Polygon." (Jun 1, 2016) en.wikipedia.org/wiki/Point_in_polygon.
 R. Kountanya. "Ray Tracing for Point in Polygon Problem" from Wolfram Library Archive—A Wolfram Web Resource. (Jun 1, 2016) library.wolfram.com/infocenter/MathSource/7780.