Class Quadric

All Implemented Interfaces:
Serializable

public class Quadric extends BaseQuadric implements Serializable
This class contains the implementation of a quadric.
See Also:
  • Constructor Details

    • Quadric

      public Quadric()
      Constructor.
    • Quadric

      public Quadric(double a, double b, double c, double d, double e, double f, double g, double h, double i, double j)
      Constructor of this class. This constructor accepts every parameter describing a quadric (parameters a, b, c, d, e, f, g, h, i, j).
      Parameters:
      a - Parameter A of the quadric.
      b - Parameter B of the quadric.
      c - Parameter C of the quadric.
      d - Parameter D of the quadric.
      e - Parameter E of the quadric.
      f - Parameter F of the quadric.
      g - Parameter G of the quadric.
      h - Parameter H of the quadric.
      i - Parameter I of the quadric.
      j - Parameter J of the quadric.
    • Quadric

      public Quadric(com.irurueta.algebra.Matrix m) throws NonSymmetricMatrixException
      Constructor of this class. This constructor accepts a Matrix describing a quadric.
      Parameters:
      m - Matrix describing a quadric 4x4 Matrix describing the quadric.
      Throws:
      IllegalArgumentException - Raised when the size of the matrix is not 4x4.
      NonSymmetricMatrixException - Raised when the quadric matrix is not symmetric.
    • Quadric

      public Quadric(Point3D point1, Point3D point2, Point3D point3, Point3D point4, Point3D point5, Point3D point6, Point3D point7, Point3D point8, Point3D point9) throws CoincidentPointsException
      Creates quadric where provided points are contained (are locus).
      Parameters:
      point1 - 1st point.
      point2 - 2nd point.
      point3 - 3rd point.
      point4 - 4th point.
      point5 - 5th point.
      point6 - 6th point.
      point7 - 7th point.
      point8 - 8th point.
      point9 - 9th point.
      Throws:
      CoincidentPointsException - Raised if points are coincident or produce a degenerated configuration.
  • Method Details

    • isLocus

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

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

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

      public boolean arePerpendicularPoints(Point3D pointA, Point3D pointB, double threshold)
      Checks if two points are perpendicular in the geometry base generated by this quadric.
      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 quadric 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.
    • arePerpendicularPoints

      public boolean arePerpendicularPoints(Point3D pointA, Point3D pointB)
      Checks if two points are perpendicular in the geometry base generated by this quadric.
      Parameters:
      pointA - First point.
      pointB - Second point.
      Returns:
      True if points are perpendicular, false otherwise.
      See Also:
    • dualQuadric

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

      public DualQuadric getDualQuadric() throws DualQuadricNotAvailableException
      Computes the dual quadric of this quadric. The dual quadric is equal to the inverse of the quadric matrix
      Returns:
      A new DualQuadric corresponding to the dual quadric of this instance.
      Throws:
      DualQuadricNotAvailableException - Raised if the dual quadric does not exist because this quadric instance is degenerate (its inverse cannot be computed).
    • setParametersFromPoints

      public final void setParametersFromPoints(Point3D point1, Point3D point2, Point3D point3, Point3D point4, Point3D point5, Point3D point6, Point3D point7, Point3D point8, Point3D point9) throws CoincidentPointsException
      Sets parameters of this quadric 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.
      point6 - 6th point.
      point7 - 7th point.
      point8 - 8th point.
      point9 - 9th point.
      Throws:
      CoincidentPointsException - Raised if points are coincident or produce a degenerated configuration.
    • getTangentPlaneAt

      public Plane getTangentPlaneAt(Point3D point) throws NotLocusException
      Returns a plane tangent to this quadric at provided point, as long as the provided point is locus of this quadric.
      Parameters:
      point - point where plane must be tangent to quadric.
      Returns:
      a plane tangent to this quadric.
      Throws:
      NotLocusException - if provided point is not locus of this quadric.
    • tangentPlaneAt

      public void tangentPlaneAt(Point3D point, Plane plane, double threshold) throws NotLocusException
      Computes a plane tangent to this quadric at provided point, as long as the provided point is locus of this quadric up to provided threshold.
      Parameters:
      point - point where plane must be tangent to quadric.
      plane - plane where computed result will be stored.
      threshold - threshold to determine if provided point is locus or not of this quadric. Usually this is a small value close to zero.
      Throws:
      NotLocusException - if provided point is not locus of this quadric.
      IllegalArgumentException - if provided threshold is negative.
    • intersectWith

      public void intersectWith(Plane plane, Conic result)
      Intersects this quadric with provided plane. Notice that result of intersection is expressed on original quadric coordinates. If resulting conic needs to be expressed in terms of plane coordinates, then the plane and the conic must be rotated so that the plane becomes an xy-plane.
      Parameters:
      plane - plane to intersect this quadric with.
      result - instance where resulting intersection will be stored.
    • intersectWith

      public Conic intersectWith(Plane plane)
      Intersects this quadric with provided plane.
      Parameters:
      plane - plane to intersect this quadric with.
      Returns:
      conic resulting from the intersection.