Check if a point is within an ellipse

I have an ellipse centered at (h,k), with semi-major axis rx, semi-minor axis ry, both aligned with the Cartesian plane.

How do I determine if a point (x,y) is within the area bounded by the ellipse?

Answer

The region (disk) bounded by the ellipse is given by the equation:
(xh)2r2x+(yk)2r2y1.
So given a test point (x,y), plug it in (1). If the inequality is satisfied, then it is inside the ellipse; otherwise it is outside the ellipse. Moreover, the point is on the boundary of the region (i.e., on the ellipse) if and only if the inequality is satisfied tightly (i.e., the left hand side evaluates to 1).

Attribution
Source : Link , Question Author : Dan Is Fiddling By Firelight , Answer Author : Srivatsan

Leave a Comment