# Calculating Intersection of an Ellipse and a Line

I found this page which gave me some equations on solving the intersection of a line with an ellipse given a point on the line and the slope of the line:

There Isn't much explanation but I presume that after solving for a, b, and c, you can then find the roots to the newly formed quadratic, which will give 2 possible k values.

Here's where the questions come in:

• Which of the two k values do I use in solving for r' and z' ?
• How can you tell when the line doesn't intersect the ellipse? Is the quadratic equation for k not have any real roots?

Earlier, the site states:
and that

• Is it important for r to be >0 in for this equation even though I'm not testing a point, but a line instead?
• Why is the semi-minor axis being defined as 'ae(1-f)'? I usually just define the semi-minor axis the same way I define the major, so could I just replace all the '(1-f)'s in the above equations with my desired semi-minor axis length?

• Finally, is there any simpler, faster way to see if and were an ellipse and line intersect?

-
I've seen this a few times from you, so: elliptic-curves doesn't mean what you think it means. The tag doesn't apply to questions on ellipses; that's what conic-sections is for. –  Ｊ. Ｍ. Dec 14 '11 at 7:20
BTW: yes, solving for the intersection points of a line and an ellipse results in a quadratic equation. If the discriminant of the resulting quadratic equation is negative (thus, complex roots), then you can say that your ellipse and line don't intersect on the plane. –  Ｊ. Ｍ. Dec 14 '11 at 7:23
@J.M. Ok good to know. Do you have any info reguarding my other questions? –  Griffin Dec 14 '11 at 17:30
Let me back up a bit—it seems that, ultimately, you have a line and an ellipse and you want to determine the point(s) of intersection of the two, if there are any. What information do you have about the line and the ellipse? Do you have equations in $x$ and $y$ for each? Parametric equations? Descriptive information (e.g. center, axis-lengths for the ellipse; slope, point(s) for the line)? Depending on what you know about the line and the ellipse, there may well be a simpler and potentially faster way to get the point(s) of intersection. –  Isaac Jan 6 '12 at 1:18

Which of the two $k$ values do I use in solving for $r'$ and $z'$ ?

Either one will be a point of intersection, since in general a line intersects an ellipse in two points. Which one you need, or if it doesn't matter, depends on your application.

How can you tell when the line doesn't intersect the ellipse? Is the quadratic equation for $k$ not have any real roots?

Right. And if you only have a single root, i.e. both roots coincide, then the line will be a tangent.

Is it important for $r$ to be $>0$ in for this equation even though I'm not testing a point, but a line instead?

I see no reason to require this here.

Why is the semi-minor axis being defined as $a_e(1-f)$? I usually just define the semi-minor axis the same way I define the major, so could I just replace all the $(1-f)$s in the above equations with my desired semi-minor axis length?

Yes, you can write the semi-minor axis (called $a_p$ in your document) instead of $a_e(1-f)$. Which means you could replace the $(1-f)$ themselves by $\frac{a_p}{a_e}$ or multiply the whole equation by $a_e^2$.

Finally, is there any simpler, faster way to see if and were an ellipse and line intersect?

Depends on how your objects are given. If you really have an ellipse and a line in the described form, I can't think of something fundamentally easier. If, on the other hand, you have an ellipse in some other representation, then you might be able to use that representation directly to compute the intersection, instead of transforming its representation first. In any case, you can't avoid the quadratic equation.

-