java.lang.Object
simpa.acc.api.utils.FitEllipse
Ellipse-fitting methods.
- Author:
- Michael Doube, modified by Lajos Bojtar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
fitData
(double[] xa, double[] ya) Fits an ellipse to all the points given in the x and y arrays.void
fitData
(double[] xa, double[] ya, int startIndex, int endIndex) Fits an ellipse to the points given in the x and y arrays starting from startIndex until endIndex exclusive.double[]
Convert variables a, b, c, d, f, g from the general ellipse equation ax^2 + b y^2 + c xy +dx + fy + g = 0 into useful geometric parameters semi-axis lengths, centre and angle of rotation.List
<org.apache.commons.math3.geometry.euclidean.twod.Vector2D> getPlotData
(int n) org.apache.commons.math3.geometry.euclidean.twod.Vector2D
getPointOnEllipse
(double fi) Gets a point on the ellipse with the given phasedouble
double
getXMax()
double
getXMin()
double
double
getYMax()
double
getYMin()
-
Constructor Details
-
FitEllipse
public FitEllipse()
-
-
Method Details
-
fitData
public void fitData(double[] xa, double[] ya) Fits an ellipse to all the points given in the x and y arrays.- Parameters:
xa
- X points.ya
- Y points.
-
fitData
public void fitData(double[] xa, double[] ya, int startIndex, int endIndex) Fits an ellipse to the points given in the x and y arrays starting from startIndex until endIndex exclusive.- Parameters:
xa
- X points.ya
- Y points.startIndex
- index to start from (inclusive)endIndex
- index to end (exclusive)
-
getDimensions
public double[] getDimensions()Convert variables a, b, c, d, f, g from the general ellipse equation ax^2 + b y^2 + c xy +dx + fy + g = 0 into useful geometric parameters semi-axis lengths, centre and angle of rotation.
- Returns:
array containing centroid coordinates, axis lengths and angle of rotation of the ellipse specified by the input variables.
Eq. 19-23 at Wolfram Mathworld Ellipse.
-
getPlotData
-
getPointOnEllipse
public org.apache.commons.math3.geometry.euclidean.twod.Vector2D getPointOnEllipse(double fi) Gets a point on the ellipse with the given phase- Parameters:
fi
- phase- Returns:
- A Vector2D object containing the coordinates of the point.
-
getYMax
public double getYMax()- Returns:
- Maximum Y value of the fitted ellipse
-
getYMin
public double getYMin()- Returns:
- Minimum Y value of the fitted ellipse
-
getXMax
public double getXMax()- Returns:
- Maximum X value of the fitted ellipse
-
getXMin
public double getXMin()- Returns:
- Minimum X value of the fitted ellipse
-
getYatXmax
public double getYatXmax()- Returns:
- Y value of the fitted ellipse at Xmax
-
getXatYmax
public double getXatYmax()- Returns:
- X value of the fitted ellipse at Ymax
-