OK, technically not a programming question. But folks here have posted links to some pretty interesting algorithms that have apparently been “well-known” for some time. So, here goes:
Given a simple polygon defined by the (x, y) coordinates of its vertices: (x0, y0), (x1, y1), (x2, y2), …. what would be an algorithm to determine if an arbitrary point (X, Y) lies inside or outside the polygon?
I think conceptually the simplest one is casting a ray from the point to infinity, and see how many times it intersects an edge of the polygon. There are some nasty edge cases though.