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.

  • $\begingroup$ Are you sure you mean axis lengths and not semiaxis lengths? That's what $a$ and $b$ usually denote for an ellipse. $\endgroup$ – joriki Oct 14 '12 at 19:56
  • $\begingroup$ OK, I edited that. $a$ and $b$ are the semi-axes lengths. Anyway, those are given, in the final solution it will be two times less or more. $\endgroup$ – simco Oct 14 '12 at 20:01
  • $\begingroup$ $$b^2\left(c(x_i-M_x) - s(y_i - M_y)\right)^2 + a^2\left(s(x_i-M_x) + c(y - M_y)\right)^2 = a^2b^2$$ for $i\in\{1,2,3\}$ together with $s^2+c^2=1$ gives four equations in four variables ($M_x, M_y, s, c$), but so non-linear that my CAS won't solve them out of the box. So phrasing the problem for analytic geometry sounds fine, but actually solving it that way still requires work. $\endgroup$ – MvG Oct 15 '12 at 11:15
  • $\begingroup$ Thank you for your effort. You have a typo, your last $y$ should be $y_i$. What do you mean by "my CAS"? $\endgroup$ – simco Oct 15 '12 at 11:35
  • $\begingroup$ 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. In my case that's maxima, as a backend to sage. $\endgroup$ – MvG Oct 15 '12 at 11:38

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.

  • $\begingroup$ Tnx joriki! Does this mean that we might have 3 solutions in some case for the three points? $\endgroup$ – simco Oct 18 '12 at 21:08
  • $\begingroup$ @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. $\endgroup$ – joriki Oct 19 '12 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.