public class Matrix3 extends Object implements XMatrix, Serializable
| Modifier and Type | Field and Description |
|---|---|
static int |
SIZE
The matrix size, which is 3.
|
| Constructor and Description |
|---|
Matrix3()
Creates a new identity matrix.
|
Matrix3(AffineTransform transform)
Constructs a 3×3 matrix from the specified affine transform.
|
Matrix3(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22)
Creates a new matrix initialized to the specified values.
|
Matrix3(Matrix matrix)
Creates a new matrix initialized to the same value than the specified one.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(double scalar)
Performs an in-place scalar addition.
|
void |
add(double scalar,
XMatrix matrix)
Set to the scalar addition of
scalar+matrix |
void |
add(XMatrix matrix)
Set to the matrix addition of
this+matrix. |
void |
add(XMatrix matrix1,
XMatrix matrix2)
Set to the matrix addition of
matrix1+matrix2. |
Matrix3 |
clone()
Returns a clone of this matrix.
|
double |
determinate()
Computes the determinant
|
boolean |
equals(Matrix matrix,
double tolerance)
Compares the element values.
|
boolean |
equals(Object obj) |
boolean |
equalsAffine(AffineTransform transform)
Returns
true if this matrix is equals to the specified affine transform. |
void |
getColumn(int col,
double[] array)
Extract col to provided array.
|
double |
getElement(int row,
int column)
Returns the value at the row, column position in the matrix.
|
int |
getNumCol()
Returns the number of colmuns in this matrix, which is always 3 in this
implementation.
|
int |
getNumRow()
Returns the number of rows in this matrix, which is always 3 in this
implementation.
|
void |
getRow(int row,
double[] array)
Extract row to provided array
|
int |
hashCode() |
void |
invert()
Inverts this matrix in place.
|
void |
invert(Matrix matrix)
Set to the inverse of the provided matrix.
|
boolean |
isAffine()
Returns
true if this matrix is an affine transform. |
boolean |
isIdentity()
Returns
true if this matrix is an identity matrix. |
boolean |
isIdentity(double tolerance)
Returns
true if this matrix is an identity matrix using the provided tolerance. |
boolean |
isNaN()
Returns
true if at least one value is NaN. |
void |
mul(double scalar)
Sets this matrix to the result of multiplying itself with the provided scalar.
|
void |
mul(double scalar,
Matrix matrix)
Sets the value of this matrix to the result of multiplying the provided scalar and matrix.
|
void |
mul(Matrix matrix)
In-place multiply with provided matrix.
|
void |
mul(Matrix matrix1,
Matrix matrix2)
In-place update from matrix1 * matrix2.
|
void |
multiply(Matrix matrix)
Sets the value of this matrix to the result of multiplying itself with the specified matrix.
|
void |
negate()
Changes the sign of each element in the matrix.
|
void |
negate(Matrix matrix)
Negates the value of this matrix:
this = -matrix. |
void |
set(double[] matrix)
Update in place to the provided matrix (row-order).
|
void |
setColumn(int column,
double... values)
Sets the value of the column using an array of values.
|
void |
setElement(int row,
int column,
double value)
Sets the value of the row, column position in the matrix.
|
void |
setIdentity()
Sets the main diagonal of this matrix to be 1.0.
|
void |
setMatrix(AffineTransform transform)
Sets this matrix to the specified affine transform.
|
void |
setRow(int row,
double... values)
Sets the value of the row using an array of values.
|
void |
setZero()
Sets each value of the matrix to 0.0.
|
void |
sub(double scalar)
In-place matrix subtraction:
this - scalar. |
void |
sub(double scalar,
Matrix matrix)
Set to the difference of
scalar - matrix2. |
void |
sub(Matrix matrix)
In-place matrix subtraction:
this - matrix. |
void |
sub(Matrix matrix1,
Matrix matrix2)
Set to the difference of
matrix1 - matrix2. |
AffineTransform |
toAffineTransform2D()
Returns an affine transform for this matrix.
|
String |
toString()
Returns a string representation of this matrix.
|
void |
transpose()
Transposes the matrix.
|
void |
transpose(Matrix matrix)
Set to the transpose of the provided matrix.
|
public static final int SIZE
public Matrix3()
public Matrix3(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22)
public Matrix3(AffineTransform transform)
public Matrix3(Matrix matrix)
public final int getNumRow()
public final int getNumCol()
public final boolean isNaN()
true if at least one value is NaN.public void setMatrix(AffineTransform transform)
public boolean equalsAffine(AffineTransform transform)
true if this matrix is equals to the specified affine transform.public Matrix3 clone()
clone in interface Matrixclone in class ObjectObject.clone()public final boolean isAffine()
true if this matrix is an affine transform. A transform is affine if the
matrix is square and last row contains only zeros, except in the last column which contains
1.public void negate()
public void negate(Matrix matrix)
XMatrixthis = -matrix.public void transpose()
public void transpose(Matrix matrix)
XMatrixpublic void invert()
XMatrixpublic void invert(Matrix matrix) throws SingularMatrixException
XMatrixinvert in interface XMatrixmatrix - The matrix that is to be inverted. Not modified.SingularMatrixException - if this matrix is not invertible.public double getElement(int row,
int column)
getElement in interface XMatrixgetElement in interface Matrixrow - column - public void setColumn(int column,
double... values)
XMatrixpublic void setRow(int row,
double... values)
XMatrixpublic void setElement(int row,
int column,
double value)
setElement in interface Matrixrow - column - value - public void setZero()
public void setIdentity()
setIdentity in interface XMatrixpublic final boolean isIdentity()
true if this matrix is an identity matrix.isIdentity in interface Matrixtrue if this matrix is an identity matrix.public final boolean isIdentity(double tolerance)
true if this matrix is an identity matrix using the provided tolerance. This
method is equivalent to computing the difference between this matrix and an identity matrix
of identical size, and returning true if and only if all differences are smaller than
or equal to tolerance.isIdentity in interface XMatrixtolerance - The tolerance value.true if this matrix is close enough to the identity matrix given the
tolerance value.public final void multiply(Matrix matrix)
this = this × matrix. In the context
of coordinate transformations, this is equivalent to
AffineTransform.concatenate:
first transforms by the supplied transform and then transform the result by the original
transform.public boolean equals(Matrix matrix, double tolerance)
XMatrixpublic final AffineTransform toAffineTransform2D() throws IllegalStateException
IllegalStateException - if this matrix is not 3×3, or if the last row is not
[0 0 1].public String toString()
public void getColumn(int col,
double[] array)
public void mul(double scalar)
XMatrixpublic void mul(double scalar,
Matrix matrix)
XMatrixpublic void getRow(int row,
double[] array)
public final void mul(Matrix matrix)
public void sub(double scalar)
XMatrixthis - scalar.public void sub(double scalar,
Matrix matrix)
XMatrixscalar - matrix2.public void sub(Matrix matrix)
XMatrixthis - matrix.public void sub(Matrix matrix1, Matrix matrix2)
XMatrixmatrix1 - matrix2.public void set(double[] matrix)
matrix - public void add(double scalar)
XMatrixpublic void add(double scalar,
XMatrix matrix)
XMatrixscalar+matrixpublic void add(XMatrix matrix)
XMatrixthis+matrix.public void add(XMatrix matrix1, XMatrix matrix2)
XMatrixmatrix1+matrix2.public double determinate()
XMatrixdeterminate in interface XMatrixCopyright © 1996–2019 Geotools. All rights reserved.