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.