Package com.irurueta.geometry
Class EuclideanTransformation3D
java.lang.Object
com.irurueta.geometry.Transformation3D
com.irurueta.geometry.EuclideanTransformation3D
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MetricTransformation3D
This class performs Euclidean transformations on 3D space.
Euclidean transformations include transformations related to rotations and
translations.
Scale cannot be modified on Euclidean transformation.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant defining number of homogeneous coordinates in 3D space.static final intConstant indicating number of coordinates required in translation arrays.private Rotation3D3D rotation to be performed on geometric objects.private double[]3D translation to be performed on geometric objects. -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor.EuclideanTransformation3D(double[] translation) Creates transformation with provided 3D translation.EuclideanTransformation3D(Point3D inputPoint1, Point3D inputPoint2, Point3D inputPoint3, Point3D inputPoint4, Point3D outputPoint1, Point3D outputPoint2, Point3D outputPoint3, Point3D outputPoint4) Creates transformation by estimating its internal values using provided 4 corresponding original and transformed points.EuclideanTransformation3D(Rotation3D rotation) Creates transformation with provided rotation.EuclideanTransformation3D(Rotation3D rotation, double[] translation) Creates transformation with provided 3D rotation and translation. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRotation(Rotation3D 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, double translationZ) Adds provided coordinates to current translation assigned to this transformation.voidaddTranslation(Point3D 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.voidaddTranslationZ(double translationZ) Adds provided z coordinate to current translation assigned to this transformation.com.irurueta.algebra.MatrixasMatrix()Represents this transformation as a 4x4 matrix.voidasMatrix(com.irurueta.algebra.Matrix m) Represents this transformation as a 4x4 matrix and stores the result in provided instance.voidcombine(EuclideanTransformation3D transformation) Combines this transformation with provided transformation.private voidcombine(EuclideanTransformation3D inputTransformation, EuclideanTransformation3D outputTransformation) Combines this transformation with provided input transformation and stores the result into provided output transformation.combineAndReturnNew(EuclideanTransformation3D transformation) Combines this transformation with provided transformation and returns the result as a new transformation instance.Returns 3D rotation assigned to this transformation.double[]Returns 3D translation assigned to this transformation as an array expressed in inhomogeneous coordinates.Gets x, y, z coordinates of translation to be made by this transformation as a new point.voidGets x, y, z 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.doubleReturns current z coordinate translation assigned to this transformation.private voidinternalSetTransformationFromPoints(Point3D inputPoint1, Point3D inputPoint2, Point3D inputPoint3, Point3D inputPoint4, Point3D outputPoint1, Point3D outputPoint2, Point3D outputPoint3, Point3D outputPoint4) Estimates this transformation internal parameters by using 4 corresponding original and transformed points.voidinverse()Inverses this transformation.protected voidinverse(EuclideanTransformation3D 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.voidsetRotation(Rotation3D rotation) Sets 3D rotation for this transformation.voidsetTransformationFromPoints(Point3D inputPoint1, Point3D inputPoint2, Point3D inputPoint3, Point3D inputPoint4, Point3D outputPoint1, Point3D outputPoint2, Point3D outputPoint3, Point3D outputPoint4) Estimates this transformation internal parameters by using 4 corresponding original and transformed points.voidsetTranslation(double[] translation) Sets 3D translation assigned to this transformation as an array expressed in inhomogeneous coordinates.voidsetTranslation(double translationX, double translationY, double translationZ) Sets x, y, z coordinates of translation to be made by this transformation.voidsetTranslation(Point3D translation) Sets x, y, z 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.voidsetTranslationZ(double translationZ) Sets z coordinate translation to be made by this transformation.toMetric()Converts this transformation into a metric transformation.voidtransform(DualQuadric inputDualQuadric, DualQuadric outputDualQuadric) Transforms a dual quadric using this transformation and stores the result into provided output dual quadric.voidtransform(PinholeCamera inputCamera, PinholeCamera outputCamera) Transforms a camera using this transformation and stores the result into provided output camera.voidTransforms provided input plane using this transformation and stores the result into provided output plane instance.voidTransforms input point using this transformation and stores the result in provided output points.voidTransforms a quadric using this transformation and stores the result into provided output quadric.Methods inherited from class com.irurueta.geometry.Transformation3D
transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transformAndOverwriteLines, transformAndOverwritePlanes, transformAndOverwritePoints, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformAndReturnNew, transformLines, transformLines, transformPlanes, transformPlanesAndReturnNew, transformPoints, transformPointsAndReturnNew
-
Field Details
-
NUM_TRANSLATION_COORDS
public static final int NUM_TRANSLATION_COORDSConstant indicating number of coordinates required in translation arrays.- See Also:
-
HOM_COORDS
public static final int HOM_COORDSConstant defining number of homogeneous coordinates in 3D space.- See Also:
-
rotation
3D rotation to be performed on geometric objects. -
translation
private double[] translation3D translation to be performed on geometric objects. Translation is specified using inhomogeneous coordinates.
-
-
Constructor Details
-
EuclideanTransformation3D
public EuclideanTransformation3D()Empty constructor. Creates transformation that has no effect. -
EuclideanTransformation3D
Creates transformation with provided rotation.- Parameters:
rotation- A 2D rotation.- Throws:
NullPointerException- Raised if provided rotation is null.
-
EuclideanTransformation3D
public EuclideanTransformation3D(double[] translation) Creates transformation with provided 3D translation.- Parameters:
translation- Array indicating 3D translation using in-homogenous coordinates.- Throws:
NullPointerException- Raised if provided array is null.IllegalArgumentException- Raised if length of array is not equal to NUM_TRANSLATION_COORDS.
-
EuclideanTransformation3D
Creates transformation with provided 3D rotation and translation.- Parameters:
rotation- A 3D rotation.translation- Array indicating 3D 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.
-
EuclideanTransformation3D
public EuclideanTransformation3D(Point3D inputPoint1, Point3D inputPoint2, Point3D inputPoint3, Point3D inputPoint4, Point3D outputPoint1, Point3D outputPoint2, Point3D outputPoint3, Point3D outputPoint4) throws CoincidentPointsException Creates transformation by estimating its internal values using provided 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).
-
-
Method Details
-
getRotation
Returns 3D rotation assigned to this transformation.- Returns:
- 3D rotation.
-
setRotation
Sets 3D rotation for this transformation.- Parameters:
rotation- A 3D rotation.- Throws:
NullPointerException- Raised if provided rotation is null.
-
addRotation
Adds provided rotation to current rotation assigned to this transformation.- Parameters:
rotation- 3D rotation to be added.
-
getTranslation
public double[] getTranslation()Returns 3D translation assigned to this transformation as an array expressed in inhomogeneous coordinates.- Returns:
- 3D translation array.
-
setTranslation
public void setTranslation(double[] translation) Sets 3D translation assigned to this transformation as an array expressed in inhomogeneous coordinates.- Parameters:
translation- 3D 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- 3D 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.
-
getTranslationZ
public double getTranslationZ()Returns current z coordinate translation assigned to this transformation.- Returns:
- Z coordinate translation.
-
setTranslationZ
public void setTranslationZ(double translationZ) Sets z coordinate translation to be made by this transformation.- Parameters:
translationZ- Z coordinate translation to be set.
-
setTranslation
public void setTranslation(double translationX, double translationY, double translationZ) Sets x, y, z coordinates of translation to be made by this transformation.- Parameters:
translationX- translation x coordinate to be set.translationY- translation y coordinate to be set.translationZ- translation z coordinate to be set.
-
setTranslation
Sets x, y, z coordinates of translation to be made by this transformation.- Parameters:
translation- translation to be set.
-
getTranslationPoint
Gets x, y, z coordinates of translation to be made by this transformation as a new point.- Returns:
- a new point containing translation coordinates.
-
getTranslationPoint
Gets x, y, z 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.
-
addTranslationZ
public void addTranslationZ(double translationZ) Adds provided z coordinate to current translation assigned to this transformation.- Parameters:
translationZ- Z coordinate to be added to current translation.
-
addTranslation
public void addTranslation(double translationX, double translationY, double translationZ) Adds provided coordinates to current translation assigned to this transformation.- Parameters:
translationX- x coordinate to be added to current translation.translationY- y coordinate to be added to current translation.translationZ- z coordinate to be added to current translation.
-
addTranslation
Adds provided coordinates to current translation assigned to this transformation.- Parameters:
translation- x, y, z coordinates to be added to current translation.
-
asMatrix
public com.irurueta.algebra.Matrix asMatrix()Represents this transformation as a 4x4 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 classTransformation3D- Returns:
- This transformation in matrix form.
-
asMatrix
public void asMatrix(com.irurueta.algebra.Matrix m) Represents this transformation as a 4x4 matrix and stores the result in provided instance.- Specified by:
asMatrixin classTransformation3D- Parameters:
m- instance where transformation matrix will be stored.- Throws:
IllegalArgumentException- raised if provided instance is not a 4x4 matrix.
-
transform
Transforms input point using this transformation and stores the result in provided output points.- Specified by:
transformin classTransformation3D- Parameters:
inputPoint- point to be transformed.outputPoint- instance where transformed point data will be stored.
-
transform
public void transform(Quadric inputQuadric, Quadric outputQuadric) throws NonSymmetricMatrixException Transforms a quadric using this transformation and stores the result into provided output quadric.- Specified by:
transformin classTransformation3D- Parameters:
inputQuadric- Quadric to be transformed.outputQuadric- instance where data of transformed quadric will be stored.- Throws:
NonSymmetricMatrixException- raised if due to numerical precision the resulting output quadric matrix is not considered to be symmetric.
-
transform
public void transform(DualQuadric inputDualQuadric, DualQuadric outputDualQuadric) throws NonSymmetricMatrixException Transforms a dual quadric using this transformation and stores the result into provided output dual quadric.- Specified by:
transformin classTransformation3D- Parameters:
inputDualQuadric- dual quadric to be transformed.outputDualQuadric- instance where data of transformed dual quadric will be stored.- Throws:
NonSymmetricMatrixException- raised if due to numerical precision. the resulting output dual quadric matrix is not considered to be symmetric.
-
transform
Transforms provided input plane using this transformation and stores the result into provided output plane instance.- Specified by:
transformin classTransformation3D- Parameters:
inputPlane- plane to be transformed.outputPlane- instance where data of transformed plane will be stored.
-
transform
Transforms a camera using this transformation and stores the result into provided output camera.- Specified by:
transformin classTransformation3D- Parameters:
inputCamera- camera to be transformed.outputCamera- instance where data of transformed camera will be stored.
-
toMetric
Converts this transformation into a metric transformation.- Returns:
- this transformation converted into a metric transformation.
-
inverse
public void inverse()Inverses this transformation. -
inverseAndReturnNew
Computes the inverse of this transformation and returns the result as a new transformation instance.- Returns:
- inverse transformation.
-
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 pf provided transformation.- Parameters:
transformation- Transformation to be combined with.- Returns:
- A new transformation resulting of the combination with this transformation and provided transformation.
-
setTransformationFromPoints
public void setTransformationFromPoints(Point3D inputPoint1, Point3D inputPoint2, Point3D inputPoint3, Point3D inputPoint4, Point3D outputPoint1, Point3D outputPoint2, Point3D outputPoint3, Point3D outputPoint4) throws CoincidentPointsException Estimates this transformation internal parameters by using 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).
-
inverse
Computes the inverse of this transformation and stores the result in provided instance.- Parameters:
result- instance where inverse transformation will be stored.
-
combine
private void combine(EuclideanTransformation3D inputTransformation, EuclideanTransformation3D 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.
-
internalSetTransformationFromPoints
private void internalSetTransformationFromPoints(Point3D inputPoint1, Point3D inputPoint2, Point3D inputPoint3, Point3D inputPoint4, Point3D outputPoint1, Point3D outputPoint2, Point3D outputPoint3, Point3D outputPoint4) throws CoincidentPointsException Estimates this transformation internal parameters by using 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).
-