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

Click For Summary
SUMMARY

This discussion addresses the challenge of calculating the lengths of the minor and major axes of an ellipse using two conjugate diameters and the ellipse's center. The user, Vinni, identifies issues with the provided solution, particularly when the conjugate diameters do not align with the axes. The code snippet in C# demonstrates the adjustment of points to the origin and the calculation of the axes using trigonometric functions. Key problems include exceptions in the sine and cosine functions at specific angles, which affect the accuracy of the computed axes lengths.

PREREQUISITES
  • Understanding of ellipse geometry and properties
  • Familiarity with trigonometric functions and their exceptions
  • Proficiency in C# programming language
  • Knowledge of graphical tools for radius calculation
NEXT STEPS
  • Study the mathematical properties of ellipses, focusing on conjugate diameters
  • Learn about handling exceptions in trigonometric functions in programming
  • Explore advanced C# techniques for geometric calculations
  • Investigate graphical libraries in C# for visualizing ellipses and their properties
USEFUL FOR

Mathematicians, software developers, and engineers working with geometric computations, particularly those focusing on ellipse properties and graphical representations.

Vinni
Messages
31
Reaction score
0
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
 
Physics news on Phys.org
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?

Solution.png


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);

double SemiDiag1 = GraphicTools.GetRadius(Center, Diameter1);
double SemiDiag2 = GraphicTools.GetRadius(Center, Diameter2);

b = Math.Sqrt((Math.Pow(SemiDiag1, 2) + Math.Pow(SemiDiag2, 2)) - Math.Pow(a, 2));
 
Last edited:
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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 27 ·
Replies
27
Views
6K
  • · Replies 3 ·
Replies
3
Views
10K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 12 ·
Replies
12
Views
7K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
13K