Class LinearMapping2D

java.lang.Object
imagingbook.common.geometry.mappings.linear.LinearMapping2D
All Implemented Interfaces:
Inversion, Mapping2D, Cloneable
Direct Known Subclasses:
ProjectiveMapping2D

public class LinearMapping2D extends Object implements Mapping2D, Inversion

This class represents an arbitrary linear transformation in 2D. Instances of this class and any subclass are immutable. See Secs. 21.1 and 21.3 of [1] for details.

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

  • Field Details

    • a00

      protected final double a00
    • a01

      protected final double a01
    • a02

      protected final double a02
    • a10

      protected final double a10
    • a11

      protected final double a11
    • a12

      protected final double a12
    • a20

      protected final double a20
    • a21

      protected final double a21
    • a22

      protected final double a22
  • Constructor Details

    • LinearMapping2D

      public LinearMapping2D()
      Constructor, creates a new identity mapping.
    • LinearMapping2D

      public LinearMapping2D(double[][] A)
      Creates a linear mapping from a transformation matrix of arbitrary size (may be even empty). The actual transformation matrix is formed by inserting the given matrix into a 3x3 identity matrix starting at position (0,0).
      Parameters:
      A - a matrix of arbitrary size
    • LinearMapping2D

      public LinearMapping2D(double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22)
      Creates an arbitrary linear mapping from the specified matrix elements.
      Parameters:
      a00 - matrix element A_00
      a01 - matrix element A_01
      a02 - matrix element A_02
      a10 - matrix element A_10
      a11 - matrix element A_11
      a12 - matrix element A_12
      a20 - matrix element A_20
      a21 - matrix element A_21
      a22 - matrix element A_22
    • LinearMapping2D

      Creates a new linear mapping from an existing linear mapping.
      Parameters:
      lm - a given linear mapping
  • Method Details

    • normalize

      Scales the transformation matrix such that a22 becomes 1. Any linear mapping can be normalized and thereby be converted to a projective mapping (see ProjectiveMapping2D.
      Returns:
      the normalized linear mapping (i.e., a projective mapping)
    • applyTo

      public Pnt2d applyTo(Pnt2d pnt)
      Description copied from interface: Mapping2D
      Applies this mapping to a single 2D point.
      Specified by:
      applyTo in interface Mapping2D
      Parameters:
      pnt - the original point
      Returns:
      the transformed point
    • getInverse

      Calculates and returns the inverse mapping.
      Specified by:
      getInverse in interface Inversion
      Returns:
      the inverse mapping
    • concat

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

      Concatenates a sequence of linear mappings AA = (A1, A2, ..., An), with the result A(x) = A1(A2(...(An(x))...)). Thus, the mapping An is applied first and A1 last, with the associated transformation matrix a = a1 * a2 * ... * an. If AA is empty, the identity mapping is returned. If AA contains only a single mapping, a copy of this mapping is returned.
      Parameters:
      AA - a (possibly empty) sequence of linear transformations
      Returns:
      the concatenated linear transformation
    • getTransformationMatrix

      public double[][] getTransformationMatrix()
      Retrieves the transformation matrix for this mapping.
      Returns:
      the 3x3 transformation matrix
    • duplicate

      Returns a copy of this mapping.
      Returns:
      a new mapping of the same type
    • toString

      public String toString()
      Overrides:
      toString in class Object