|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectStatic
MatrixFactory
public final class MatrixFactory
Static utility methods for creating matrix. This factory selects one of the Matrix1,
Matrix2, Matrix3, Matrix4 or GeneralMatrix implementation
according the desired matrix size. Note that if the matrix size is know at compile time,
it may be more efficient to invoke directly the constructor of the appropriate class instead.
| referencing/geotk-referencing (download) | View source code for this class |
| Method Summary | |
|---|---|
static XMatrix |
create(int size)
Creates a square identity matrix of size size × size. |
static XMatrix |
create(int numRow,
int numCol)
Creates a matrix of size numRow × numCol. |
static XMatrix |
create(int numRow,
int numCol,
double[] elements)
Creates a matrix of size numRow × numCol
initialized to the given elements. |
static XMatrix |
create(Matrix matrix)
Creates a new matrix which is a copy of the specified matrix. |
static Matrix |
getMatrix(MathTransform transform)
If the given transform is linear, returns its coefficients as a matrix. |
static GeneralMatrix |
toGeneralMatrix(Matrix matrix)
Converts the specified matrix to GeneralMatrix. |
static XMatrix |
toOptimalMatrix(Matrix matrix)
Converts the specified matrix to the most suitable Geotk implementation. |
static XMatrix |
toXMatrix(Matrix matrix)
Converts the specified matrix to a Geotk implementation. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static XMatrix create(int size)
size × size.
size - For an affine transform, this is the number of source and target dimensions + 1.
public static XMatrix create(int numRow,
int numCol)
numRow × numCol.
Elements on the diagonal (j == i) are set to 1.
numRow - For an affine transform, this is the number of
target dimensions + 1.numCol - For an affine transform, this is the number of
source dimensions + 1.
public static XMatrix create(int numRow,
int numCol,
double[] elements)
numRow × numCol
initialized to the given elements. The elements array size must be equals
to numRow*numCol. Column indices vary fastest, as expected by the
GeneralMatrix.GeneralMatrix(int,int,double[]) constructor.
numRow - Number of rows.numCol - Number of columns.elements - Elements of the matrix. Column indices vary fastest.
public static XMatrix create(Matrix matrix)
matrix - The matrix to copy.
public static Matrix getMatrix(MathTransform transform)
LinearTransform, returns
LinearTransform.getMatrix().AffineTransform,
returns its coefficients in a Matrix3 instance.null.
transform - The transform, or null.
null if none.public static XMatrix toXMatrix(Matrix matrix)
matrix is already
an instance of XMatrix, then it is returned unchanged. Otherwise all elements
are copied in a new XMatrix object.
matrix - The matrix to convert, or null.
XMatrix object, or null
if the given matrix was null.public static XMatrix toOptimalMatrix(Matrix matrix)
Matrix1, Matrix2,
Matrix3 or Matrix4 specialized classes, then it is returned unchanged.Matrix1, Matrix2,
Matrix3 or Matrix4 respectively, and the new instance is returned.toXMatrix(Matrix).Using those specialized implementations brings a little bit of performance and, more important, precision in the floating point results of matrix operations.
matrix - The matrix to convert, or null.
XMatrix object.public static GeneralMatrix toGeneralMatrix(Matrix matrix)
GeneralMatrix. If matrix is already an
instance of GeneralMatrix, then it is returned unchanged. Otherwise all elements
are copied in a new GeneralMatrix object.
Consider using toXMatrix(Matrix) instead than this method if a XMatrix
instance is sufficient. Use this method only if a GeneralMatrix is really necessary.
matrix - The matrix to convert, or null.
GeneralMatrix object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||