|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectMatrix2
public class Matrix2
| Field Summary | |
|---|---|
double |
m00
The first matrix element in the first row. |
double |
m01
The second matrix element in the first row. |
double |
m10
The first matrix element in the second row. |
double |
m11
The second matrix element in the second row. |
static int |
SIZE
The matrix size, which is 2. |
| Constructor Summary | |
|---|---|
Matrix2()
Creates a new identity matrix. |
|
Matrix2(double m00,
double m01,
double m10,
double m11)
Creates a new matrix initialized to the specified values. |
|
Matrix2(Matrix matrix)
Creates a new matrix initialized to the same value than the specified one. |
|
| Method Summary | |
|---|---|
Matrix2 |
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)
Returns true if the specified object is of type Matrix2 and
all of the data members are equal to the corresponding data members in this matrix. |
double |
getElement(int row,
int col)
Returns the element at the specified index. |
int |
getNumCol()
Returns the number of colmuns in this matrix, which is always 2 in this implementation. |
int |
getNumRow()
Returns the number of rows in this matrix, which is always 2 in this implementation. |
int |
hashCode()
Returns a hash code value based on the data values in this object. |
void |
invert()
Inverts this matrix in place. |
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. |
void |
multiply(Matrix matrix)
Sets the value of this matrix to the result of multiplying itself with the specified matrix. |
void |
negate()
Negates the value of this matrix: this = -this. |
void |
setElement(int row,
int col,
double value)
Set the element at the specified index. |
void |
setIdentity()
Sets this matrix to the identity matrix. |
void |
setZero()
Sets all the values in this matrix to zero. |
String |
toString()
Returns a string representation of this matrix. |
void |
transpose()
Sets the value of this matrix to its transpose. |
| Methods inherited from class Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int SIZE
public double m00
public double m01
public double m10
public double m11
| Constructor Detail |
|---|
public Matrix2()
public Matrix2(double m00,
double m01,
double m10,
double m11)
public Matrix2(Matrix matrix)
| Method Detail |
|---|
public final int getNumRow()
getNumRow in interface XMatrixgetNumRow in interface Matrixpublic final int getNumCol()
getNumCol in interface XMatrixgetNumCol in interface Matrix
public final double getElement(int row,
int col)
getElement in interface XMatrixgetElement in interface Matrixrow - The row number to be retrieved (zero indexed).col - The column number to be retrieved (zero indexed).
public final void setElement(int row,
int col,
double value)
setElement in interface XMatrixsetElement in interface Matrixrow - The row number to be retrieved (zero indexed).col - The column number to be retrieved (zero indexed).value - The new matrix element value.public final void setZero()
setZero in interface XMatrixpublic final void setIdentity()
setIdentity in interface XMatrixpublic final boolean isIdentity()
true if this matrix is an identity matrix.
isIdentity in interface XMatrixisIdentity 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 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 void negate()
this = -this.
negate in interface XMatrixpublic final void transpose()
transpose in interface XMatrixpublic final void invert()
invert in interface XMatrixpublic 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 boolean equals(Matrix matrix,
double tolerance)
GMatrix.epsilonEquals(matrix,
tolerance). 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)
true if the specified object is of type Matrix2 and
all of the data members are equal to the corresponding data members in this matrix.
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic Matrix2 clone()
clone in interface Matrixclone in class ObjectObject.clone()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||