Semi-major,minor axes of circumscribed ellipse enclosing a given rectangle

1.3k Views Asked by At

Given a rectangle of width $w$ and height $h$, what are the semi-major, minor axes of the circumscribed ellipse, i.e., such that its arc barely touches the rectangle corners, but doesn't cut through the rectangle? For example,

enter image description here

The answer doesn't seem unique, but there clearly seems to be a "best-fit".

3

There are 3 best solutions below

5
On BEST ANSWER

I would like to argue against the $\sqrt{2}$ scaling factor and propose an alternate solution.

Let us show first how the $\sqrt{2}$ scaling factor is derived, and then show that there is a better choice, obtained by a different computation ((5) instead of (3) below) as can be seen on the example of the figure given below.

Consider rectangle with vertices $(\pm x_0,\pm y_0)$ (we assume $0<y_0<x_0$).

Among the infinite number of ellipses circumscribed to the rectangle, let us take as esthetical criteria the proportionality rule:

$$\tag{1}\dfrac{x_0}{y_0}=\dfrac{a}{b}$$

The other constraint is that equation $\dfrac{x^2}{a^2}+\dfrac{y^2}{b^2}=1$ is verified by $x=x_0,y=y_0$, i.e.,

$$\tag{2}\dfrac{x_0^2}{a^2}+\dfrac{y_0^2}{b^2}=1.$$

Conditions (1)+(2) give a unique positive solution for $a$ and for $b$:

$$\tag{3}\begin{cases}a&=&\sqrt{2}x_0\\b&=&\sqrt{2}y_0\end{cases}$$

giving the green ellipse in the figure below.

But less elongated ellipses like the blue one or the red one are good challengers in this beauty contest.

I suggest to replace (1) by

$$\tag{4}\dfrac{x_0}{y_0}=\left(\dfrac{a}{b}\right)^2$$

(In this way, we take into account the fact that, if the rectangle is far from a square, the "stretching effect" has to be somewhat attenuated).

The formulas that one can deduce from (2) and (4) are:

$$\tag{5}\begin{cases}a&=&\sqrt{x_0(x_0+y_0)}&=&\sqrt{x_0^2(1+\frac{y_0}{x_0})}&<&\sqrt{2}x_0\\ b&=&\sqrt{y_0(x_0+y_0)}&=&\sqrt{y_0^2(1+\frac{x_0}{y_0})}&>&\sqrt{2}y_0\end{cases}$$

which would correspond to the less elongated red curve.

enter image description here

2
On

May be I miss what is special here.

Taking

$$\dfrac{x^2}{a^2}+ \dfrac{y^2}{b^2}=1 \tag1$$

with cartesian/polar relations $$ (x,y)=r (\cos \theta, \sin \theta) \tag2 $$

$$\dfrac{1}{r^2}= \dfrac{\cos^2 \theta }{a^2}+ \dfrac{\sin ^2 \theta}{b^2} \tag3 $$

Plug in

$$ \cos \theta = \dfrac{w}{\sqrt{ h^2+w^2}} ,\, \sin \theta = \dfrac{h}{\sqrt{ h^2+w^2}} , r= {\sqrt{ h^2+w^2}}/2 ,\quad a = b \lambda, \tag4 $$

and simplify we get

$$\dfrac{x^2}{{ w^2+h^2 \lambda^2}}+ \dfrac{y^2}{ { h^2+w^2/ \lambda^2}}=\dfrac14 \tag5$$

"Circumscribing" a rectangle through four points (red) we can have many central conics, not just ellipses. Note that $\lambda^2 $ can have negative values as well for hyperbolas, when semi-minor axis can be even imaginary in general.

Conics thru 5 points

0
On

This "answer" is just a continuation of @JeanMarie 's work above, where I've very straightforwardly generalized her Eq.(4) to $\mathbf{\frac{x_0}{y_0}=\left(\frac ab\right)^n}$, and illustrated several different $n$'s below (I'm thinking 1.5 looks a little better than her 2.0:)

For general $n$ (rather than the constant $2$), JeanMarie's Eq.(4) above just leads to

$\mathbf{ a^2 \; = \; x_0^2 \; + \; x_0^{2/n}y_0^{2-2/n} }$

$\mathbf{ b^2 \; = \; y_0^2 \; + \; y_0^{2/n}x_0^{2-2/n} }$

And I programmed this as the latex-like \ovalbox[n]{anything}, as mentioned in the comment below JeanMarie's answer. The examples below add a surrounding \fbox{anything} just to explicitly illustrate the inscribed rectangle.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

I'm thinking: maybe choose the $n$ that minimizes the area of the ellipse, and make that the default. But I haven't gotten around to setting that up ( what's the chain rule, again? :).