FitEllipse Cellzilla2D Home

Description

Fits an ellipse to a set of points.

Needs["Cellzilla2D`"];

Return Value

FitEllipse[{{x1,y}, {x2, y2}, ...}] returns information about a "best fit" ellipse as an option list:

"Angle"→angle (in radians) between semimajor-axis and x-axis

"Axes"→{vx,vy} vector in direction of semi-major axis and length equal to semi-major axis;

"Graphics"→graphics object with simple plot of object and directions of major and minor axes.

Options

Example

[ Download Example as Zipped Mathematica Notebook ]

Implementation Notes

The primary axes are found by first translating the ellipse into center-of-mass coordinates V={{x1', y1'), {x2',y2'},...} where each {xi', yi'}={xi,yi}-{xc,yc}, and {xc,yc} is the center of mass. Then the eigenvalues and eigenvectors of the matrix

M=VTV
are calculated. The ratio of of semi-major to semi-minor axis is taken as the square root of the ratio of the larger eigenvalue to the smaller eigenvalue. The actual values of a and be determined so that πab equals the area of the original polygon. The directions of the semi-major and semi-minor axes are given by the normalized eigenvectors.

See Also

PrimaryAxes



[2012 Nov 9 ]