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 circle with center $(x,y)$ and radius $r$ is within the area bounded by the ellipse

  • $\begingroup$ Evaluating inequalities: a point $\;(a,b)\;$ withing the circle (i.e., the disk) fulfills $\;(a-x)^2+(b-y)^2\le r^2\;$ ...now, you have to check if this is within the ellipse. It's hard to say anything more in such a general case. $\endgroup$
    – DonAntonio
    Feb 8, 2018 at 10:06
  • 1
    $\begingroup$ The inside of ellipse is where $\left({x-h\over r_x}\right)^2+\left({y-k\over r_y}\right)^2$ is less than 1. Now write the parametric equation for your circle, maximize the said function over it, and check the maximum. If it is under 1, then you are inside. $\endgroup$ Feb 8, 2018 at 10:29
  • $\begingroup$ @Ng Chung Please do not edit the question as to render comments/answers that have already been given hard to understand. $\endgroup$
    – DonAntonio
    Feb 8, 2018 at 10:30
  • $\begingroup$ @DonAntonio, Fine, but at least keep the Latex format and also correct the bugs for major and minor axes, they were the same! Otherwise, just simply roll back. $\endgroup$ Feb 8, 2018 at 10:38
  • 1
    $\begingroup$ @Ricardo, what've you tried and where did you get stucked? Please show your own efforts. $\endgroup$ Feb 8, 2018 at 10:41

3 Answers 3


Idea: doing a translation we can suppose than the circle is centered at $(0,0)$. Parametrize the equation of the ellipse:

$$x(t) = h + r_x\cos t,$$ $$y(t) = k + r_y\sin t.$$ And find the maximum and minimum of $t\mapsto x(t)^2 + y(t)^2$.


Solve for $x$ or $y$ from



$$\frac{(x-h)^2}{r^2}+\frac{(y-k)^2}{r^2}=1 . $$

If the point of intersection is complex due to quantity under radical sign (discriminant) being negative, then the circle is inside the ellipse.

If it is zero, the circle touches the ellipse and if posive there is intersection between them at 2 or 4 points.

  • $\begingroup$ Do we have a Simple way to check this? i tried to Solve the equation, but it get a kinda big. $\endgroup$ Feb 10, 2018 at 22:12
  • $\begingroup$ Groebner basis solution may be helpful when equations are not linear $\endgroup$
    – Narasimham
    Feb 11, 2018 at 17:09

An ellipse and a circle are both on 2d space. the ellipse is centered at $A$ and the circle is centered at $B$ first find the vector between them $B-A$ call it $D$ Make a variable $N$ that is the normal of $B-A$

We know that the strait line from the circle to the ellipse is where the circle is closest subtract the Normal times the radius from $D$

Solve for the intersection of an ellipse.

In code it would look like this:

var dx = circleX-ellipseX;
var dy = circleY-ellipseY;
var d = 1/sqrt(dx*dx + dy*dy);
var nx = dx*d;
var ny = dy*d;
dx -= nx*circleRadius;
dy -= ny*circleRadius;
//Ry is ellipse height
//Rx is ellipse width
if(Ry*Ry*dx*dx + Rx*Rx*dy*dy < Rx*Rx*Ry*Ry){
    score += 10;
    food[0] = width+15;
  • $\begingroup$ would be to good if this worked.. ;P $\endgroup$
    – slaesh
    Mar 9, 2021 at 15:27
  • $\begingroup$ I guess you would need a case for if the distance between them was less than the radius $\endgroup$ Mar 10, 2021 at 15:50
  • $\begingroup$ I just reduced the radius of the ellipse, X and Y now by the circle's radius. And just checking if the mid-point is inside the "smaller" ellipse.. works for this use-case.. maybe not for all.. $\endgroup$
    – slaesh
    Mar 10, 2021 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.