Standard Form Ellipse Through Three Points and Parallel to X and Y Axes I want the general form $\frac{(x-x_0)^2}{a^2}+\frac{(y-y_0)^2}{b^2}=1$ for an ellipse with a specified eccentricity $e$ that passes through three (non-collinear) points $(x_1,y_1), (x_2, y_2), (x_3, y_3)$ and is parallel to the X and Y axes (i.e. major axis of ellipse parallel to the X axis and minor axis parallel to the Y axis).
I found this gem on Wikipedia:
$$
\frac{({\color{red}x} - x_1)({\color{red}x} - x_2) + {\color{blue}q}\;({\color{red}y} - y_1)({\color{red}y} - y_2)}
             {({\color{red}y} - y_1)({\color{red}x} - x_2) - ({\color{red}y} - y_2)({\color{red}x} - x_1)} =
        \frac{(x_3 - x_1)(x_3 - x_2) + {\color{blue}q}\;(y_3 - y_1)(y_3 - y_2)}
             {(y_3 - y_1)(x_3 - x_2) - (y_3 - y_2)(x_3 - x_1)}\ .
$$
where ${\color{blue}q} = \frac{a^2}{b^2} = \frac{1}{1 - e^2}$, which I think is supposed to work, but a) converting this equation to standard form is a bear (and maybe isn't doable?), and b) seems to introduce $xy$ terms which leads me to believe the ellipse will be tilted with respect to the X and Y axes.
Is this the right equation to be working with?  If so, is there a standard form of the equation?  Is there a different/better way to accomplish the task?
P.S. Having the standard form is pretty important: I'm going to use this with a graphics app where knowing $x_0, y_0, a,$ and $b$ is required.
 A: I would probably not try to work with the standard form equation directly but use the general form instead. However, I'd use the standard form equation to generate a 'simpler' general form equation.
First, since you have a specified eccentricity $e$, and $a > b$, we have
$$
\begin{align}
e &= \sqrt{\frac{a^2-b^2}{a^2}} \\
\\
a^2 e^2 &= a^2 - b^2 \\
\\
b^2 &= a^2 (1-e^2)
\end{align}
$$
Then, substituting this into the standard form equation gives
$$
\begin{align}
\frac{(x-x_0)^2}{a^2} + \frac{(y-y_0)^2}{a^2 (1-e^2)} &= 1 \\
\\
(1-e^2)(x-x_0)^2 + (y-y_0)^2 &= a^2 (1-e^2)
\end{align}
$$
From this it's clear that in expanded form, the coefficient of $x^2$ will be $(1-e^2)$ and the coefficient of $y^2$ will be $1$. Thus the general form equation will be
$$(1-e^2) \, x^2 + y^2 + D \, x + E \, y + F = 0$$
so using the three points you're given will yield a linear three-variable system which can be solved for $D, E \, $ and $\, F$. Then convert to standard form.
A: Alternatively, the equation can be re-arranged in a compact form:
$$
\begin{vmatrix}
  (1-e^2)x^2+y^2 & x & y & 1 \\
  (1-e^2)x_1^2+y_1^2 & x_1 & y_1 & 1 \\
  (1-e^2)x_2^2+y_2^2 & x_2 & y_2 & 1 \\
  (1-e^2)x_3^2+y_3^2 & x_3 & y_3 & 1
\end{vmatrix}=0$$
where $e\ne 1$ and comparing with the general form
$$Ax^2+Bxy+Cy^2+Dx+Ey+F=0$$
Now,
\begin{align}
  A &= (1-e^2) C \\ \\
  B &= 0 \\ \\
  C &=
  \begin{vmatrix}
    x_1 & y_1 & 1 \\
    x_2 & y_2 & 1 \\
    x_3 & y_3 & 1
  \end{vmatrix} \\ \\
  D &= -
  \begin{vmatrix}
    (1-e^2)x_1^2+y_1^2 & y_1 & 1 \\
    (1-e^2)x_2^2+y_2^2 & y_2 & 1 \\
    (1-e^2)x_3^2+y_3^2 & y_3 & 1
  \end{vmatrix} \\ \\
  E &=
  \begin{vmatrix}
    (1-e^2)x_1^2+y_1^2 & x_1 & 1 \\
    (1-e^2)x_2^2+y_2^2 & x_2 & 1 \\
    (1-e^2)x_3^2+y_3^2 & x_3 & 1
  \end{vmatrix} \\ \\
  F &= -
  \begin{vmatrix}
    (1-e^2)x_1^2+y_1^2 & x_1 & y_1 \\
    (1-e^2)x_2^2+y_2^2 & x_2 & y_2 \\
    (1-e^2)x_3^2+y_3^2 & x_3 & y_3
  \end{vmatrix} \\
\end{align}
Re-arrange the equation as
$$A
\left( x+\frac{D}{2A} \right)^2+
C
\left( y+\frac{E}{2C} \right)^2=
\frac{D^2}{4A}+\frac{E^2}{4C}-F$$
implying the centre is
$$\left( -\frac{D}{2A}, -\frac{E}{2C} \right)$$
and the semi-axes
$$
(a,b)=
\left(
  \sqrt{\frac{D^2}{4A^2}+\frac{E^2}{4AC}-\frac{F}{A}},
  \sqrt{\frac{D^2}{4AC}+\frac{E^2}{4C^2}-\frac{F}{C}}
\right)$$
for $0 \le e<1$.
A: Using Mathematica to do some symbol-crunching on the three-point formula, we get
(switching subscripts to $0$, $1$, $2$ to make modular arithmetic nicer):
$$\frac{(x - h)^2}{a^2m} + 
  \frac{(y - k)^2}{b^2m} = 1 \tag{$\star$}$$
where
$$\begin{align}
m & := \phantom{-}\frac {1} {4a^4 b^4 t^2}\prod_ {i = 0}^2\left (\; 
    a^2 (y_ {i + 1} - y_ {i - 1})^2 + b^2 (x_ {i + 1} - x_ {i - 1})^2 \;\right) \tag{1.m}\\[6pt]
h &:= \phantom{-}\frac {1} {2b^2t}\left (\; 
    a^2 (y_ 1 - y_ 2) (y_ 2 - y_ 0) (y_ 0 - y_ 1) + 
     b^2\sum_ {i = 0}^2 y_i (x^2 _ {i + 1} - 
         x^2 _ {i - 1})\; \right) \tag{1.h}\\[6 pt]
k &:= -\frac {1} {2a^2t}\left (\; 
    b^2 (x_ 1 - x_ 2) (x_ 2 - x_ 0) (x_ 0 - x_ 1) + 
     a^2\sum_ {i = 0}^2 x_i (y^2 _ {i + 1} - 
         y^2 _ {i - 1})\; \right) \tag{1.k}\\[6pt]
t &:= \phantom{-}\sum_{i=0}^2 \left( x_{i-1} y_{i+1} - x_{i+1} y_{i-1} \right)  \tag{1.t}
\end{align}$$
(with subscript arithmetic performed modulo $3$) and I've used $a$ and $b$ for notational balance and to add orientational flexibility. For an ellipse of eccentricity $e$ with a horizontal major axis, substitute $a\to 1$ and $b\to 1-e^2$; for a vertical major axis, substitute $a\to 1-e^2$ and $b\to 1$. $\square$
As a sanity check, one could/should verify that, when $a=b=1$ (that is, $e=0$), the above gives the equation of the circumcircle of the three given points. I'm out of time right now, so for the moment I'll leave that as an exercise to the reader.
