I have ellipses that are not aligned with the x-axis and are not centered at the origin. Hence, their defined by either of the following two equations:
$\left(\frac{(x-x_{centroid})*Cos[\theta]+(y-y_{centroid})*Sin[\theta]}{r_{major}}\right)^2+\left(\frac{(y-y_{centroid})*Cos[\theta]-(x-x_{centroid})*Sin[\theta]}{r_{minor}}\right)^2 = 1$
OR
$A \cdot x^2+B \cdot xy+C \cdot y^2+D \cdot x+E\cdot y+F=0$
The ellipses are completely defined.
Is there a fast method to determine their major and minor axis as well as the angle the major axis is oriented off the x-axis?
I currently have a computational solver which solves the maximum and minimum distance from the center of the ellipse to the ellipse surface, however, it is not very efficient and takes a rather long time. Hence, an explicit equation would be much better to work with.
Thank you very much for any input.
Found the solution online here: http://mathworld.wolfram.com/Ellipse.html
Summarized here;
For the general form of the ellipse equation:
$a~{\cdot}~x^2+2~{\cdot}~b~x~y+c~{\cdot}~y^2+2~{\cdot}~d~x+2~{\cdot}~f~y+g=0$
The semi-axes lengths are:
$a'=\sqrt{\frac{2(a~f^2+c~d^2+g~b^2-2~b~d~f-a~c~g)}{(b^2-a~c)\left[\sqrt{(a-c)^2+4b^2}-(a+c)\right]}}$
$b'=\sqrt{\frac{2(a~f^2+c~d^2+g~b^2-2~b~d~f-a~c~g)}{(b^2-a~c)\left[-\sqrt{(a-c)^2+4b^2}-(a+c)\right]}}$