When is a point in the plane inside a simple closed path? Suppose I have a simple closed curve $\gamma(t)$ in the plane. In general, how do I tell if some point $p$ is inside or outside this curve?
For example say $\gamma(t) = (2 \cos(t), \sin(t) + \cos(3t)/\sqrt{2\pi})$. I just made that up. Plotting it gives some slightly squiggly-looking loop. For some input $p$ how do you determine that $p$ is inside?
My classes in school only focused on the abstract so I'd like an actual algorithm or calculation method. e.g. for triangles, you can calculate whether or not the point is inside by looking at the linear equations defining the sides. Plugging $p$ into those equations tells you wether $p$ is on, above, or under each line. Using this information you can determine if $p$ is actually in the triangle. 
I'm interested in the general case of some path given via a parametric equation $\gamma:[0,2\pi)\twoheadrightarrow X \subset \mathbb{R}^2 \qquad X\cong S^1$.
Added:  I suppose that in general this is too hard. OK fine. What about for say, convex interiors? Is there a known algorithm?
 A: If you look up the definition of "winding number," you'll see  that there's an integral you can compute that tells you exactly what you need to know: the integral is nonzero if the point's inside, and zero otherwise. (For more complicated curves, like ones that cross themselves, other values are possible; and $-1$ is also possible if the curve encircles the point clockwise instead of counterclockwise. 
One problem: if the point is near the curve, the integral can be hard to estimate numerically -- it gets unstable. 
Alternative approach: Take a random ray from your point to infinity. Compute all intersections of this ray with the parametric curve. If there are an odd number, you're inside. Problem: "compute all intersections" means "solve this messy set of equations," which may not be numerically stable. 
For a CONVEX curve, here's a better solution: If the $y$-value, $y_0$ of your point is outside the $y$-range of the curve, it's not inside. If it's one of the endpoints of the range, you have to decide whether such a point CAN be inside (I'd choose "no", myself). If it's INSIDE the $y$-range, you can set $y = y_0$ and solve for $x$; you'll get two values, by convexity. You can even use a bisection method to find the $x$s. If $x_0$, the $x-$coordinate of your point, is between these two values, you're inside; otherwise you're outside. 
A: You can calculate the winding number of the curve $\gamma(t)= (\gamma_1(t) ,\gamma_2(t))$ with respect to the point $p= (p_1,p_2)$. The formalism is the most intuitive in the  context of complex analysis. But in any case, the in the real formalism the winding number is defined as
$$W_p(\gamma)= \frac1{2\pi}\int_0^{2\pi}\!dt\, \frac{(\gamma_1 -p_1) \gamma'_2
- (\gamma_2 -p_2)\gamma'_1}{(\gamma_1 -p_1)^2 +(\gamma_2 -p_2)^2}.$$
It turns out that $W_p(\gamma)$ is a signed integer and tells you how many times $\gamma$ winds around $p$.
