|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectMatrix3d
Matrix3
public class Matrix3
A matrix of fixed 3×3 size. This specialized matrix provides
better accuracy than GeneralMatrix for matrix inversion and multiplication.
| referencing/geotk-referencing (download) | View source code for this class |
| Field Summary | |
|---|---|
static int |
SIZE
The matrix size, which is 3. |
| Fields inherited from class Matrix3d |
|---|
m00, m01, m02, m10, m11, m12, m20, m21, m22 |
| Constructor Summary | |
|---|---|
Matrix3()
Creates a new identity matrix. |
|
Matrix3(AffineTransform transform)
Constructs a 3×3 matrix from the specified affine transform. |
|
Matrix3(double[] elements)
Creates a new matrix initialized to the specified values. |
|
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. |
|
| Method Summary | |
|---|---|
Matrix3 |
clone()
Returns a clone of this matrix. |
boolean |
equals(Matrix matrix,
double tolerance)
Compares the element values regardless the object class. |
boolean |
equals(Object object,
ComparisonMode mode)
Compares this matrix with the given object for equality. |
boolean |
equalsAffine(AffineTransform transform)
Returns true if this matrix is equal to the specified affine transform. |
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. |
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 coefficient value is NaN. |
void |
multiply(Matrix matrix)
Sets the value of this matrix to the result of multiplying itself with the specified matrix. |
void |
setMatrix(AffineTransform transform)
Sets this matrix to the specified affine transform. |
AffineTransform |
toAffineTransform()
Returns an affine transform for this matrix. |
String |
toString()
Returns a string representation of this matrix. |
| Methods inherited from class Matrix3d |
|---|
add, add, add, add, determinant, epsilonEquals, equals, equals, getColumn, getColumn, getElement, getRow, getRow, getScale, hashCode, invert, invert, mul, mul, mul, mul, mulNormalize, mulNormalize, mulTransposeBoth, mulTransposeLeft, mulTransposeRight, negate, negate, normalize, normalize, normalizeCP, normalizeCP, rotX, rotY, rotZ, set, set, set, set, set, set, set, set, setColumn, setColumn, setColumn, setElement, setIdentity, setRow, setRow, setRow, setScale, setZero, sub, sub, transform, transform, transpose, transpose |
| Methods inherited from class Object |
|---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface XMatrix |
|---|
invert, negate, setIdentity, setZero, transpose |
| Methods inherited from interface Matrix |
|---|
getElement, setElement |
| Methods inherited from interface LenientComparable |
|---|
equals |
| Field Detail |
|---|
public static final int SIZE
| Constructor Detail |
|---|
public Matrix3()
public Matrix3(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22)
m00 - The first matrix element in the first row.m01 - The second matrix element in the first row.m02 - The third matrix element in the first row.m10 - The first matrix element in the second row.m11 - The second matrix element in the second row.m12 - The third matrix element in the second row.m20 - The first matrix element in the third row.m21 - The second matrix element in the third row.m22 - The third matrix element in the third row.public Matrix3(double[] elements)
elements - Elements of the matrix. Column indices vary fastest.public Matrix3(AffineTransform transform)
transform - The affine transform to copy.toAffineTransform()
public Matrix3(Matrix matrix)
throws IllegalArgumentException
matrix - The matrix to copy.
IllegalArgumentException - if the given matrix is not of the expected size.| Method Detail |
|---|
public final int getNumRow()
getNumRow in interface Matrixpublic final int getNumCol()
getNumCol in interface Matrixpublic final boolean isIdentity()
true if this matrix is an identity matrix.
isIdentity in interface Matrixpublic 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 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.
isAffine in interface XMatrixtrue if this matrix is affine.public final boolean isNaN()
true if at least one coefficient value is NaN.
true if at least one coefficient value is NaN.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.
multiply in interface XMatrixmatrix - The matrix to multiply to this matrix.public void setMatrix(AffineTransform transform)
transform - The affine transform to copy.
public AffineTransform toAffineTransform()
throws IllegalStateException
IllegalStateException - if the last row is not [0 0 1].public boolean equalsAffine(AffineTransform transform)
true if this matrix is equal to the specified affine transform.
transform - The affine transform to test for equality.
true if the given affine transform has the same coefficients than this matrix.
public boolean equals(Matrix matrix,
double tolerance)
GMatrix.epsilonEquals. The method name is
intentionally different in order to avoid ambiguities at compile-time.
equals in interface XMatrixmatrix - The matrix to compare.tolerance - The tolerance value.
true if this matrix is close enough to the given matrix
given the tolerance value.
public boolean equals(Object object,
ComparisonMode mode)
mode argument:
STRICT: the two matrixes must be of the same
class, have the same size and the same element values.BY_CONTRACT/IGNORE_METADATA: the two matrixes must have the same size and the same element
values, but are not required to be the same implementation class (any Matrix
is okay).APPROXIMATIVE: the two matrixes must have
the same size, but the element values can differ up to some threshold. The threshold
value is determined empirically and may change in future Geotk versions.
equals in interface XMatrixequals in interface LenientComparableobject - The object to compare to this.mode - The strictness level of the comparison.
true if both objects are equal.public String toString()
toString in class Matrix3dpublic Matrix3 clone()
clone in interface XMatrixclone in interface Matrixclone in class Matrix3d
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||