Class EllipseStandardFormConverter
Object
EllipseStandardFormConverter
Extracts forms for 'standard form' representation of an ellipse from the coefficients for a 2nd
order polynomial describing the ellipse.
SEE 'Information About Ellipses' by Eberly (URL below) http://www.geometrictools.com/Documentation/InformationAboutEllipses.pdf
See Matlab Prototype (ls_ellipse/convert_to_standard_form.m)
The matrix coefficients are as follows (in a vector):
- 0 = x^2
- 1 = xy/2
- 2 = y^2
- 3 = x
- 4 = y
- 5 = c
-
Constructor Summary
ConstructorsConstructorDescriptionEllipseStandardFormConverter(cern.colt.matrix.DoubleMatrix1D matrix) Creates a newEllipseStandardFormConverterand performs the conversion. -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleatanHandlingNan(double val) Calculates the arctangent, handling NaN values.Gets the center point of the ellipse.doubleGets the x-coordinate of the ellipse's center point.doubleGets the y-coordinate of the ellipse's center point.doubleGets the angle of the major axis in radians.doubleGets the slope of the major axis.doubleGets the angle of the minor axis in radians.doubleGets the slope of the minor axis.doubleGets the length of the semi-major axis.doubleGets the length of the semi-minor axis.
-
Constructor Details
-
EllipseStandardFormConverter
Creates a newEllipseStandardFormConverterand performs the conversion.- Parameters:
matrix- the matrix of coefficients describing the ellipse- Throws:
CreateException- if the matrix does not describe an ellipse
-
-
Method Details
-
getCenterPointX
public double getCenterPointX()Gets the x-coordinate of the ellipse's center point.- Returns:
- the x-coordinate of the center point
-
getCenterPointY
public double getCenterPointY()Gets the y-coordinate of the ellipse's center point.- Returns:
- the y-coordinate of the center point
-
centerPoint
Gets the center point of the ellipse.- Returns:
- a
Point2drepresenting the center point
-
getSemiMajorAxis
public double getSemiMajorAxis()Gets the length of the semi-major axis.- Returns:
- the length of the semi-major axis
-
getSemiMinorAxis
public double getSemiMinorAxis()Gets the length of the semi-minor axis.- Returns:
- the length of the semi-minor axis
-
getMajorAxisAngle
public double getMajorAxisAngle()Gets the angle of the major axis in radians.- Returns:
- the angle of the major axis
-
getMinorAxisAngle
public double getMinorAxisAngle()Gets the angle of the minor axis in radians.- Returns:
- the angle of the minor axis
-
atanHandlingNan
public static double atanHandlingNan(double val) Calculates the arctangent, handling NaN values.- Parameters:
val- the value to calculate arctangent for- Returns:
- the arctangent in radians, or PI/2 if the input is NaN
-
getMajorAxisSlope
public double getMajorAxisSlope()Gets the slope of the major axis.- Returns:
- the slope of the major axis
-
getMinorAxisSlope
public double getMinorAxisSlope()Gets the slope of the minor axis.- Returns:
- the slope of the minor axis
-