Class AffineTransformUtils

java.lang.Object
de.xima.fc.utils.AffineTransformUtils

public final class AffineTransformUtils extends Object
Utilities for affine transformations.
Author:
XIMA MEDIA GmbH
  • Constructor Details

    • AffineTransformUtils

      public AffineTransformUtils()
  • Method Details

    • getActionOnPointsInstance

      public static AffineTransform getActionOnPointsInstance(float[] oldPoints, float[] newPoints)
      A transform matrix is uniquely identified by its action on three linearly independent points. This methods creates that transform matrix for the three given points. The three old and new points must be linearly independent.

       newPoint1 = Matrix * oldPoint1
       newPoint2 = Matrix * oldPoint2
       newPoint3 = Matrix * oldPoint3
       
      Parameters:
      oldPoints - Coordinates of the three old points: [x1, y1, x2, y2, x3, y3].
      newPoints - Coordinates of the three new points: [x1', y1', x2', y2', x3', y3'].
      Returns:
      An affine transform with the effect that transforms the old points into the new points.
      Throws:
      org.apache.commons.math3.linear.SingularMatrixException - When the three points are not linearly independent.
    • getActionOnPointsInstance

      public static AffineTransform getActionOnPointsInstance(Point2D point1Old, Point2D point1New, Point2D point2Old, Point2D point2New, Point2D point3Old, Point2D point3New)
      A transform matrix is uniquely identified by its action on three linearly independent points. This methods creates that transform matrix for the three given points. The three old and new points must be linearly independent.

       newPoint1 = Matrix * oldPoint1
       newPoint2 = Matrix * oldPoint2
       newPoint3 = Matrix * oldPoint3
       
      Parameters:
      point1Old - Coordinates of the first point in the old coordinate system.
      point1New - Coordinates of the first point in the new coordinate system.
      point2Old - Coordinates of the second point in the old coordinate system.
      point2New - Coordinates of the second point in the new coordinate system.
      point3Old - Coordinates of the third point in the old coordinate system.
      point3New - Coordinates of the third point in the new coordinate system.
      Returns:
      An affine transform with the effect that transforms the old points into the new points.
      Throws:
      org.apache.commons.math3.linear.SingularMatrixException - When the three points are not linearly independent.