Class MetricTransformation3D

All Implemented Interfaces:
Serializable

public class MetricTransformation3D extends EuclideanTransformation3D implements Serializable
This class performs metric transformations on 3D space. Metric transformations include transformations related to rotations, translations and scale.
See Also:
  • Field Details

    • DEFAULT_SCALE

      public static final double DEFAULT_SCALE
      Default scale factor, which leaves objects with the same scale.
      See Also:
    • scale

      private double scale
      Scale 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

      public MetricTransformation3D(Rotation3D rotation)
      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

      public MetricTransformation3D(Rotation3D rotation, double[] translation, double scale)
      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:
      asMatrix in class EuclideanTransformation3D
      Parameters:
      m - instance where transformation matrix will be stored.
      Throws:
      IllegalArgumentException - Raised if provided instance is not a 4x4 matrix.
    • transform

      public void transform(Point3D inputPoint, Point3D outputPoint)
      Transforms input point using this transformation and stores the result in provided output points.
      Overrides:
      transform in class EuclideanTransformation3D
      Parameters:
      inputPoint - point to be transformed.
      outputPoint - instance where transformed point data will be stored.
    • inverse

      public void inverse()
      Inverses this transformation.
      Overrides:
      inverse in class EuclideanTransformation3D
    • inverseAndReturnNew

      public Transformation3D inverseAndReturnNew()
      Computes the inverse of this transformation and returns the result as a new transformation instance.
      Overrides:
      inverseAndReturnNew in class EuclideanTransformation3D
      Returns:
      inverse transformation.
    • inverse

      protected void inverse(MetricTransformation3D result)
      Computes the inverse of this transformation and stores the result in provided instance.
      Parameters:
      result - instance where inverse transformation will be stored.
    • toMetric

      public MetricTransformation3D 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:
      toMetric in class EuclideanTransformation3D
      Returns:
      this transformation converted into a metric transformation.
    • toAffine

      public AffineTransformation3D toAffine()
      Converts this transformation into an affine transformation.
      Returns:
      this transformation converted into an affine transformation.
    • combine

      public void combine(EuclideanTransformation3D transformation)
      Combines this transformation with provided transformation. The combination is equivalent to multiplying the matrix of this transformation with the matrix of provided transformation.
      Overrides:
      combine in class EuclideanTransformation3D
      Parameters:
      transformation - transformation to be combined with.
    • combineAndReturnNew

      public MetricTransformation3D combineAndReturnNew(EuclideanTransformation3D transformation)
      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:
      combineAndReturnNew in class EuclideanTransformation3D
      Parameters:
      transformation - transformation to be combined with.
      Returns:
      A new transformation resulting of the combination with this transformation and provided transformation.
    • combine

      public void combine(MetricTransformation3D transformation)
      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

      public MetricTransformation3D combineAndReturnNew(MetricTransformation3D transformation)
      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:
      setTransformationFromPoints in class EuclideanTransformation3D
      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).