FitEllipse2D
jhpro.fit

Class FitEllipse2D



  • public class FitEllipse2Dextends Object
    Fit 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 Detail

      • FitEllipse2D

        public FitEllipse2D(double[] x,            double[] y)
        Creates a new instance of Ellipse, defined by a set of points
        Parameters:
        x - array of abscissae
        y - 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 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 Double getMajor()
        Report the 1/2 length of the major axis
        Returns:
        the half major length
      • getMinor

        public Double getMinor()
        Report the 1/2 length of the minor axis
        Returns:
        the half minor length
      • main

        public static void main(String[] args)
      • doc

        public void doc()
        Show online documentation.

SCaVis 2.1 © jWork.ORG