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 Matrix
clone
in class Object
Object.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)
XMatrix
this = -matrix
.public void transpose()
public void transpose(Matrix matrix)
XMatrix
public void invert()
XMatrix
public void invert(Matrix matrix) throws SingularMatrixException
XMatrix
invert
in interface XMatrix
matrix
- 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 XMatrix
getElement
in interface Matrix
row
- column
- public void setColumn(int column, double... values)
XMatrix
public void setRow(int row, double... values)
XMatrix
public void setElement(int row, int column, double value)
setElement
in interface Matrix
row
- column
- value
- public void setZero()
public void setIdentity()
setIdentity
in interface XMatrix
public final boolean isIdentity()
true
if this matrix is an identity matrix.isIdentity
in interface Matrix
true
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 XMatrix
tolerance
- 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)
XMatrix
public 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)
XMatrix
public void mul(double scalar, Matrix matrix)
XMatrix
public void getRow(int row, double[] array)
public final void mul(Matrix matrix)
public void sub(double scalar)
XMatrix
this - scalar
.public void sub(double scalar, Matrix matrix)
XMatrix
scalar - matrix2
.public void sub(Matrix matrix)
XMatrix
this - matrix
.public void sub(Matrix matrix1, Matrix matrix2)
XMatrix
matrix1 - matrix2
.public void set(double[] matrix)
matrix
- public void add(double scalar)
XMatrix
public void add(double scalar, XMatrix matrix)
XMatrix
scalar+matrix
public void add(XMatrix matrix)
XMatrix
this+matrix
.public void add(XMatrix matrix1, XMatrix matrix2)
XMatrix
matrix1+matrix2
.public double determinate()
XMatrix
determinate
in interface XMatrix
Copyright © 1996–2019 Geotools. All rights reserved.