hhreco.fragmentation
Class EllipseBasis

java.lang.Object
  extended byhhreco.fragmentation.Basis
      extended byhhreco.fragmentation.EllipseBasis

public class EllipseBasis
extends Basis

An EllipseBasis uses an ellipse to approximate a set of points. It is represented with (a,b,c,d,e,f) parameters as in a conic equation: ax^2+bxy+cy^2+dx+ey+f=0. Many properties of the fitted ellipse have been calculated, however to minimize the amount of computation, they can be turned off by not calling calcProperties.


Field Summary
 
Fields inherited from class hhreco.fragmentation.Basis
TYPE_ELLIPSE, TYPE_LINE
 
Constructor Summary
EllipseBasis(double[] xvals, double[] yvals, int num, double[] params)
          Create an ellipse basis where params give the parameters of an ellipse that best approximate the given set of points.
 
Method Summary
 int genPoints(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, double[] xpath, double[] ypath, int npts)
          Generate points from p1 to p2 in the direction of the stroke.
 java.awt.geom.Point2D getCenter()
          Return the center of the ellipse
 double getCircumference()
          Return the approximated circumference of this ellipse (the entier ellipse, not just the segment)
 double getEccentricity()
          Return the ratio of the norms of the two axes of the ellipse
 double[][] getEllipticalPoints()
          Return the data points of the elliptical segment that approximates the given set of points.
 java.awt.geom.Line2D getMajorAxis()
           
 double getMaxNorm()
          Return the magnitude of the major axis.
 java.awt.geom.Point2D getMidpoint()
          Return the mid point on the original stroke points
 double getMinNorm()
          Return the magnitude of the minor axis.
 java.awt.geom.Line2D getMinorAxis()
           
 int getNumEllipticalDataPoints()
          Return the number of data points used to represent the elliptical segment.
 
Methods inherited from class hhreco.fragmentation.Basis
getFitError, getNumPoints, getParams, getType, getXvals, getYvals, setFitError, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EllipseBasis

public EllipseBasis(double[] xvals,
                    double[] yvals,
                    int num,
                    double[] params)
Create an ellipse basis where params give the parameters of an ellipse that best approximate the given set of points. The fit error will be calcuated in the constructor, it require interpolating the given sequence of points in order to get a better approximation of distance.

Method Detail

genPoints

public int genPoints(java.awt.geom.Point2D p1,
                     java.awt.geom.Point2D p2,
                     double[] xpath,
                     double[] ypath,
                     int npts)
Generate points from p1 to p2 in the direction of the stroke. The number of points is specified by "npts". Return 0 if the process is not successful. Otherwise return the number of points generated.


getCenter

public java.awt.geom.Point2D getCenter()
Return the center of the ellipse


getMidpoint

public java.awt.geom.Point2D getMidpoint()
Return the mid point on the original stroke points


getCircumference

public double getCircumference()
Return the approximated circumference of this ellipse (the entier ellipse, not just the segment)


getEccentricity

public double getEccentricity()
Return the ratio of the norms of the two axes of the ellipse


getEllipticalPoints

public double[][] getEllipticalPoints()
Return the data points of the elliptical segment that approximates the given set of points. _points[0][] = xvals _points[1][] = yvals


getMajorAxis

public java.awt.geom.Line2D getMajorAxis()

getMinorAxis

public java.awt.geom.Line2D getMinorAxis()

getMaxNorm

public double getMaxNorm()
Return the magnitude of the major axis.


getMinNorm

public double getMinNorm()
Return the magnitude of the minor axis.


getNumEllipticalDataPoints

public int getNumEllipticalDataPoints()
Return the number of data points used to represent the elliptical segment.