Analytic Geometry – Scaling an Ellipse to be Tangent to Another Ellipse with a Different a/b Ratio

analytic geometryconic sections

I need to scale an ellipse to be tangent to another ellipse without moving them from their centers $(h_1,k_1)$ $(h_2,k_2)$ or modifying their a/b ratio.

$$\frac{(x-h)^2}{(a*s)^2} + \frac{(y-k)^2}{(b*s)^2} = 1$$

I'm looking for a fast analytical geometry solution to this problem, I understand that we could use numerical approach to solve this problem (e.g. Newtons Method)

If the a/b ratio of both ellipses were the same we could simply take advantage of the distance formula and radius at angle formula for ellipse to calculate a scale modifier and it would work in any situation and angle(demo of a working example):

$$
\frac{a \cdot b}{\sqrt{a^2 \sin^2 \theta + b^2 \cos^2 \theta}}
$$

I believe this could be done by finding the two non-vertical common tangent points (NOT tangent lines) of the two ellipses. However, I couldn’t find a working solution anywhere. Since I’m using the solution in software, I need to be able to solve any possible equations with the quadratic formula.

In this demo, the scale of one of the ellipses is calculated by approximately finding the common tangent point on the first ellipse using the following formula:

$$
\begin{aligned}
\theta &= \tan^{-1} \left( -\frac{b}{a} \cdot m \right) \\
x_1 &= h + a \cos \theta \\
y_1 &= k + b \sin \theta \\
x_2 &= h – a \cos \theta \\
y_2 &= k – b \sin \theta \\
\end{aligned}
$$

Please let me know if you have any other questions or concerns.

Best Answer

Given two tangent ellipses

$$ \cases{ \frac{(x-h_1)^2}{a^2}+\frac{(y-k_1)^2}{b^2}=s^2\\ \frac{(x-h_2)^2}{a^2}+\frac{(y-k_2)^2}{b^2}=1 } $$

substituting $x$ we have

$$ 4a(b^2(h_1-h_2)^2+a^2(k_1-k_2)^2)y^2+-4 a( b^2 (h_1 - h_2)^2 (k_1 + k_2) + a^2 (k_1 - k_2) (b^2 + k_1^2 - k_2^2 - b^2 s^2))y+(b^4 (h1 - h2)^4)/a + a^3 (k_2^2 - k_1^2 + b^2 (s^2-1))^2 - 2 a b^2 (h_1 - h_2)^2 (b^2 (1 + s^2)-k_1^2 - k_2^2)=0 $$

or

$$ c_2y^2+c_1y+c_0=0 $$

but by tangency proprieties we know that

$$ c_2y^2+c_1y+c_0=d_0(y-y_0)^2,\ \ \forall y $$

and as a consequence

$$ \cases{ c_0-d_0 y_0^2=0\\ c_1+2d_0 y_0 =0\\ c_2 - d_0 = 0 } $$

so we have three equations and three unknowns $(s,d_0,y_0)$. Solving for $s$ we obtain

$$ s = \pm 1\pm \frac{1}{ab}\sqrt{a^2(k_1-k_2)^2+b^2(h_1-h_2)^2} $$

four solutions. Two considering $s^2$

Related Question