Package com.irurueta.geometry
Class MetricTransformation3D
java.lang.Object
com.irurueta.geometry.Transformation3D
com.irurueta.geometry.EuclideanTransformation3D
com.irurueta.geometry.MetricTransformation3D
- All Implemented Interfaces:
Serializable
This class performs metric transformations on 3D space.
Metric transformations include transformations related to rotations,
translations and scale.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleDefault scale factor, which leaves objects with the same scale.private doubleScale factor.Fields inherited from class com.irurueta.geometry.EuclideanTransformation3D
HOM_COORDS, NUM_TRANSLATION_COORDS -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor.MetricTransformation3D(double scale) Creates transformation with provided scale value.MetricTransformation3D(double[] translation) Creates transformation with provided 3D translation.MetricTransformation3D(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.MetricTransformation3D(Rotation3D rotation) Creates transformation with provided rotation.MetricTransformation3D(Rotation3D rotation, double[] translation, double scale) Creates transformation with provided rotation, translation and scale value. -
Method Summary
Modifier and TypeMethodDescriptionvoidasMatrix(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.voidcombine(MetricTransformation3D transformation) Combines this transformation with provided transformation.private voidcombine(MetricTransformation3D inputTransformation, MetricTransformation3D 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.combineAndReturnNew(MetricTransformation3D transformation) Combines this transformation with provided transformation and returns the result as a new transformation instance.doublegetScale()Returns scale of this transformation.private voidinternalSetMetricTransformationFromPoints(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(MetricTransformation3D 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.voidsetScale(double scale) Sets scale of 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.toAffine()Converts this transformation into an affine transformation.toMetric()Converts this transformation into a metric transformation.voidTransforms input point using this transformation and stores the result in provided output points.Methods inherited from class com.irurueta.geometry.EuclideanTransformation3D
addRotation, addTranslation, addTranslation, addTranslation, addTranslationX, addTranslationY, addTranslationZ, asMatrix, getRotation, getTranslation, getTranslationPoint, getTranslationPoint, getTranslationX, getTranslationY, getTranslationZ, inverse, setRotation, setTranslation, setTranslation, setTranslation, setTranslationX, setTranslationY, setTranslationZ, transform, transform, transform, transformMethods 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
-
DEFAULT_SCALE
public static final double DEFAULT_SCALEDefault scale factor, which leaves objects with the same scale.- See Also:
-
scale
private double scaleScale factor. Negative values mean that objects get reversed. Values greater than 1.0 means that objects get enlarged and values between 0.0 and 1.0 means that objects get reduced.
-
-
Constructor Details
-
MetricTransformation3D
public MetricTransformation3D()Empty constructor. Creates transformation that has no effect. -
MetricTransformation3D
Creates transformation with provided rotation.- Parameters:
rotation- a 3D rotation.- Throws:
NullPointerException- raised if provided rotation is null.
-
MetricTransformation3D
public MetricTransformation3D(double[] translation) Creates transformation with provided 3D translation.- Parameters:
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.
-
MetricTransformation3D
public MetricTransformation3D(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.
-
MetricTransformation3D
Creates transformation with provided rotation, translation and scale value.- Parameters:
rotation- a 3D rotation.translation- array indicating 3D translation using inhomogeneous coordinates.scale- scale value. Values between 0.0 and 1.0 reduce objects, values greater than 1.0 enlarge objects and negative values reverse objects.- Throws:
NullPointerException- raised if provided array is null or if rotation is null.IllegalArgumentException- raised if length of array is not equal to NUM_TRANSLATION_COORDS.
-
MetricTransformation3D
public MetricTransformation3D(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
-
getScale
public double getScale()Returns scale of this transformation. 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.- Returns:
- scale.
-
setScale
public void setScale(double scale) 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.
-
asMatrix
public void asMatrix(com.irurueta.algebra.Matrix m) Represents this transformation as a 4x4 matrix and stores the result in provided instance.- Overrides:
asMatrixin classEuclideanTransformation3D- 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.- Overrides:
transformin classEuclideanTransformation3D- Parameters:
inputPoint- point to be transformed.outputPoint- instance where transformed point data will be stored.
-
inverse
public void inverse()Inverses this transformation.- Overrides:
inversein classEuclideanTransformation3D
-
inverseAndReturnNew
Computes the inverse of this transformation and returns the result as a new transformation instance.- Overrides:
inverseAndReturnNewin classEuclideanTransformation3D- Returns:
- inverse transformation.
-
inverse
Computes the inverse of this transformation and stores the result in provided instance.- Parameters:
result- instance where inverse transformation will be stored.
-
toMetric
Converts this transformation into a metric transformation. Because this method is inherited, and this instance is already metric, this method just returns a copy of this transformation.- Overrides:
toMetricin classEuclideanTransformation3D- Returns:
- this transformation converted into a metric transformation.
-
toAffine
Converts this transformation into an affine transformation.- Returns:
- this transformation converted into an affine 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.- Overrides:
combinein classEuclideanTransformation3D- 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.- Overrides:
combineAndReturnNewin classEuclideanTransformation3D- Parameters:
transformation- transformation to be combined with.- Returns:
- A new transformation resulting of the combination with this transformation and provided 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 of 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.- Overrides:
setTransformationFromPointsin classEuclideanTransformation3D- 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).
-
combine
private void combine(MetricTransformation3D inputTransformation, MetricTransformation3D 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.
-
internalSetMetricTransformationFromPoints
private void internalSetMetricTransformationFromPoints(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).
-