How do you determine if a point sits inside a polygon?

I will assume the polygon has no intersections between the edges except at corners. Call the point $(x_0, y_0)$. First we determine whether we are on a line - this is simple using substitution and range checking. For the range checking, suppose we have a segment $(x_1, y_1)$, $(x_2, y_2)$. We check that $x_1\leq x_0\leq x_2$ or $x_2\leq x_0\leq x_1$ and do the same for $y$.

Now, if we aren't on a line, we draw a ray from the point and count how many lines you intersect. If the line doesn't intersect a corner or contain a non-degenerate segment of an edge, then an odd number of intersections should mean you are inside and an even number mean outside.

If we intersect with a corner, it is more difficult. Clearly, the ray could leave with it only intersecting a corner, but it could also pass through the corner without entering the polygon. One solution is to pick the ray so that it doesn't intersect a corner or go along a line - this should always be possible. We can also use cross product to determine whether we are crossing the lines at their corner or not (just check if the adjacent vertices are on the same side of the line or not).