1

It's some years since I did math and I can't, for the life of me remember how to solve equations.

I am trying to find the centre of an ellipse from the radii and $2$ points on the ellipse using : $$\frac{(x_A-C_x)^2}{a^2} + \frac{(y_A-C_y)^2}{b^2} = 1$$

where $(x_A,y_A)=A$ and $a$ and $b$ are the semi-major axis and the semi-minor axis. $(C_x,C_y)$ are the coordinates of the centre.

If $x_B$ and $y_B$ are the coordinates of another point on the ellipse, then I get the following: $$\frac{(x_A-C_x)^2}{a^2} + \frac{(y_A-C_y)^2}{b^2} = \frac{(x_B-C_x)^2}{a^2} + \frac{(y_B-C_y)^2}{b^2}$$

Which I can expand:

$b*b*(xa*xa+cx*cx-2*xa*cx)+a*a(ya*ya+cy*cy-2*ya*cy)=b*b*(xb*xb+cx*cx-2*xb*cx)+a*a(yb*yb+cy*cy-2*yb*cy)$

and from there:

$b*b*xa*xa+b*b*cx*cx-2*b*b*xa*cx+a*a*ya*ya+a*a*cy*cy-2*a*a*ya*cy=b*b*xb*xb+b*b*cx*cx-2*b*b*xb*cx+a*a*yb*yb+a*a*cy*cy-2*a*a*yb*cy$

And then

$b*b*xa*xa-2*b*b*xa*cx+a*a*ya*ya-2*a*a*ya*cy=b*b*xb*xb-2*b*b*xb*cx+a*a*yb*yb-2*a*a*yb*cy$

Now what?

I'm damned if I can remember what to do next.

[Edit] I've got down to this: $(a*a*ya*ya-2*a*a*ya*cy-b*b*xb*xb-a*a*yb*yb+2*a*a*yb*cy)/2*b*b*(xa-xb)=cx$, but as far as I can see, I still need to resolve cy before I can work out cx.[/Edit]

PS. This question was mistakenly posted on the Programming section: https://stackoverflow.com/questions/43468181/solving-equations-for-an-ellipse?

Wolgwang
  • 1,563
  • I have already answeared your question on stackoverflow :)
    http://stackoverflow.com/questions/43468181/solving-equations-for-an-ellipse/43473049#43473049
    – Arkadiusz Apr 18 '17 at 13:18
  • Hi Arkdiusz, I saw your answer: thanks. I need to find the point cx,cy. I can plug in the values for the two points on the ellipse and can also use the semi- major and minor axis, but I don't have the centre point. I'm trying to use the equation to find it. – Dave Coventry Apr 18 '17 at 13:34
  • Please format your equations using MathJax. They’re nigh unreadable right now. – amd Apr 18 '17 at 17:54
  • Two points aren’t enough to determine a unique center point, as you’re discovering. Unless the center is on the chord joining those points, there are two possibilities. – amd Apr 18 '17 at 18:03
  • Mathjax? Ok, I'll look into it. Thanks. I should have mentioned that I'm writing a little python converter to convert SVG files into DXF, so I have the Large Arc flag and the sweep flag to dictate which side of the chord the centre falls. – Dave Coventry Apr 18 '17 at 20:09

1 Answers1

1

Note that centre $C=(X,Y)$ is either one of the intersection for

$$ \left \{ \begin{array}{ccccc} \dfrac{(X-x_A)^2}{a^2}+\dfrac{(Y-y_A)^2}{b^2} & = & 1 & \cdots \cdots & (1) \\ \dfrac{(X-x_B)^2}{a^2}+\dfrac{(Y-y_B)^2}{b^2} & = & 1 & \cdots \cdots & (2) \end{array} \right.$$

The point $C$ also lies on the conjugate diameter w.r.t. chord $AB$ namely

$$ \frac{(X-x_A)^2}{a^2}+\frac{(Y-y_A)^2}{b^2}= \frac{(X-x_B)^2}{a^2}+\frac{(Y-y_B)^2}{b^2}$$

$$ \frac{2(x_A-x_B)X}{a^2}+\frac{2(y_A-y_B)Y}{b^2}= \frac{x_A^2-x_B^2}{a^2}+\frac{y_A^2-y_B^2}{b^2}$$

In principle, it is solvable

$$X=\frac{x_A+x_B}{2} \pm \frac{a(y_A-y_B)}{2b} \sqrt{\frac{4}{\dfrac{(x_A-x_B)^2}{a^2}+\dfrac{(y_A-y_B)^2}{b^2}}-1}$$

$$Y=\frac{y_A+y_B}{2} \mp \frac{b(x_A-x_B)}{2a} \sqrt{\frac{4}{\dfrac{(x_A-x_B)^2}{a^2}+\dfrac{(y_A-y_B)^2}{b^2}}-1}$$

Ng Chung Tak
  • 18,990