I have an ellipse in normal form centered at the origin and want to check whether a disk with given center point and radius is contained completely in the ellipse without touching it.
If I could compute the shortest distance between a point and the ellipse then I can just check if this distance is larger than the disk radius. How would I calculate this distance and are there other ways to solve this problem?
(Related to this question.)
First, the center $P_0 =(x_0, y_0)$ has to be inside the ellipse $\frac{x^2}{a^2} + \frac{y^2}{b^2} =1$ and this means $$\frac{x_0^2}{a^2} + \frac{y_0^2}{b^2} < 1$$
Now, let's determine the closest point $(P_1 = (x_1, y_1)$ on the ellipse to $(x_0, y_0)$. At such a point the tangent to the ellipse, which is given by the ecuation
$$\frac{x_1 x }{a^2} + \frac{y_1 y }{b^2} =1$$ has to be perpendicular to the segment $P_0 P_1$. Hence, we need to have
$$ \frac{x_1(x_1- x_0)}{a^2} + \frac{y_1(y_1- y_0)}{b^2}=0$$
Thus we get the system in the unknowns $(x_1, y_1)$
\begin{eqnarray} \frac{x_1^2}{a^2}& +& \frac{y_1^2}{b^2} =1\\ \frac{x_0 x_1}{a^2} &+& \frac{y_0 y_1}{b^2} =1 \end{eqnarray}
which has two solutions (possibly equal). From them we get the one $P_1$ for which the distance is shortest ( for the other one it will be the longest).