jhpro.fit
Class FitEllipse2D
- java.lang.Object
-
- jhpro.fit.FitEllipse2D
-
public class FitEllipse2D extends java.lang.ObjectFit 2D data points with a ellipse using least-square fitting. The method implements the direct algorithm of Fitzgibbon et al, improved by Halir et al, to find the ellipse which best approximates a collection of points. The ellipse is defined through the 6 coefficients of its algebraic equation:A*x**2 + B*x*y + C*y**2 + D*x + E*y + F = 0
It can also compute the ellipse characteristics (center, theta, major, minor) from its algebraic equation.
-
-
Constructor Summary
Constructors Constructor and Description FitEllipse2D(double[] x, double[] y)Creates a new instance of Ellipse, defined by a set of pointsFitEllipse2D(P1D p)Creates a new instance of Ellipse, defined by P1D
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddoc()Show online documentation.doublegetAngle()Report the angle between the major axis and the abscissae axisjava.awt.geom.Point2D.DoublegetCenter()Report the center of the ellipse, using the same coordinate system as the defining data pointsdoublegetCenterX()Report the center of the ellipse in XdoublegetCenterY()Report the center of the ellipse in Ydouble[]getCoefficients()Report the coefficients of the ellipse, as defined by the algebraic equationdoublegetDistance()Report the mean algebraic distance between the data points and the ellipseEllipsegetEllipse()Return fitted ellipse.Ellipse2DgetEllipse2D()Return fitted ellipse.java.lang.DoublegetMajor()Report the 1/2 length of the major axisjava.lang.DoublegetMinor()Report the 1/2 length of the minor axisstatic voidmain(java.lang.String[] args)
-
-
-
Constructor Detail
-
FitEllipse2D
public FitEllipse2D(double[] x, double[] y)Creates a new instance of Ellipse, defined by a set of points- Parameters:
x- array of abscissaey- array of ordinates
-
FitEllipse2D
public FitEllipse2D(P1D p)
Creates a new instance of Ellipse, defined by P1D- Parameters:
P1D- input
-
-
Method Detail
-
getAngle
public double getAngle()
Report the angle between the major axis and the abscissae axis- Returns:
- the major axis angle, in radians
-
getCenter
public java.awt.geom.Point2D.Double getCenter()
Report the center of the ellipse, using the same coordinate system as the defining data points- Returns:
- the ellipse center
-
getCenterX
public double getCenterX()
Report the center of the ellipse in X- Returns:
- the ellipse center in X
-
getCenterY
public double getCenterY()
Report the center of the ellipse in Y- Returns:
- the ellipse center in Y
-
getEllipse2D
public Ellipse2D getEllipse2D()
Return fitted ellipse.- Returns:
- fitted ellipse.
-
getEllipse
public Ellipse getEllipse()
Return fitted ellipse.- Returns:
- fitted ellipse.
-
getCoefficients
public double[] getCoefficients()
Report the coefficients of the ellipse, as defined by the algebraic equation- Returns:
- the algebraic coefficients, all packed in one array
-
getDistance
public double getDistance()
Report the mean algebraic distance between the data points and the ellipse- Returns:
- the mean algebraic distance
-
getMajor
public java.lang.Double getMajor()
Report the 1/2 length of the major axis- Returns:
- the half major length
-
getMinor
public java.lang.Double getMinor()
Report the 1/2 length of the minor axis- Returns:
- the half minor length
-
main
public static void main(java.lang.String[] args)
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG