3
$\begingroup$

Having three given points in the two-dimensional plane and semi-axis lengths $a$ and $b$ of an ellipse, how to determine the center? By construction (the "Euclidean way") or analytic geometry.

  • 0
    Yeah, noticed the typo myself, but that was after the grace period, so I couldn't edit my comment any more. CAS = [Computer Algebra System](https://en.wikipedia.org/wiki/Computer_algebra_system). In my case that's [maxima](http://maxima.sourceforge.net/), as$a$backend to [sage](http://www.sagemath.org/).2012-10-15

1 Answers 1

3

The equation of an axis-parallel ellipse with semiaxes $a$ and $b$ is

$ \left(\frac xa\right)^2+\left(\frac yb\right)^2=1\;. $

Thus, the equation of an arbitrary ellipse with centre at $(x_0,y_0)$ rotated by $\phi$ is

$ \left(\frac{x\cos\phi-y\sin\phi -x_0}a\right)^2+\left(\frac{x\sin\phi+y\cos\phi-y_0}b\right)^2=1\;. $

Subsituting your three points into this equation yields three equations for the three unknowns $x_0,y_0,\phi$. Subtracting two pairs of these from each other eliminates the constant terms quadratic in $x_0$ and $y_0$ and results in two equations, still with all three unknowns but now linear in $x_0$ and $y_0$. You can use these to express $x_0$ and $y_0$ solely in terms of $\phi$, namely as fractions of a homogeneous trigonometric polynomial of degree $3$ over one of degree $2$. Substituting these into the above equation and multiplying through by the square of their common denominator (which is the determinant of the $2\times2$ linear system for $x_0$ and $y_0$) yields a homogeneous trigonometic polynomial of degree $6$. This can be rewritten in terms of $\cos2\phi$ and $\sin2\phi$, and then taking the terms with a factor of $\sin2\phi$ to one side, squaring and using $\sin^22\phi=1-\cos^22\phi$ yields an algebraic equation of degree $6$ for $\cos2\phi$ that I think you'll have to solve numerically. You should check which of the resulting values of $\phi$ satisfies the unsquared equation, since the squaring may have introduced spurious solutions. You could also avoid the squaring by solving the trigonometric equation instead of the algebraic one; in that case you'll get two values of $\phi$ that differ by $\pi$ for each possible ellipse. Once you know all valid values of $\phi$, you can substitute them into the $2\times2$ system and solve for the corresponding values of $x_0$ and $y_0$.

You can see from a simple example that it makes sense that there can be up to six solutions: If the three points form an equilateral triangle and the semiaxes are such that the ellipse just fits between two of them with its tip at the third, with a little room to spare, then you can push it past the tip on either side to make it touch the two points; there are three ways to choose the points and two sides of the tip to move to, for a total of six different ways that you can get the ellipse to touch the points.

  • 0
    @simco: Sorry, there was an error; I've fixed it; you actually get not a cubic for $\cos^22\phi$ but a full sixth-order equation for $\cos2\phi$, which I think you'll have to solve numerically. I added a paragraph showing that there actually are cases in which all six solutions are valid.2012-10-19