### How to make a function to determine whether a point is inside a polygon

Let us say we have a class that represents a point in the plane as two unsigned short integers. Now let us say we have a class that represents a line segment and is composed of two point classes. Let us define a polygon structure that is composed of an ordered sequence of line classes such that all lines are connected, what are good ways of one implementing a function to determine whether a point is inside a polygon?
Let me know if this isn't the adequate place for me to be asking it.

Thank you all!
This definition allows for complex polygons. Determination of what is inside some of those is arbitrary...
but ignoring that, and taking the simplest answer to it (say yes, the areas are inside it regardless), you can do it by counting the number of times a line starting from outside the polygon and passing through your point hit the line segments that make up the polygon.
I think there are other ways too, but that is a classic solution.
Thank you, I'll try that.
Topic archived. No new replies allowed.