Ellipse that passes through four points

652 Views Asked by At

I want to know the ellipse that tangentiates the bottom horizontal side and the right vertical side of a rectangle, and have two arbitrary lines segments that tangentiates them at knowed coordinates.

Origin of the coordinates

upper left rectangle's corner 

Rectangle points

rsp = right side point
rsp x coordinate = size of the rectangle's horizonal side
rsp y coordinate = center of the ellipse

bsp = bottom side point
bsp x coordinate = size of the rectangle's vertical side
bsp y coordinate = center of the ellipse

Follows an image for clarifying porpouses.

Sample diagram

1

There are 1 best solutions below

1
On BEST ANSWER

Assume the axes of the ellipse are aligned with the axes of the coordinate system. Then the ellipse satisfies

$$ \left(\frac{x-x_0}{a}\right)^2+\left(\frac{y-y_0}{b}\right)^2=1 $$

where $(x_0, y_0)$ is the center of the ellipse and $a$ and $b$ are the half-lengths of the ellipse axes.

Let $y=B$ and $x=R$ define the horizontal (Bottom) and vertical (Right) sides of the rectangle, respectively. Then the point $(x_0, B)$ lies on the ellipse. Substituting gives

$$ \left(\frac{B-y_0}{b}\right)^2=1 $$

or $b=B-y_0$. A similar substitution using the right side gives $a=R-x_0$. So the ellipse equation can be written

$$ \left(\frac{x-x_0}{R-x_0}\right)^2+\left(\frac{y-y_0}{B-y_0}\right)^2=1 $$

Rearranging this equation to solve for $B-y_0$

$$ B-y_0=\frac{B-y}{1\pm\sqrt{1-\left(\frac{x-x_0}{R-x_0}\right)^2}} $$

The LHS of this is constant. If the two tangent points are given by $(x_1,y_1)$ and $(x_2,y_2)$ we can write

$$ B-y_0=\frac{B-y_1}{1\pm\sqrt{1-\left(\frac{x_1-x_0}{R-x_0}\right)^2}}=\frac{B-y_2}{1\pm\sqrt{1-\left(\frac{x_2-x_0}{R-x_0}\right)^2}} $$

Since $B$, $R$, $(x_1,y_1)$ and $(x_2,y_2)$ are given, the only unknown is $x_0$. After solving (numerically) for $x_0$, $y_0$, $a$ and $b$ can be determined by back-substitution.

Hope that helps