Finding the Minor and major axis lenths of an ellipse from conjugate diameters

1. Feb 2, 2012

Vinni

Hello,

I'm having a problem finding the minor and major axsis lengths of an ellipse from three points, the ellipse's center, and two conjugate end point diameters. I have no problem solving the problem when the conjugate diameters align with the minor and major axsis, but when they don't the problem seems to evade me.

Any help with this would be much appreciated.

Vinni

2. Feb 4, 2012

Vinni

The image below is the supposed solution for solving the minor and major axis of an ellipse from two conjugate diameter end points. Note that λ is not defined, which makes the solution for b impossible. I used the sum of the squares of conjugate semi-diameters rule where it is constant and therefore equal to the sum of the squares of a and b. Subtracting a squared gives me b squared. However the solution described in the image doesn't work in every case. a ends up being too small in some cases, can anybody see why that is?

Below is my code listing in c# of the solution described at the link.

//Adjusts the points to the origin for simplicity
double x1 = conjugateDiameter1.X - Center.X;
double y1 = conjugateDiameter1.Y - Center.Y;
double x2 = conjugateDiameter2.X - Center.X;
double y2 = conjugateDiameter2.Y - Center.Y;
///

double xc = (x2 + y1) / 2;

double yc = (y2 - x1) / 2;

double Waw = Math.Atan2(yc - y2, x2 - xc);

double phi = Math.Atan2(yc, xc);

double d = xc / Math.Cos(phi);

double yu = yc + d * Math.Sin(Waw);

double xv = xc + d * Math.Cos(Waw);

double yv = yc - d * Math.Sin(Waw);

double alpha = Math.Atan2(-yv,xv);

a = (yu - y2) / Math.Sin(Waw);

b = Math.Sqrt((Math.Pow(SemiDiag1, 2) + Math.Pow(SemiDiag2, 2)) - Math.Pow(a, 2));

Last edited: Feb 4, 2012
3. Feb 4, 2012

Vinni

Found the problem the sin function has exceptions at 0, 3.14, and 6.28 radians. While the cos function has exceptions at 1.57 and 4.71 radians. When the ellipse is oriented at those angles then the a and b axis are the conjugate semi-diameters. Also the computation for alpha shouldn't have a negative sign in the numerator.