Consider the following ellipse, generated by the bounding region of the following points
ps = {{-11, 5}, {-12, 4}, {-10, 4}, {-9, 5}, {-10, 6}};
rec = N@BoundingRegion[ps, "FastEllipse"];
Graphics[{rec, Red, Point@ps}]
We have that the ellipse 'rec' is given in the form
Ellipsoid[{-10.4, 4.8}, {{2.77333, 0.853333}, {0.853333, 1.49333}}]
How can I retrieve the lengths of the two main axes of such ellipsoid? Following this representation and Mathematica's general definition of Ellipsoid
I tried the following, using the eigenvalues of rec[[2]]
eigs = Eigenvectors[Inverse[rec[[2]]]]
eigv = Eigenvalues[Inverse[rec[[2]]]];
lens = 2/Sqrt[eigv]
Out[]= {2.06559, 3.57771}
where the 2
factor comes from the fact what what I retrieve from the eigenvalues is actually half the length of the main axis. Indeed we get
Graphics[{rec, Red, Point@ps,
Blue, Line[
RegionCentroid@rec + # & /@ {-(lens[[1]] eigs[[1]])/
2, (lens[[1]] eigs[[1]])/2}],
Line[RegionCentroid@rec + # & /@ {-(lens[[2]] eigs[[2]])/
2, (lens[[2]] eigs[[2]])/2}]}]
Is this correct? Is there a quicker way of doing this?