Ellipse Line Intersection Calculator

Enter an ellipse center, two semiaxes and the first axis direction. Use two points to define a path and see which exact boundary contacts fall along it. The plot uses equal scales and marks contacts beyond a segment or behind a ray.

Nonlinear systems

Find where an ellipse meets a line, ray or segment

Ellipse and path coordinates

Use one common coordinate unit. Enter each coordinate pair as two decimals separated by a comma or space.

Enter x, y.

First and perpendicular second radius.

Enter a nonzero direction vector x, y.

Enter x, y at t = 0.

Enter x, y at t = 1.

Segment stops at the second point. Ray continues forward.

The selected path crosses the ellipse twice.

Boundary hits and distance inside

Supporting line
Secant
Boundary hits on path
2
Length inside ellipse
8
Inside parameter interval
1/10 through 9/10

Start point · Outside. Second point · Outside.

Ellipse, selected path and boundary contacts
Equal-scale ellipse intersection plotSegment mode. The selected path crosses the ellipse twice.Same scale on X and Y
Supporting line Selected path Interior portion On-path contact

Exact contact coordinates

  1. Contact 1 · On path

    t
    1/10
    X
    -12/5
    Y
    -16/5
  2. Contact 2 · On path

    t
    9/10
    X
    12/5
    Y
    16/5

Export the intersection audit

View exact quadratic coefficients

The path gives A t² + B t + C = 0.

A
10000
B
-10000
C
900
Discriminant
64000000
View CSV text

How to use this calculator

  1. Enter the ellipse center and the lengths of both semiaxes.
  2. Enter the first axis direction as a pair of components, such as 3, 4. The second axis is perpendicular.
  3. Enter a path start and second point. Choose segment, ray or line and inspect the on-path contacts and distance inside.
  4. Expand the quadratic coefficients or download exact parameters and contact coordinates in the CSV.

The Formula

The mathematical logic powering this calculation is:

Write the path as P + tD, where P is its start and D points from the start to the second point. For ellipse center O, semiaxes a and b, and first axis direction U, put V = P − O + tD. Its scaled projections along and perpendicular to U are u = U · V and v = UₓVᵧ − UᵧVₓ. Substituting in the ellipse equation gives b²u² + a²v² = a²b²(U · U).

Expanding gives A t² + B t + C = 0 with A > 0. The exact discriminant B² − 4AC distinguishes two real contacts, one tangent contact, and no real contacts. The real roots are −B/(2A) ± √((B² − 4AC)/(4A²)). Compute X and Y by substituting each root into P + tD.

Segment mode retains 0 ≤ t ≤ 1, ray mode retains t ≥ 0, and line mode keeps every real root. The endpoints count. The interval on or inside the ellipse runs between the roots and is clipped to the chosen path. Multiply its parameter span by |D| for distance. Exact rational and radical comparisons determine the contact and interval classifications. Distance is shown as a fraction or radical when directly available. A value marked ≈ is a decimal approximation. Plot coordinates use decimal approximations.

Worked Example

If you input:

  • Center: 0, 0
  • Semiaxes: 4, 2
  • First axis direction: 3, 4
  • Path: Segment from (−3, −4) to (3, 4)

Result:

Both contacts are on the segment. Their parameters are 1/10 and 9/10, with coordinates (−12/5, −16/5) and (12/5, 16/5). The length inside is 8.

Frequently Asked Questions

Does an endpoint on the ellipse count?

Yes. The start and second point both count in segment mode. With a ray the start counts and the path extends forward through the second point.

Can a path be inside with zero boundary hits?

Yes. A short segment can lie entirely inside. The supporting line still has two real intersections, but both fall outside the segment's parameter interval.

Does the axis direction have to be a unit vector?

No. Scaling it by any nonzero number preserves the ellipse. The first length follows that direction, and the second follows the perpendicular axis.

How can one on-path result come from a secant?

A secant has two real intersections on the supporting line. Clipping to a segment or ray may keep just one of those points. A tangent has a single repeated root on the supporting line.

Similar Calculators