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, ornull
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
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.Matrix
clone()
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
hashCode()
Returns a hash code value for this matrix.boolean
Returnstrue
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.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, ornull
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 interfaceorg.opengis.referencing.operation.Matrix
-
getNumCol
public int getNumCol()Gets the number of columns in the matrix.- Specified by:
getNumCol
in interfaceorg.opengis.referencing.operation.Matrix
-
isIdentity
public boolean isIdentity()Returnstrue
if the backing affine transform is the identity transform.- Specified by:
isIdentity
in 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 thanAffineTransform
constructor.- Specified by:
getExtendedElements
in 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:
getElement
in 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:
setElement
in 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.
-