# Solving a special case of ellipsoid intersection

Let's say I have an ellipsoid centered at the origin of my coordinate system, and not rotated in any way. Think along the lines of the WGS84 ellipsoid in ECEF. Let's call this ellipsoid E1.

Now, let's say I pick a point P1 on the surface of E1, and I pick two points P2 and P3 outside E1. I now construct a second ellipsoid E2 with P2 and P3 as the foci, such that the surface of E2 contains P1.

I can see, qualitatively, that E2 will intersect E1. E2 is not centered at the origin, and may be 'rotated'.

My question is: how do I analytically compute that intersection? Either via a single expression or a series of transformations?

My first thought was to hypothesize a plane containing the intersection, and computing that plane as a minimization problem with E1 and E2 as constraints. I am not sure if this is correct or even how to set up the problem.

Any help with this would be greatly appreciated. Thanks!

• Presumably, $E_2$ is of revolution ? And what about $E_1$ ? – Yves Daoust Jun 26 '19 at 14:14
• As the ellipsoids are in general relative position, the intersection has no reason to be planar. – Yves Daoust Jun 26 '19 at 14:15
• Let's assume both are ellipsoids of revolution. Not quite following why they don't have to be planar - can you help me understand this? – StackMonkey Jun 26 '19 at 14:46
• In fact, this doesn't help. You problem is not really a "special one", just the intersection of two general quadrics. – Yves Daoust Jun 26 '19 at 14:47

By a suitable affine transformation, you can turn one of the ellipsoids to a unit sphere, while the other is centered on the origin and axis-aligned.

The implicit equations are $$(x-u)^2+(y-v)^2+(z-w)^2=1,$$ $$\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}=1.$$

You can use the parametric equations of the sphere and plug into the ellipsoid to get a compatibility condition between the angles:

$$\frac{(\cos\theta\sin\phi+u)^2}{a^2}+\frac{(\sin\theta\sin\phi+v)^2}{b^2}+\frac{(\cos\phi+w)^2}{c^2}=1.$$

Unfortunately, there will be no nice simplification and you end-up with a nasty quartic trigonometric polynomial.

Note that you can expand the equation in terms of one angle and obtain a form like

$$p(\phi)\cos^2\theta+q(\phi)\cos\theta\sin\theta+r(\phi)\sin^2\theta+s(\phi)\cos\theta+t(\phi)\sin\theta+u(\phi)=0.$$

Then by the transformation

$$\cos\theta=\frac{t^2-1}{t^2+1},\sin\theta=\frac{2t}{t^2+1},$$

you obtain a quartic polynomial, for which a (heavy) closed-form solution is possible.

• OK. Can you tell me what you mean by "heavy" closed-form solution? As in, it will be cumbersome to compute? – StackMonkey Jun 26 '19 at 14:48
• @StackMonkey: is this heavy enough ? (Think that the coefficients are complicated expressions in $\phi$): wolframalpha.com/input/?i=ax%5E4%2Bbx%5E3%2Bcx%5E2%2Bdx%2Be%3D0 – Yves Daoust Jun 26 '19 at 14:50
• Oh. Ah. Seems like something that can be carefully coded in MATLAB. When I was doing a general DuckDuckGo search on how to compute ellipsoid intersections, the answers all seemed....defeatist...for lack of a better term. As in, I got the impression that an analytic solution was impossible. What you suggest indicates that it may be possible, but painful to setup and compute. – StackMonkey Jun 26 '19 at 15:06
• @StackMonkey: yes, there is absolutely a closed-form expression, which includes the resolution of the quartic. Can be done with radicals unless you face the casus irreductibilis, which requires an angle trisection (by means of trigonometric functions). – Yves Daoust Jun 26 '19 at 17:25
• one follow up question: once I find the roots using the Weierstrass transformation, I will get an expression that relates $\phi$ to $\theta$. Now, what do I do with that? Do I evaluate $\theta$ for all $\phi$ from $0$ to $2\pi$ to find the resulting intersection? – StackMonkey Jul 19 '19 at 17:36