Class DualConic

java.lang.Object
com.irurueta.geometry.BaseConic
com.irurueta.geometry.DualConic
All Implemented Interfaces:
Serializable

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

    • DualConic

      public DualConic()
      Constructor.
    • DualConic

      public DualConic(double a, double b, double c, double d, double e, double f)
      Constructor of this class. This constructor accepts every parameter describing a dual 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.
    • DualConic

      public DualConic(com.irurueta.algebra.Matrix m) throws NonSymmetricMatrixException
      This method sets the matrix used to describe a dual 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.
    • DualConic

      public DualConic(Line2D line1, Line2D line2, Line2D line3, Line2D line4, Line2D line5) throws CoincidentLinesException
      Instantiates a dual conic where provided lines belong to its locus.
      Parameters:
      line1 - 1st line.
      line2 - 2nd line.
      line3 - 3rd line.
      line4 - 4th line.
      line5 - 5th line.
      Throws:
      CoincidentLinesException - Raised if provided lines are coincident (more than one line is equal) or produce a degenerate configuration.
  • Method Details

    • isLocus

      public boolean isLocus(Line2D line, double threshold)
      Checks if provided line is locus of this dual conic, or in other words, checks whether provided line lies within this conic, or whether provided line is tangent to the conic corresponding to this dual conic.
      Parameters:
      line - Line2D to be tested.
      threshold - Threshold of tolerance to determine whether the line is locus or not. This is needed because of limited machine precision. If threshold is not provided, then DEFAULT_LOCUS_THRESHOLD is used instead.
      Returns:
      True if provided line is locus of this dual conic, false otherwise.
      Throws:
      IllegalArgumentException - Raised if provided threshold is negative.
    • isLocus

      public boolean isLocus(Line2D line)
      Checks if provided line is locus of this dual conic, or in other words, checks whether provided line lies within this conic, or whether provided line is tangent to the conic corresponding to this dual conic.
      Parameters:
      line - Line2D to be tested.
      Returns:
      True if provided line is locus of this dual conic, false otherwise.
      See Also:
    • angleBetweenLines

      public double angleBetweenLines(Line2D lineA, Line2D lineB)
      Computes the angle between two lines in radians.
      Parameters:
      lineA - First line to be tested.
      lineB - Second line to be tested.
      Returns:
      Angle between the two provided lines in radians.
    • arePerpendicularLines

      public boolean arePerpendicularLines(Line2D lineA, Line2D lineB, double threshold)
      Checks if two lines are perpendicular attending to the geometry defined by this dual conic, or in other words, if lA' * dualC* * lB is zero.
      Parameters:
      lineA - First line to be checked.
      lineB - Second line to be checked.
      threshold - Threshold of tolerance to determine whether the lines are perpendicular or not. This is needed because of limited machine precision. If threshold is not provided, then DEFAULT_PERPENDICULAR_THRESHOLD is used instead.
      Returns:
      True if provided lines are perpendicular, false otherwise.
      Throws:
      IllegalArgumentException - Raised if provided threshold is negative.
    • arePerpendicularLines

      public boolean arePerpendicularLines(Line2D lineA, Line2D lineB)
      Checks if two lines are perpendicular attending to the geometry defined by this dual conic, or in other words, if lA' * dualC* * lB is zero.
      Parameters:
      lineA - First line to be checked.
      lineB - Second line to be checked.
      Returns:
      True if provided lines are perpendicular, false otherwise.
    • getConic

      public Conic getConic() throws ConicNotAvailableException
      Computes the conic corresponding to this dual conic.
      Returns:
      A new conic instance of this dual conic.
      Throws:
      ConicNotAvailableException - Raised if the rank of the dual conic matrix is not complete due to wrong parameters or numerical instability.
    • conic

      public void conic(Conic conic) throws ConicNotAvailableException
      Computes the conic corresponding to this dual conic and stores the result in provided instance.
      Parameters:
      conic - Conic where result is stored.
      Throws:
      ConicNotAvailableException - Raised if the rank of the dual conic matrix is not complete due to wrong parameters or numerical instability.
    • setParametersFromLines

      public final void setParametersFromLines(Line2D line1, Line2D line2, Line2D line3, Line2D line4, Line2D line5) throws CoincidentLinesException
      Sets parameters of this dual conic so that provided lines lie within it (are locus).
      Parameters:
      line1 - 1st line.
      line2 - 2nd line.
      line3 - 3rd line.
      line4 - 4th line.
      line5 - 5th line.
      Throws:
      CoincidentLinesException - Raised if lines are coincident or produce a degenerated configuration.
    • createCanonicalDualAbsoluteConic

      public static DualConic createCanonicalDualAbsoluteConic()
      Creates a canonical instance of the dual absolute conic in the metric stratum. The intersection of the plane at infinity with the set of planes tangent to the dual absolute quadric produce the dual absolute conic. In other words, The dual absolute conic in the metric stratum is the set of lines tangent to the absolute conic that also lie in the plane at 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 dual absolute conic.