org.geotools.referencing.operation.matrix
Interface XMatrix

All Superinterfaces:
Cloneable, Matrix
All Known Implementing Classes:
GeneralMatrix, Matrix1, Matrix2, Matrix3, Matrix4

public interface XMatrix
extends Matrix

A matrix capables to perform some matrix operations. The basic Matrix interface is basically just a two dimensional array of numbers. The XMatrix interface add inversion and multiplication capabilities. It is used as a bridge across various matrix implementations in Java3D (Matrix3f, Matrix3d, Matrix4f, Matrix4d, GMatrix).

Since:
2.2
Author:
Martin Desruisseaux (IRD), Simone Giannecchini

Method Summary
 boolean equals(Matrix matrix, double tolerance)
          Compares the element values regardless the object class.
 double getElement(int row, int column)
          Returns the element at the specified index.
 int getNumCol()
          Returns the number of colmuns in this matrix.
 int getNumRow()
          Returns the number of rows in this matrix.
 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 column, 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.
 void transpose()
          Sets the value of this matrix to its transpose.
 
Methods inherited from interface Matrix
clone
 

Method Detail

getNumRow

int getNumRow()
Returns the number of rows in this matrix.

Specified by:
getNumRow in interface Matrix
Returns:
The number of rows in this matrix.

getNumCol

int getNumCol()
Returns the number of colmuns in this matrix.

Specified by:
getNumCol in interface Matrix
Returns:
The number of columns in this matrix.

getElement

double getElement(int row,
                  int column)
Returns the element at the specified index.

Specified by:
getElement in interface Matrix
Parameters:
row - The row number to be retrieved (zero indexed).
column - The column number to be retrieved (zero indexed).
Returns:
The value at the indexed element.

setElement

void setElement(int row,
                int column,
                double value)
Set the element at the specified index.

Specified by:
setElement in interface Matrix
Parameters:
row - The row number to be retrieved (zero indexed).
column - The column number to be retrieved (zero indexed).
value - The new matrix element value.

setZero

void setZero()
Sets all the values in this matrix to zero.


setIdentity

void setIdentity()
Sets this matrix to the identity matrix.


isIdentity

boolean isIdentity()
Returns true if this matrix is an identity matrix.

Specified by:
isIdentity in interface Matrix
Returns:
true if this matrix is an identity matrix.

isIdentity

boolean isIdentity(double tolerance)
Returns 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.

Parameters:
tolerance - The tolerance value.
Returns:
true if this matrix is close enough to the identity matrix given the tolerance value.
Since:
2.4

isAffine

boolean isAffine()
Returns 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.

Returns:
true if this matrix is affine.

negate

void negate()
Negates the value of this matrix: this = -this.


transpose

void transpose()
Sets the value of this matrix to its transpose.


invert

void invert()
            throws SingularMatrixException
Inverts this matrix in place.

Throws:
SingularMatrixException - if this matrix is not invertible.

multiply

void multiply(Matrix matrix)
Sets the value of this matrix to the result of multiplying itself with the specified matrix. In other words, performs 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.

Parameters:
matrix - The matrix to multiply to this matrix.

equals

boolean equals(Matrix matrix,
               double tolerance)
Compares the element values regardless the object class. This is similar to a call to GMatrix.epsilonEquals(matrix, tolerance). The method name is intentionally different in order to avoid ambiguities at compile-time.

Parameters:
matrix - The matrix to compare.
tolerance - The tolerance value.
Returns:
true if this matrix is close enough to the given matrix given the tolerance value.
Since:
2.5


Copyright © 1996-2014 Geotools. All Rights Reserved.