Class AffineMatrix

java.lang.Object
org.apache.sis.internal.referencing.j2d.AffineMatrix
All Implemented Interfaces:
Serializable, Cloneable, ExtendedPrecisionMatrix, org.opengis.referencing.operation.Matrix

final class AffineMatrix extends Object implements ExtendedPrecisionMatrix, Serializable, Cloneable
The matrix of an AffineTransform, optionally with storage for the error terms used in double-double arithmetic.
Since:
0.5
Version:
1.3
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final double[]
    The error terms, or null if none.
    private static final int
    The length of an array containing all matrix elements.
    private static final int
    The length of an array containing all matrix elements together with error terms.
    private static final int
    The length of an array containing only the matrix elements to be stored.
    private static final long
    For cross-version compatibility.
    private static final int
    The number of rows and columns of this matrix.
    private final AffineTransform
    The transform from which to get the matrix terms.

    Fields inherited from interface org.apache.sis.internal.referencing.ExtendedPrecisionMatrix

    IDENTITY, ZERO
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new matrix wrapping the given transform without error terms.
    AffineMatrix(AffineTransform transform, double[] elements)
    Creates a new matrix wrapping the given transform.
  • Method Summary

    Modifier and Type
    Method
    Description
    final org.opengis.referencing.operation.Matrix
    Returns a copy of the matrix that user can modify.
    boolean
    Compares this matrix with the given object for equality, including error terms (if any).
    final double
    getElement(int row, int column)
    Returns the matrix element at the given index.
    double[]
    Returns all matrix elements in row-major order.
    int
    Gets the number of columns in the matrix.
    int
    Gets the number of rows in the matrix.
    int
    Returns a hash code value for this matrix.
    boolean
    Returns true if the backing affine transform is the identity transform.
    final void
    setElement(int row, int column, double value)
    Unsupported operation, since this matrix is unmodifiable.
    Returns a string representation of this matrix.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • SIZE

      private static final int SIZE
      The number of rows and columns of this matrix.
      See Also:
    • LENGTH

      private static final int LENGTH
      The length of an array containing all matrix elements.
      See Also:
    • LENGTH_STORED

      private static final int LENGTH_STORED
      The length of an array containing only the matrix elements to be stored. The last row is omitted because it is assumed to contain (0 0 1).
      See Also:
    • LENGTH_EXTENDED

      private static final int LENGTH_EXTENDED
      The length of an array containing all matrix elements together with error terms.
      See Also:
    • transform

      private final AffineTransform transform
      The transform from which to get the matrix terms.
    • errors

      private final double[] errors
      The error terms, or null if none. If non-null, then the length of this array shall be 6.
  • Constructor Details

    • AffineMatrix

      AffineMatrix(AffineTransform transform)
      Creates a new matrix wrapping the given transform without error terms.
      Parameters:
      transform - the transform to wrap.
    • AffineMatrix

      AffineMatrix(AffineTransform transform, double[] elements)
      Creates a new matrix wrapping the given transform.
      Parameters:
      transform - the transform to wrap.
      elements - the elements used for creating the matrix (optionally with error terms).
  • Method Details

    • getNumRow

      public int getNumRow()
      Gets the number of rows in the matrix.
      Specified by:
      getNumRow in interface org.opengis.referencing.operation.Matrix
    • getNumCol

      public int getNumCol()
      Gets the number of columns in the matrix.
      Specified by:
      getNumCol in interface org.opengis.referencing.operation.Matrix
    • isIdentity

      public boolean isIdentity()
      Returns true if the backing affine transform is the identity transform.
      Specified by:
      isIdentity in interface org.opengis.referencing.operation.Matrix
    • getExtendedElements

      public double[] getExtendedElements()
      Returns all matrix elements in row-major order. Note that this is not the same order than AffineTransform constructor.
      Specified by:
      getExtendedElements in interface ExtendedPrecisionMatrix
      Returns:
      a copy of matrix elements, potentially followed by error terms.
    • getElement

      public final double getElement(int row, int column)
      Returns the matrix element at the given index.
      Specified by:
      getElement in interface org.opengis.referencing.operation.Matrix
    • setElement

      public final void setElement(int row, int column, double value)
      Unsupported operation, since this matrix is unmodifiable.
      Specified by:
      setElement in interface org.opengis.referencing.operation.Matrix
    • clone

      public final org.opengis.referencing.operation.Matrix clone()
      Returns a copy of the matrix that user can modify.
      Specified by:
      clone in interface org.opengis.referencing.operation.Matrix
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object obj)
      Compares this matrix with the given object for equality, including error terms (if any).
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns a hash code value for this matrix.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of this matrix.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this matrix.