Package com.irurueta.geometry
Class Conic
java.lang.Object
com.irurueta.geometry.BaseConic
com.irurueta.geometry.Conic
- All Implemented Interfaces:
Serializable
This class contains the implementation of a conic.
- See Also:
-
Field Summary
Fields inherited from class com.irurueta.geometry.BaseConic
a, b, BASECONIC_MATRIX_COLUMN_SIZE, BASECONIC_MATRIX_ROW_SIZE, c, DEFAULT_LOCUS_THRESHOLD, DEFAULT_PERPENDICULAR_THRESHOLD, MIN_THRESHOLD, N_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleangleBetweenPoints(Point2D pointA, Point2D pointB) Computes the angle between two 2D points using this conic as a geometry base.booleanarePerpendicularPoints(Point2D pointA, Point2D pointB, double threshold) Checks if two points are perpendicular in the geometry base generated by this conic.static ConicCreates a canonical instance of the absolute conic in the metric stratum.voidSets the values of the dual conic corresponding to this conic instance into provided dualConic instance.Returns the ConicType of this conic.Computes the dual conic of this conic.getTangentLineAt(Point2D point) Returns a line tangent to this conic at provided point.booleanChecks if the given point is locus (lies within) this conic.booleanChecks if the given point is locus (lies within) this conic.final voidsetParametersFromPoints(Point2D point1, Point2D point2, Point2D point3, Point2D point4, Point2D point5) Sets parameters of this conic so that provided points lie within it (are locus).voidtangentLineAt(Point2D point, Line2D line, double threshold) Computes a line tangent to this conic at provided point.Methods inherited from class com.irurueta.geometry.BaseConic
asMatrix, asMatrix, getA, getB, getC, getD, getE, getF, isNormalized, normalize, setA, setB, setC, setD, setE, setF, setParameters, setParameters, setParameters
-
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
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
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
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
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
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
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
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
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
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
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
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.
-