Class AffineMatrix
java.lang.Object
org.apache.sis.internal.referencing.j2d.AffineMatrix
- All Implemented Interfaces:
Serializable,Cloneable,ExtendedPrecisionMatrix,org.opengis.referencing.operation.Matrix
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
FieldsModifier and TypeFieldDescriptionprivate final double[]The error terms, ornullif none.private static final intThe length of an array containing all matrix elements.private static final intThe length of an array containing all matrix elements together with error terms.private static final intThe length of an array containing only the matrix elements to be stored.private static final longFor cross-version compatibility.private static final intThe number of rows and columns of this matrix.private final AffineTransformThe transform from which to get the matrix terms.Fields inherited from interface org.apache.sis.internal.referencing.ExtendedPrecisionMatrix
IDENTITY, ZERO -
Constructor Summary
ConstructorsConstructorDescriptionAffineMatrix(AffineTransform transform) 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 TypeMethodDescriptionfinal org.opengis.referencing.operation.Matrixclone()Returns a copy of the matrix that user can modify.booleanCompares this matrix with the given object for equality, including error terms (if any).final doublegetElement(int row, int column) Returns the matrix element at the given index.double[]Returns all matrix elements in row-major order.intGets the number of columns in the matrix.intGets the number of rows in the matrix.inthashCode()Returns a hash code value for this matrix.booleanReturnstrueif the backing affine transform is the identity transform.final voidsetElement(int row, int column, double value) Unsupported operation, since this matrix is unmodifiable.toString()Returns a string representation of this matrix.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
SIZE
private static final int SIZEThe number of rows and columns of this matrix.- See Also:
-
LENGTH
private static final int LENGTHThe length of an array containing all matrix elements.- See Also:
-
LENGTH_STORED
private static final int LENGTH_STOREDThe 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_EXTENDEDThe length of an array containing all matrix elements together with error terms.- See Also:
-
transform
The transform from which to get the matrix terms. -
errors
private final double[] errorsThe error terms, ornullif 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:
getNumRowin interfaceorg.opengis.referencing.operation.Matrix
-
getNumCol
public int getNumCol()Gets the number of columns in the matrix.- Specified by:
getNumColin interfaceorg.opengis.referencing.operation.Matrix
-
isIdentity
public boolean isIdentity()Returnstrueif the backing affine transform is the identity transform.- Specified by:
isIdentityin interfaceorg.opengis.referencing.operation.Matrix
-
getExtendedElements
public double[] getExtendedElements()Returns all matrix elements in row-major order. Note that this is not the same order thanAffineTransformconstructor.- Specified by:
getExtendedElementsin interfaceExtendedPrecisionMatrix- 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:
getElementin interfaceorg.opengis.referencing.operation.Matrix
-
setElement
public final void setElement(int row, int column, double value) Unsupported operation, since this matrix is unmodifiable.- Specified by:
setElementin interfaceorg.opengis.referencing.operation.Matrix
-
clone
public final org.opengis.referencing.operation.Matrix clone()Returns a copy of the matrix that user can modify. -
equals
Compares this matrix with the given object for equality, including error terms (if any). -
hashCode
public int hashCode()Returns a hash code value for this matrix. -
toString
Returns a string representation of this matrix.
-