Check if a point is within an ellipse I have an ellipse centered at $(h,k)$, with semi-major axis $r_x$, semi-minor axis $r_y$, both aligned with the Cartesian plane.
How do I determine if a point $(x,y)$ is within the area bounded by the ellipse? 

Another way uses the definition of the ellipse
as the points whose sum of distances to the foci is constant.
Get the foci at $(h+f, k)$
and $(h-f, k)$,
where $f = \sqrt{r_x^2 - r_y^2}$.
The sum of the distances
(by looking at the lines from
$(h, k+r_y)$ to the foci)
 is
$2\sqrt{f^2 + r_y^2}
= 2 r_x
$.
So, for any point $(x, y)$,
compute
$\sqrt{(x-(h+f))^2 + (y-k)^2} + 
\sqrt{(x-(h-f))^2 + (y-k)^2}
$
and compare this with $2 r_x$.
This takes more work, but I like using the geometric definition.
Also, for both methods, if speed is important
(i.e., you are doing this for many points),
you can immediately reject any point $(x, y)$ for which
$|x-h| > r_x$
or $|y-k| > r_y$.
