Class Conic

All Implemented Interfaces:
Serializable

public class Conic extends BaseConic implements Serializable
This class contains the implementation of a conic.
See Also:
  • Constructor Details

    • Conic

      public Conic()
      Constructor.
    • Conic

      public Conic(double a, double b, double c, double d, double e, double f)
      Constructor of this class. This constructor accepts every parameter describing a conic (parameters a, b, c, d, e, f).
      Parameters:
      a - Parameter A of the conic.
      b - Parameter B of the conic.
      c - Parameter C of the conic.
      d - Parameter D of the conic.
      e - Parameter E of the conic.
      f - Parameter F of the conic.
    • Conic

      public Conic(com.irurueta.algebra.Matrix m) throws NonSymmetricMatrixException
      This method sets the matrix used to describe a conic. This matrix must be 3x3 and symmetric.
      Parameters:
      m - 3x3 Matrix describing the conic.
      Throws:
      IllegalArgumentException - Raised when the size of the matrix is not 3x3.
      NonSymmetricMatrixException - Raised when the conic matrix is not symmetric.
    • Conic

      public Conic(Point2D point1, Point2D point2, Point2D point3, Point2D point4, Point2D point5) throws CoincidentPointsException
      Creates conic where provided points are contained (are locus).
      Parameters:
      point1 - 1st point.
      point2 - 2nd point.
      point3 - 3rd point.
      point4 - 4th point.
      point5 - 5th point.
      Throws:
      CoincidentPointsException - Raised if points are coincident or produce a degenerated configuration.
  • Method Details

    • isLocus

      public boolean isLocus(Point2D point, double threshold)
      Checks if the given point is locus (lies within) this conic.
      Parameters:
      point - Point to be checked.
      threshold - Threshold of distance to determine whether the point is locus of the conic or not. Threshold might be needed because of machine precision issues. If not provided DEFAULT_LOCUS_THRESHOLD will be used instead.
      Returns:
      True if the point lies within this conic, false otherwise.
      Throws:
      IllegalArgumentException - Raised if threshold is negative.
    • isLocus

      public boolean isLocus(Point2D point)
      Checks if the given point is locus (lies within) this conic.
      Parameters:
      point - Point to be checked.
      Returns:
      True if the point lies within this conic, false otherwise.
      See Also:
    • angleBetweenPoints

      public double angleBetweenPoints(Point2D pointA, Point2D pointB)
      Computes the angle between two 2D points using this conic as a geometry base.
      Parameters:
      pointA - First point.
      pointB - Second point.
      Returns:
      Angle between provided points given in radians..
    • arePerpendicularPoints

      public boolean arePerpendicularPoints(Point2D pointA, Point2D pointB, double threshold)
      Checks if two points are perpendicular in the geometry base generated by this conic.
      Parameters:
      pointA - First point.
      pointB - Second point.
      threshold - Threshold to determine whether the points are perpendicular or not. If the dot product between provided points and this conic is greater than provided threshold, then points won't be assumed to be perpendicular. Threshold is provided because of machine precision limits, if not provided DEFAULT_PERPENDICULAR_THRESHOLD will be used instead.
      Returns:
      True if points are perpendicular, false otherwise.
      Throws:
      IllegalArgumentException - Raised if threshold is negative.
    • dualConic

      public void dualConic(DualConic dualConic) throws DualConicNotAvailableException
      Sets the values of the dual conic corresponding to this conic instance into provided dualConic instance. The dual conic is equal to the inverse of the conic matrix.
      Parameters:
      dualConic - Dual conic instance where the values of the dual conic of this conic instance will be stored.
      Throws:
      DualConicNotAvailableException - Raised if the dual conic does not exist because this conic instance is degenerate (its inverse cannot be computed).
    • getDualConic

      public DualConic getDualConic() throws DualConicNotAvailableException
      Computes the dual conic of this conic. The dual conic is equal to the inverse of the conic matrix.
      Returns:
      A new DualConic corresponding to the dual conic of this instance.
      Throws:
      DualConicNotAvailableException - Raised if the dual conic does not exist because this conic instance is degenerate (its inverse cannot be computed).
    • getConicType

      public ConicType getConicType()
      Returns the ConicType of this conic.
      Returns:
      A ConicType describing the type of this conic. It can be one of the following: ELLIPSE_CONIC_TYPE, CIRCLE_CONIC_TYPE, PARABOLA_CONIC_TYPE, HYPERBOLA_CONIC_TYPE and RECTANGULAR_HYPERBOLA_CONIC_TYPE.
    • setParametersFromPoints

      public final void setParametersFromPoints(Point2D point1, Point2D point2, Point2D point3, Point2D point4, Point2D point5) throws CoincidentPointsException
      Sets parameters of this conic so that provided points lie within it (are locus).
      Parameters:
      point1 - 1st point.
      point2 - 2nd point.
      point3 - 3rd point.
      point4 - 4th point.
      point5 - 5th point.
      Throws:
      CoincidentPointsException - Raised if points are coincident or produce a degenerated configuration.
    • getTangentLineAt

      public Line2D getTangentLineAt(Point2D point) throws NotLocusException
      Returns a line tangent to this conic at provided point. Provided point must be locus of this conic, otherwise a NotLocusException will be thrown.
      Parameters:
      point - a locus point of this conic.
      Returns:
      A 2D line tangent to this conic at provided point.
      Throws:
      NotLocusException - if provided point is not locus of this conic up to DEFAULT_LOCUS_THRESHOLD.
    • tangentLineAt

      public void tangentLineAt(Point2D point, Line2D line, double threshold) throws NotLocusException
      Computes a line tangent to this conic at provided point. Provided point must be locus of this conic, otherwise a NotLocusException will be thrown.
      Parameters:
      point - a locus point of this conic.
      line - instance of a 2D line where result will be stored.
      threshold - threshold to determine if provided point is locus.
      Throws:
      NotLocusException - if provided point is not locus of this conic up to provided threshold.
      IllegalArgumentException - if provided threshold is negative.
    • createCanonicalAbsoluteConic

      public static Conic createCanonicalAbsoluteConic()
      Creates a canonical instance of the absolute conic in the metric stratum. The absolute conic in the metric stratum is the intersection of the absolute quadric with the plane at the infinity. Both the absolute conic and the dual absolute conic define orthogonality in the metric stratum, and in a purely metric stratum (i.e. when camera is correctly calibrated), their canonical value is equal to the identity.
      Returns:
      a canonical instance of the absolute conic.