Ellipse tangent line intersection with lines $y=c$

476 Views Asked by At

I am writing an image processing algorithm, and in the process am stuck on a geometry/algebra question.

http://i.imgur.com/vPPbZDR.png

I have an axis-aligned ellipse at the origin, with axes $a$ and $b$. Parallel to the major axis, there are two line segments with lengths $D_1$ and $D_2$. The line connecting the ends of the line segments is a tangent to the ellipse, it touches but does not intersect the ellipse.

The question is: given $a$, $b$ and the ratio $F = {D_1\over D_2}$, how to calculate the lengths of $D_1$ and $D_2$?

Some notes on current progress:

  • I believe the solution exists and is uniquely defined. Every $F$ ratio defines a set of lines, but only one of these lines touches the ellipse.
  • The $F$ ratio on its own does not determine the angle between the tangent line and the $x$ axis. $D_1=2$, $D_2=1$ has a different angle than $D_1=20$, $D_2=10$.
  • If it is useful, can make assumptions like $b=1$ and $a > b$ and $D_1 > D_2$, since these do not lose generality and I can translate it to an arbitrary ellipse and $F$ ratio afterwards.
2

There are 2 best solutions below

4
On BEST ANSWER

There are a couple of ways to tackle this. One way is to observe that the family of lines with ratio $F$ has a common intersection at $\left(0,{F+1\over F-1}b\right)$, so this problem reduces to finding the tangents to the ellipse through this point.

A direct computation using a generic tangent to the ellipse isn’t a particularly difficult way to go here, either. An equation of the tangent to the ellipse at $(x_0,y_0)$ is $b^2x_0(x-x_0)+a^2y_0(y-y_0)=0$. Using the parameterization $(x_0,y_0)=(a\cos t,b\sin t)$ for the ellipse and solving for $x$ at $y=\pm b$ gives $$\begin{align}D_1&=a(\cos t+\tan t+\sin t\tan t)\\D_2&=a(\cos t-\tan t+\sin t\tan t).\end{align}$$ From this we get $D_1D_2=a^2$ which, combined with $F=D_1/D_2$, yields $D_1=a\sqrt F$, $D_2=a/\sqrt F$ just as in Lozenges’ comment.

0
On

As an alternative approach, examine the unit circle:

enter image description here

A bit of angle chasing determines that that $\angle{OAA'}=\angle{COC'}$, so that $CC':OC'::OA':AA'$. But $D_1=AA'$ and $D_2=CC'$, so $D_1D_2=1$. Combined with $D_1/D_2=F$ this gives $D_1=\sqrt F$ and $D_2=1/\sqrt F$.

To generalize to an ellipse, recall that affine transformations preserve intersections of lines and segment proportions along parallel lines, as well as points of tangency. A vertical change of scale maintains the above proportions and doesn’t change the horizontal spacing of any of these points, so the segment lengths $D_1$ and $D_2$ are independent of the vertical axis length. A horizontal change of scale by a factor of $a$, on the other hand, also preserves the ratio of $D_1$ to $D_2$, but multiplies each segment length by $a$. Therefore, for an ellipse in standard position, $D_1=a\sqrt F$ and $D_2=a/\sqrt F$, as was computed analytically.