Is ellipse intersecting with circle?

131 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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.