Package com.irurueta.geometry
Class ProjectiveTransformation2D
java.lang.Object
com.irurueta.geometry.Transformation2D
com.irurueta.geometry.ProjectiveTransformation2D
- All Implemented Interfaces:
Serializable
This class performs projective transformations on 2D space.
Projective transformations include any possible transformation that can be
applied to 2D points.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleMachine precision.static final intConstant defining number of homogeneous coordinates in 2D space.static final intConstant defining number of inhomogeneous coordinates in 2D space.private static final doubleConstant defining a large threshold to consider a matrix valid as rotation.private booleanIndicates whether internal matrix is normalized.static final intConstant indicating the number of projective parameters that can be set in projective parameters array.static final intConstant indicating number of coordinates required in translation arrays.private com.irurueta.algebra.MatrixInternal 3x3 matrix containing transformation. -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor.ProjectiveTransformation2D(double scale) Creates transformation with provided scale value.ProjectiveTransformation2D(double[] translation) Creates transformation with provided 2D translation.ProjectiveTransformation2D(double scale, double[] translation) Creates transformation with provided scale and translation.ProjectiveTransformation2D(double scale, Rotation2D rotation) Creates transformation with provided scale and rotation.ProjectiveTransformation2D(double scale, Rotation2D rotation, double[] translation) Creates transformation with provided scale, rotation and translation.ProjectiveTransformation2D(double scale, Rotation2D rotation, double[] translation, double[] projectiveParameters) Creates transformation with provided scale, rotation and translation.ProjectiveTransformation2D(com.irurueta.algebra.Matrix t) Creates transformation with provided internal matrix.ProjectiveTransformation2D(com.irurueta.algebra.Matrix a, double[] translation) Creates transformation with provided affine linear mapping and translation.ProjectiveTransformation2D(AffineParameters2D params, Rotation2D rotation) Creates transformation with provided affine parameters and rotation.ProjectiveTransformation2D(AffineParameters2D params, Rotation2D rotation, double[] translation) Creates transformation with provided parameters, rotation and translation.ProjectiveTransformation2D(AffineParameters2D params, Rotation2D rotation, double[] translation, double[] projectiveParameters) Creates transformation with provided parameters, rotation and translation.ProjectiveTransformation2D(Line2D inputLine1, Line2D inputLine2, Line2D inputLine3, Line2D inputLine4, Line2D outputLine1, Line2D outputLine2, Line2D outputLine3, Line2D outputLine4) Creates transformation by estimating its internal matrix by providing 4 corresponding original and transformed lines.ProjectiveTransformation2D(Point2D inputPoint1, Point2D inputPoint2, Point2D inputPoint3, Point2D inputPoint4, Point2D outputPoint1, Point2D outputPoint2, Point2D outputPoint3, Point2D outputPoint4) Creates transformation by estimating its internal matrix by providing 4 corresponding original and transformed points.ProjectiveTransformation2D(Rotation2D rotation) Creates transformation with provided rotation.ProjectiveTransformation2D(Rotation2D rotation, double[] translation) Creates transformation with provided rotation and translation. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRotation(Rotation2D rotation) Adds provided rotation to current rotation assigned to this transformation.voidaddTranslation(double[] translation) Adds provided translation to current translation on this transformation.voidaddTranslation(double translationX, double translationY) Adds provided coordinates to current translation assigned ot this transformation.voidaddTranslation(Point2D translation) Adds provided coordinates to current translation assigned to this transformation.voidaddTranslationX(double translationX) Adds provided x coordinate to current translation assigned to this transformation.voidaddTranslationY(double translationY) Adds provided y coordinate to current translation assigned to this transformation.com.irurueta.algebra.MatrixasMatrix()Represents this transformation as a 3x3 matrix.voidasMatrix(com.irurueta.algebra.Matrix m) Represents this transformation as a 3x3 matrix and stores the result in provided instance.voidcombine(ProjectiveTransformation2D transformation) Combines this transformation with provided transformation.private voidcombine(ProjectiveTransformation2D inputTransformation, ProjectiveTransformation2D outputTransformation) Combines this transformation with provided input transformation and stores the result into provided output transformation.combineAndReturnNew(ProjectiveTransformation2D transformation) Combines this transformation with provided transformation and returns the result as a new transformation instance.com.irurueta.algebra.MatrixgetA()Returns affine linear mapping matrix.Gets affine parameters of associated to this instance.voidComputes affine parameters associated to this instance and stores the result in provided instance.double[]Returns the projective parameters associated to this instance.Returns the 2D rotation component associated to this transformation.com.irurueta.algebra.MatrixgetT()Returns internal matrix containing this transformation data.double[]Returns 2D translation assigned to this transformation as an array expressed in inhomogeneous coordinates.voidgetTranslation(double[] out) Obtains 2D translation assigned to this transformation and stores result into provided array.Gets x, y coordinates of translation to be made by this transformation as a new point.voidGets x, y coordinates of translation to be made by this transformation and stores them into provided point.doubleReturns current x coordinate translation assigned to this transformation.doubleReturns current y coordinate translation assigned to this transformation.voidinverse()Inverses this transformation.protected voidinverse(ProjectiveTransformation2D result) Computes the inverse of this transformation and stores the result in provided instance.Computes the inverse of this transformation and returns the result as a new transformation instance.booleanIndicates whether this transformation is degenerate.static booleanisDegenerate(com.irurueta.algebra.Matrix t) Returns boolean indicating whether provided matrix will produce a degenerate projective transformation or not.final voidNormalizes current matrix instance.final voidsetA(com.irurueta.algebra.Matrix a) Sets affine linear mapping matrix.voidsetAffineParameters(AffineParameters2D parameters) Sets affine parameters associated to this instance.final voidsetProjectiveParameters(double[] params) Sets the projective parameters associated to this instance.voidsetRotation(Rotation2D rotation) Sets 2D rotation for this transformation.voidsetScale(double scale) Sets scale of this transformation.final voidsetT(com.irurueta.algebra.Matrix t) Sets internal matrix containing this transformation data.final voidsetTransformationFromLines(Line2D inputLine1, Line2D inputLine2, Line2D inputLine3, Line2D inputLine4, Line2D outputLine1, Line2D outputLine2, Line2D outputLine3, Line2D outputLine4) Estimates this transformation internal matrix by providing 4 corresponding original and transformed lines.final voidsetTransformationFromPoints(Point2D inputPoint1, Point2D inputPoint2, Point2D inputPoint3, Point2D inputPoint4, Point2D outputPoint1, Point2D outputPoint2, Point2D outputPoint3, Point2D outputPoint4) Estimates this transformation internal matrix by providing 4 corresponding original and transformed points.voidsetTranslation(double[] translation) Sets 2D translation assigned to this transformation as an array expressed in inhomogeneous coordinates.voidsetTranslation(double translationX, double translationY) Sets x, y coordinates of translation to be made by this transformation.voidsetTranslation(Point2D translation) Sets x, y coordinates of translation to be made by this transformation.voidsetTranslationX(double translationX) Sets x coordinate translation to be made by this transformation.voidsetTranslationY(double translationY) Sets y coordinate translation to be made by this transformation.voidTransforms a conic using this transformation and stores the result into provided output conic.voidTransforms a dual conic using this transformation and stores the result into provided output dual conic.voidTransforms provided input line using this transformation and stores the result into provided output line instance.voidTransforms input point using this transformation and stores the result in provided output points.Methods inherited from class com.irurueta.geometry.Transformation2D
transform, transform, transform, transform, transform, transform, transform, transform, transformAndOverwriteLines, transformAndOverwritePoints, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformLines, transformLinesAndReturnNew, transformPoints, transformPointsAndReturnNew
-
Field Details
-
NUM_TRANSLATION_COORDS
public static final int NUM_TRANSLATION_COORDSConstant indicating number of coordinates required in translation arrays.- See Also:
-
NUM_PROJECTIVE_PARAMS
public static final int NUM_PROJECTIVE_PARAMSConstant indicating the number of projective parameters that can be set in projective parameters array.- See Also:
-
INHOM_COORDS
public static final int INHOM_COORDSConstant defining number of inhomogeneous coordinates in 2D space.- See Also:
-
HOM_COORDS
public static final int HOM_COORDSConstant defining number of homogeneous coordinates in 2D space.- See Also:
-
EPS
public static final double EPSMachine precision.- See Also:
-
LARGE_ROTATION_MATRIX_THRESHOLD
private static final double LARGE_ROTATION_MATRIX_THRESHOLDConstant defining a large threshold to consider a matrix valid as rotation.- See Also:
-
t
private com.irurueta.algebra.Matrix tInternal 3x3 matrix containing transformation. -
normalized
private boolean normalizedIndicates whether internal matrix is normalized.
-
-
Constructor Details
-
ProjectiveTransformation2D
public ProjectiveTransformation2D()Empty constructor. Creates transformation that has no effect. -
ProjectiveTransformation2D
public ProjectiveTransformation2D(com.irurueta.algebra.Matrix t) Creates transformation with provided internal matrix. Notice that provided matrix should usually be invertible, otherwise the transformation will be degenerate and its inverse will not be available.- Parameters:
t- Internal 3x3 matrix.- Throws:
NullPointerException- raised if provided matrix is null.IllegalArgumentException- raised if provided matrix is not 3x3
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(double scale) Creates transformation with provided scale value.- Parameters:
scale- scale value. Values between 0.0 and 1.0 reduce objects, values greater than 1.0 enlarge objects and negative values reverse objects.
-
ProjectiveTransformation2D
Creates transformation with provided rotation.- Parameters:
rotation- a 2D rotation.- Throws:
NullPointerException- raised if provided rotation is null.
-
ProjectiveTransformation2D
Creates transformation with provided scale and rotation.- Parameters:
scale- Scale value. Values between 0.0 and 1.0 reduce objects, values greater than 1.0 enlarge objects and negative values reverse objects.rotation- a 2D rotation.- Throws:
NullPointerException- raised if provided rotation is null.
-
ProjectiveTransformation2D
Creates transformation with provided affine parameters and rotation.- Parameters:
params- affine parameters including horizontal scaling, vertical scaling and skewness.rotation- a 2D rotation.- Throws:
NullPointerException- raised if provided parameters are null or if provided rotation is null.
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(double[] translation) Creates transformation with provided 2D translation.- Parameters:
translation- array indicating 2D translation using inhomogeneous coordinates.- Throws:
NullPointerException- raised if provided array is null.IllegalArgumentException- raised if length of array is not equal to NUM_TRANSLATION_COORDS.
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(com.irurueta.algebra.Matrix a, double[] translation) Creates transformation with provided affine linear mapping and translation.- Parameters:
a- affine linear mapping.translation- array indicating 2D translation using inhomogeneous coordinates.- Throws:
NullPointerException- raised if provided array is null or if affine linear mapping is null.IllegalArgumentException- raised if length of array is not equal to NUM_TRANSLATION_COORDS.
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(double scale, double[] translation) Creates transformation with provided scale and translation.- Parameters:
scale- scale value. Values between 0.0 and 1.0 reduce objects, values greater than 1.0 enlarge objects and negative values reverse objects.translation- array indicating 2D translation using inhomogeneous coordinates.- Throws:
NullPointerException- raised if provided translation is nullIllegalArgumentException- raised if provided translation does not have length 2.
-
ProjectiveTransformation2D
Creates transformation with provided rotation and translation.- Parameters:
rotation- a 2D rotation.translation- array indicating 2D translation using inhomogeneous coordinates.- Throws:
NullPointerException- raised if provided rotation or translation is null.IllegalArgumentException- raised if provided translation does not have length 2.
-
ProjectiveTransformation2D
Creates transformation with provided scale, rotation and translation.- Parameters:
scale- Scale value. Values between 0.0 and 1.0 reduce objects, values greater than 1.0 enlarge objects and negative values reverse objects.rotation- a 2D rotation.translation- array indicating 2D translation using inhomogeneous coordinates.- Throws:
NullPointerException- raised if provided rotation or translation is null.IllegalArgumentException- raised if provided translation does not have length 2.
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(double scale, Rotation2D rotation, double[] translation, double[] projectiveParameters) Creates transformation with provided scale, rotation and translation.- Parameters:
scale- scale value. Values between 0.0 and 1.0 reduce objects, values greater than 1.0 enlarge objects and negative values reverse objects.rotation- a 2D rotation.translation- array indicating 2D translation using inhomogeneous coordinates.projectiveParameters- array of length 3 containing projective parameters.- Throws:
NullPointerException- raised if provided rotation or translation is null.IllegalArgumentException- raised if provided translation does not have length 2 or if projective parameters array doesn't have length 3.
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(AffineParameters2D params, Rotation2D rotation, double[] translation) Creates transformation with provided parameters, rotation and translation.- Parameters:
params- Affine parameters including horizontal scaling, vertical scaling and skewness.rotation- a 2D rotation.translation- array indicating 2D translation using inhomogeneous coordinates.- Throws:
NullPointerException- raised if provided parameters, rotation or translation is null.IllegalArgumentException- raised if provided translation does not have length 2.
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(AffineParameters2D params, Rotation2D rotation, double[] translation, double[] projectiveParameters) Creates transformation with provided parameters, rotation and translation.- Parameters:
params- affine parameters including horizontal scaling, vertical scaling and skewness.rotation- a 2D rotation.translation- array indicating 2D translation using inhomogeneous coordinates.projectiveParameters- array of length 3 containing projective parameters.- Throws:
NullPointerException- raised if provided parameters, rotation or translation is null.IllegalArgumentException- raised if provided translation does not have length 2 or if projective parameters array doesn't have length 3.
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(Point2D inputPoint1, Point2D inputPoint2, Point2D inputPoint3, Point2D inputPoint4, Point2D outputPoint1, Point2D outputPoint2, Point2D outputPoint3, Point2D outputPoint4) throws CoincidentPointsException Creates transformation by estimating its internal matrix by providing 4 corresponding original and transformed points.- Parameters:
inputPoint1- 1st input point.inputPoint2- 2nd input point.inputPoint3- 3rd input point.inputPoint4- 4th input point.outputPoint1- 1st transformed point corresponding to 1st input point.outputPoint2- 2nd transformed point corresponding to 2nd input point.outputPoint3- 3rd transformed point corresponding to 3rd input point.outputPoint4- 4th transformed point corresponding to 4th input point.- Throws:
CoincidentPointsException- raised if transformation cannot be estimated for some reason (point configuration degeneracy, duplicate points or numerical instabilities).
-
ProjectiveTransformation2D
public ProjectiveTransformation2D(Line2D inputLine1, Line2D inputLine2, Line2D inputLine3, Line2D inputLine4, Line2D outputLine1, Line2D outputLine2, Line2D outputLine3, Line2D outputLine4) throws CoincidentLinesException Creates transformation by estimating its internal matrix by providing 4 corresponding original and transformed lines.- Parameters:
inputLine1- 1st input line.inputLine2- 2nd input line.inputLine3- 3rd input line.inputLine4- 4th input line.outputLine1- 1st transformed line corresponding to 1st input line.outputLine2- 2nd transformed line corresponding to 2nd input line.outputLine3- 3rd transformed line corresponding to 3rd input line.outputLine4- 4th transformed line corresponding to 4th input line.- Throws:
CoincidentLinesException- raised if transformation cannot be estimated for some reason (line configuration degeneracy, duplicate lines or numerical instabilities).
-
-
Method Details
-
getT
public com.irurueta.algebra.Matrix getT()Returns internal matrix containing this transformation data. Point transformation is computed as t * x, where x is a 2D point expressed using homogeneous coordinates. Usually the internal transformation matrix will be invertible. When this is not the case, the transformation is considered degenerate and its inverse will not be available.- Returns:
- internal transformation matrix.
-
setT
public final void setT(com.irurueta.algebra.Matrix t) Sets internal matrix containing this transformation data. Point transformation is computed as t * x, where x is a 2D point expressed using homogeneous coordinates. Usually provided matrix will be invertible, when this is not the case this transformation will become degenerate and its inverse will not be available. This method does not check whether provided matrix is invertible or not.- Parameters:
t- transformation matrix.- Throws:
NullPointerException- raised if provided matrix is null.IllegalArgumentException- raised if provided matrix is not 3x3
-
isDegenerate
public static boolean isDegenerate(com.irurueta.algebra.Matrix t) Returns boolean indicating whether provided matrix will produce a degenerate projective transformation or not.- Parameters:
t- a 3x3 matrix to be used as the internal matrix of a projective transformation.- Returns:
- true if matrix will produce a degenerate transformation, false otherwise.
- Throws:
IllegalArgumentException- raised if provided matrix is not 3x3.
-
isDegenerate
public boolean isDegenerate()Indicates whether this transformation is degenerate. When a transformation is degenerate, its inverse cannot be computed.- Returns:
- true if transformation is degenerate, false otherwise.
-
getA
public com.irurueta.algebra.Matrix getA()Returns affine linear mapping matrix.- Returns:
- linear mapping matrix.
- See Also:
-
setA
public final void setA(com.irurueta.algebra.Matrix a) Sets affine linear mapping matrix.- Parameters:
a- linear mapping matrix.- Throws:
NullPointerException- raised if provided matrix is null.IllegalArgumentException- raised if provided matrix does not have size 2x2.- See Also:
-
normalize
public final void normalize()Normalizes current matrix instance. -
getRotation
Returns the 2D rotation component associated to this transformation. Note: if this rotation instance is modified, its changes won't be reflected on this transformation until rotation is set again.- Returns:
- 2D rotation.
- Throws:
com.irurueta.algebra.AlgebraException- if for some reason rotation cannot be estimated (usually because of numerical instability).
-
setRotation
Sets 2D rotation for this transformation.- Parameters:
rotation- a 2D rotation.- Throws:
NullPointerException- raised if provided rotation is null.com.irurueta.algebra.AlgebraException- raised if for numerical reasons rotation cannot be set (usually because of numerical instability in parameters of this transformation).
-
addRotation
Adds provided rotation to current rotation assigned to this transformation.- Parameters:
rotation- 2D rotation to be added.- Throws:
com.irurueta.algebra.AlgebraException- raised if for numerical reasons rotation cannot be set (usually because of numerical instability in parameters of this transformation).
-
setScale
public void setScale(double scale) throws com.irurueta.algebra.AlgebraException Sets scale of this transformation.- Parameters:
scale- scale value to be set. A value between 0.0 and 1.0 indicates that objects will be reduced, a value greater than 1.0 indicates that objects will be enlarged, and a negative value indicates that objects will be reversed.- Throws:
com.irurueta.algebra.AlgebraException- raised if for numerical reasons scale cannot be set (usually because of numerical instability in parameters of this transformation).
-
getAffineParameters
Gets affine parameters of associated to this instance. Affine parameters contain horizontal scale, vertical scale and skewness of axes.- Returns:
- affine parameters.
- Throws:
com.irurueta.algebra.AlgebraException- raised if for numerical reasons affine parameters cannot be retrieved (usually because of numerical instability of the internal matrix of this instance).
-
getAffineParameters
public void getAffineParameters(AffineParameters2D result) throws com.irurueta.algebra.AlgebraException Computes affine parameters associated to this instance and stores the result in provided instance. Affine parameters contain horizontal scale, vertical scale and skewness of axes.- Parameters:
result- instance where affine parameters will be stored.- Throws:
com.irurueta.algebra.AlgebraException- raised if for numerical reasons affine parameters cannot be retrieved (usually because of numerical instability of the internal matrix of this instance).
-
setAffineParameters
public void setAffineParameters(AffineParameters2D parameters) throws com.irurueta.algebra.AlgebraException Sets affine parameters associated to this instance. Affine parameters contain horizontal scale, vertical scale and skewness of axes.- Parameters:
parameters- affine parameters to be set.- Throws:
com.irurueta.algebra.AlgebraException- raised if for numerical reasons affine parameters cannot be set (usually because of numerical instability of the internal matrix of this instance).
-
getProjectiveParameters
public double[] getProjectiveParameters()Returns the projective parameters associated to this instance. These parameters are the located in the last row of the internal transformation matrix. For affine, metric or Euclidean transformations this last row is always [0, 0, 1] (taking into account that transformation matrix is defined up to scale).- Returns:
- Projective parameters returned as the array containing the values of the last row of the internal transformation matrix.
-
setProjectiveParameters
public final void setProjectiveParameters(double[] params) Sets the projective parameters associated to this instance. These parameters will be set in the last row of the internal transformation matrix. For affine, matrix or Euclidean transformations parameters are always [0, 0, 1] (taking into account that transformation matrix is defined up to scale).- Parameters:
params- projective parameters to be set. It must be an array of length 3.- Throws:
IllegalArgumentException- raised if provided array does not have length 3.
-
getTranslation
public double[] getTranslation()Returns 2D translation assigned to this transformation as an array expressed in inhomogeneous coordinates. Note: Updating the values of the returned array will not update the translation of this instance. To do so, translation needs to be set again.- Returns:
- 2D translation array.
-
getTranslation
public void getTranslation(double[] out) throws com.irurueta.algebra.WrongSizeException Obtains 2D translation assigned to this transformation and stores result into provided array. Note: updating the values of the returned array will not update the translation of this instance. To do so, translation needs to be set.- Parameters:
out- array where translation values will be stored.- Throws:
com.irurueta.algebra.WrongSizeException- if provided array does not have length 2.
-
setTranslation
public void setTranslation(double[] translation) Sets 2D translation assigned to this transformation as an array expressed in inhomogeneous coordinates.- Parameters:
translation- 2D translation array.- Throws:
IllegalArgumentException- raised if provided array does not have length equal to NUM_TRANSLATION_COORDS.
-
addTranslation
public void addTranslation(double[] translation) Adds provided translation to current translation on this transformation. Provided translation must be expressed as an array of inhomogeneous coordinates.- Parameters:
translation- 2D translation array.- Throws:
IllegalArgumentException- raised if provided array does not have length equal to NUM_TRANSLATION_COORDS.
-
getTranslationX
public double getTranslationX()Returns current x coordinate translation assigned to this transformation.- Returns:
- X coordinate translation.
-
setTranslationX
public void setTranslationX(double translationX) Sets x coordinate translation to be made by this transformation.- Parameters:
translationX- X coordinate translation to be set.
-
getTranslationY
public double getTranslationY()Returns current y coordinate translation assigned to this transformation.- Returns:
- Y coordinate translation.
-
setTranslationY
public void setTranslationY(double translationY) Sets y coordinate translation to be made by this transformation.- Parameters:
translationY- Y coordinate translation to be set.
-
setTranslation
public void setTranslation(double translationX, double translationY) Sets x, y coordinates of translation to be made by this transformation.- Parameters:
translationX- translation x coordinate to be set.translationY- translation y coordinate to be set.
-
setTranslation
Sets x, y coordinates of translation to be made by this transformation.- Parameters:
translation- translation to be set.
-
getTranslationPoint
Gets x, y coordinates of translation to be made by this transformation as a new point.- Returns:
- a new point containing translation coordinates.
-
getTranslationPoint
Gets x, y coordinates of translation to be made by this transformation and stores them into provided point.- Parameters:
out- point where translation coordinates will be stored.
-
addTranslationX
public void addTranslationX(double translationX) Adds provided x coordinate to current translation assigned to this transformation.- Parameters:
translationX- X coordinate to be added to current translation.
-
addTranslationY
public void addTranslationY(double translationY) Adds provided y coordinate to current translation assigned to this transformation.- Parameters:
translationY- Y coordinate to be added to current translation.
-
addTranslation
public void addTranslation(double translationX, double translationY) Adds provided coordinates to current translation assigned ot this transformation.- Parameters:
translationX- x coordinate to be added to current translation.translationY- y coordinate to be added to current translation.
-
addTranslation
Adds provided coordinates to current translation assigned to this transformation.- Parameters:
translation- x, y coordinates to be added to current translation.
-
asMatrix
public com.irurueta.algebra.Matrix asMatrix()Represents this transformation as a 3x3 matrix. A point can be transformed as t * p, where t is the transformation matrix and p is a point expressed as an homogeneous vector.- Specified by:
asMatrixin classTransformation2D- Returns:
- This transformation in matrix form.
-
asMatrix
public void asMatrix(com.irurueta.algebra.Matrix m) Represents this transformation as a 3x3 matrix and stores the result in provided instance.- Specified by:
asMatrixin classTransformation2D- Parameters:
m- Instance where transformation matrix will be stored.- Throws:
IllegalArgumentException- Raised if provided instance is not a 3x3 matrix.
-
transform
Transforms input point using this transformation and stores the result in provided output points.- Specified by:
transformin classTransformation2D- Parameters:
inputPoint- point to be transformed.outputPoint- instance where transformed point data will be stored.
-
transform
public void transform(Conic inputConic, Conic outputConic) throws NonSymmetricMatrixException, com.irurueta.algebra.AlgebraException Transforms a conic using this transformation and stores the result into provided output conic.- Specified by:
transformin classTransformation2D- Parameters:
inputConic- conic to be transformed.outputConic- instance where data of transformed conic will be stored.- Throws:
NonSymmetricMatrixException- raised if due to numerical precision the resulting output conic matrix is not considered to be symmetric.com.irurueta.algebra.AlgebraException- raised if transform cannot be computed because of numerical instabilities.
-
transform
public void transform(DualConic inputDualConic, DualConic outputDualConic) throws NonSymmetricMatrixException, com.irurueta.algebra.AlgebraException Transforms a dual conic using this transformation and stores the result into provided output dual conic.- Specified by:
transformin classTransformation2D- Parameters:
inputDualConic- Dual conic to be transformed.outputDualConic- Instance where data of transformed dual conic will be stored.- Throws:
NonSymmetricMatrixException- raised if due to numerical precision the resulting output dual conic matrix is not considered to be symmetric.com.irurueta.algebra.AlgebraException- Raised if transform cannot be computed because of numerical instabilities.
-
transform
public void transform(Line2D inputLine, Line2D outputLine) throws com.irurueta.algebra.AlgebraException Transforms provided input line using this transformation and stores the result into provided output line instance.- Specified by:
transformin classTransformation2D- Parameters:
inputLine- line to be transformed.outputLine- instance where data of transformed line will be stored- Throws:
com.irurueta.algebra.AlgebraException- Raised if transform cannot be computed because of numerical instabilities.
-
inverse
public void inverse() throws com.irurueta.algebra.AlgebraExceptionInverses this transformation.- Throws:
com.irurueta.algebra.AlgebraException- if inverse transform cannot be computed because of numerical instabilities.
-
inverseAndReturnNew
Computes the inverse of this transformation and returns the result as a new transformation instance.- Returns:
- inverse transformation.
- Throws:
com.irurueta.algebra.AlgebraException- if inverse transform cannot be computed because of numerical instabilities.
-
inverse
protected void inverse(ProjectiveTransformation2D result) throws com.irurueta.algebra.AlgebraException Computes the inverse of this transformation and stores the result in provided instance.- Parameters:
result- Instance where inverse transformation will be stored.- Throws:
com.irurueta.algebra.AlgebraException- if inverse transform cannot be computed because of numerical instabilities.
-
combine
Combines this transformation with provided transformation. The combination is equivalent to multiplying the matrix of this transformation with the matrix of provided transformation.- Parameters:
transformation- transformation to be combined with.
-
combineAndReturnNew
Combines this transformation with provided transformation and returns the result as a new transformation instance. The combination is equivalent to multiplying the matrix of this transformation with the matrix of provided transformation.- Parameters:
transformation- transformation to be combined with.- Returns:
- a new transformation resulting of the combination with this transformation and provided transformation.
-
combine
private void combine(ProjectiveTransformation2D inputTransformation, ProjectiveTransformation2D outputTransformation) Combines this transformation with provided input transformation and stores the result into provided output transformation. The combination is equivalent to multiplying the matrix of this transformation with the matrix of provided input transformation.- Parameters:
inputTransformation- transformation to be combined with.outputTransformation- transformation where result will be stored.
-
setTransformationFromPoints
public final void setTransformationFromPoints(Point2D inputPoint1, Point2D inputPoint2, Point2D inputPoint3, Point2D inputPoint4, Point2D outputPoint1, Point2D outputPoint2, Point2D outputPoint3, Point2D outputPoint4) throws CoincidentPointsException Estimates this transformation internal matrix by providing 4 corresponding original and transformed points.- Parameters:
inputPoint1- 1st input point.inputPoint2- 2nd input point.inputPoint3- 3rd input point.inputPoint4- 4th input point.outputPoint1- 1st transformed point corresponding to 1st input point.outputPoint2- 2nd transformed point corresponding to 2nd input point.outputPoint3- 3rd transformed point corresponding to 3rd input point.outputPoint4- 4th transformed point corresponding to 4th input point.- Throws:
CoincidentPointsException- raised if transformation cannot be estimated for some reason (point configuration degeneracy, duplicate points or numerical instabilities).
-
setTransformationFromLines
public final void setTransformationFromLines(Line2D inputLine1, Line2D inputLine2, Line2D inputLine3, Line2D inputLine4, Line2D outputLine1, Line2D outputLine2, Line2D outputLine3, Line2D outputLine4) throws CoincidentLinesException Estimates this transformation internal matrix by providing 4 corresponding original and transformed lines.- Parameters:
inputLine1- 1st input line.inputLine2- 2nd input line.inputLine3- 3rd input line.inputLine4- 4th input line.outputLine1- 1st transformed line corresponding to 1st input line.outputLine2- 2nd transformed line corresponding to 2nd input line.outputLine3- 3rd transformed line corresponding to 3rd input line.outputLine4- 4th transformed line corresponding to 4th input line.- Throws:
CoincidentLinesException- raised if transformation cannot be estimated for some reason (line configuration degeneracy, duplicate line or numerical instabilities).
-