I have circle given by center coordinates and radius, and ellipse with center coordinates, $r_x$ and $r_y$. I want to check if the ellipse is inside the circle( meaning their bounds can collide). How can I check it with circle and ellipse equations:

$(X - X_0)^2 + (Y - Y_0)^2 = R^2$

$\dfrac{(X - X_e)^2}{a^2}+ \dfrac{(Y-Y_e)^2}{b^2}= 1$

I think first to check if the two figures collide, then if they don't - check if ellipse's center is inside the circle's center. But I'm not sure how to do it. Any help?

  • $\begingroup$ Are you just trying to see if the center of the ellipse is inside the circle, or do you want to know if the intersection of the ellipse and circle is nonempty? $\endgroup$ – rogerl Jul 1 '16 at 17:38

I suspect this is hard to do in general.

The points on the ellipse can be parameterized by an angle $t$ (the angle from the center of the ellipse to the point, as measured counterclockwise from the positive $x$-direction) as $$P(t)=\left(X_e+a\cos(t),Y_e+b\sin(t)\right)$$ for $0\le t<2\pi$. If you know the specific values of all the constants, you could graph the squared distance between $P(t)$ and the origin (having shifted both figures so the circle’s center is at the origin) and see if $P(t)<R^2$ for all $t$ between $0$ and $2\pi$.

For example, if your ellipse is centered at $(1,2)$ after shifting the circle to the origin, and if $a=2$ and $b=3$, you would want to graph $$\left(1+2\cos(t)\right)^2+ \left(1+3\sin(t)\right)^2$$

enter image description here

and see if its maximum is above $R^2$. The maximum value has no general closed form, so you would want to do this numerically.


protected by Community Jul 3 '16 at 15:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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