Class EllipseStandardFormConverter

Object
EllipseStandardFormConverter

public class EllipseStandardFormConverter extends Object
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 Details

    • EllipseStandardFormConverter

      public EllipseStandardFormConverter(cern.colt.matrix.DoubleMatrix1D matrix) throws CreateException
      Creates a new EllipseStandardFormConverter and 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

      public Point2d centerPoint()
      Gets the center point of the ellipse.
      Returns:
      a Point2d representing 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