[Math] Calculate the intersection points of two ellipses

conic sectionsgeometrytrigonometry

I used the equations found on Paul Bourke's "Circles and spheres" page to calculate the intersection points of two circles:

Image of intersecting circles from Paul Bourke's page

$P_3$ is what I'm trying to get, except now I want to do the same with two ellipses.

Calculating $h$ is the tricky bit. With regular circles, it can be done with the Pythagorean Theorem $a^2 + b^2 = c^2$, since we already know $r_0$ (the radius):
$$h = \sqrt{a^2 + r_0^2}.$$

With ellipses it seems much trickier. I don't know how to calculate $h$. There is not a single radius anymore: there are $\operatorname{radiusX}$ and $\operatorname{radiusY}$.

Given $\operatorname{radiusX}$, $\operatorname{radiusY}$, and the center points $(x,y)$ of each ellipse, how do I find the two intersecting points? (Note: the ellipses are guaranteed to have two intersecting points in my specific application.)

Best Answer

Two ellipses can intersect in up to $4$ points. The system of two equations in two variables is equivalent to solving one polynomial of degree $4$ in one variable. In your case it is known that two of the solutions of this polynomial are real, but this does not simplify anything algebraically except for a few cases where there is some special geometric relationship between the ellipses. An exact solution in terms of the equations defining the ellipses will have the same complicated zoo of nested radicals as the formula for solving a general quartic equation. Unless for some unusual reason you really need the infinite-precision algebraic answer, it is simpler to solve numerically for the two intersection points.