Let's say I have a contour shape defined by two functions x(p)
and y(p)
, where p
is the distance traveled along the perimeter of the shape, normalized between 0
and 1
. For example, a unit circle about the origin would be defined as x(p) = sin(2 * pi * p)
and y(p) = cos(2 * pi * p)
.
A simple test to determine if a point is within that circle would be to calculate the point's distance from the origin, and then detect if that distance is less than or equal to 1
.
But what if my shape has multiple crossings, and is much more complicated than a circle?
There exists a point in polygon test for a discrete shape defined by a set of points. That algorithm is pretty easy to find, since it's used in a lot of places. But if I don't want to use a discrete definition of my shape, what algorithm can I use to determine the winding number, with the assumption that the shape is defined at compile time?