All Implemented Interfaces:
Inversion, Jacobian, Mapping2D, Cloneable

public class Translation2D extends AffineMapping2D

This class represents a pure 2D translation (as a special case of affine transformation). Instances are immutable and it can be assumed that every instance of this class is indeed a translation. See Secs. 21.1.3 and 21.3.1 of [1] for details.

[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).

  • Constructor Details

    • Translation2D

      public Translation2D(double tx, double ty)
      Constructor, creates a new 2D translation mapping.
      Parameters:
      tx - translation in x
      ty - translation in y
    • Translation2D

      public Translation2D(double[] txy)
      Constructor, creates a new 2D translation mapping.
      Parameters:
      txy - translation in x/y (2-element array)
    • Translation2D

      Constructor, reates a new translation instance from a given translation.
      Parameters:
      m - a 2D translation mapping
  • Method Details

    • fromPoints

      public static Translation2D fromPoints(Pnt2d p, Pnt2d q)
      Creates a new translation that maps between the first point to the second point specified.
      Parameters:
      p - the first point
      q - the second point
      Returns:
      a new translation instance
    • duplicate

      Description copied from class: AffineMapping2D
      Returns a copy of this mapping.
      Overrides:
      duplicate in class AffineMapping2D
      Returns:
      a new affine mapping
    • concat

      Concatenates this translation A with another translation B and returns a new translation C, such that C(x) = B(A(x)).
      Parameters:
      B - the second translation
      Returns:
      the concatenated translations
    • getInverse

      Description copied from class: AffineMapping2D
      Calculates and returns the inverse mapping. Note that the inverse A' of a projective transformation matrix A is again a linear transformation but its a'2' element is generally not 1. Scaling A' to A'' = A' / a22' yields a projective transformation that reverses A. While A * A' = I, the result of A * A'' is a scaled identity matrix. Note that inverting an affine transformation always yields another affine transformation.
      Specified by:
      getInverse in interface Inversion
      Overrides:
      getInverse in class AffineMapping2D
      Returns:
      the inverse projective transformation
    • getJacobian

      public double[][] getJacobian(Pnt2d xy)
      Description copied from interface: Jacobian

      Returns the Jacobian matrix for this mapping, evaluated at the given 2D point. See Appendix Sec. D.1.1 of [1] for more details.

      [1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).

      Specified by:
      getJacobian in interface Jacobian
      Overrides:
      getJacobian in class AffineMapping2D
      Parameters:
      xy - the 2D position to calculate the Jacobian for
      Returns:
      the Jacobian matrix