|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.math.geometry.Matrix
public final class Matrix
Immutable representation of a 3x3 matrix.
| Field Summary | |
|---|---|
static Matrix |
IDENTITY
Immutable Matrix instance representing the identity 3x3 matrix. |
static Matrix |
ZERO
Immutable Matrix instance representing a zero 3x3 matrix. |
| Method Summary | |
|---|---|
Matrix |
add(Matrix other)
Adds the given matrix to this one. |
double |
determinant()
Calculates the determinant of this matrix. |
boolean |
equals(Object obj)
Compares the specified object for equality with this matrix. |
double |
get(int row,
int col)
Returns the matrix element at the specified position. |
Vector3D |
getColumnVector(int col)
Returns the column vector at the specified column. |
double |
getElement00()
Returns a specific matrix element. |
double |
getElement01()
Returns a specific matrix element. |
double |
getElement02()
Returns a specific matrix element. |
double |
getElement10()
Returns a specific matrix element. |
double |
getElement11()
Returns a specific matrix element. |
double |
getElement12()
Returns a specific matrix element. |
double |
getElement20()
Returns a specific matrix element. |
double |
getElement21()
Returns a specific matrix element. |
double |
getElement22()
Returns a specific matrix element. |
int |
hashCode()
Returns the hash code for this matrix. |
Matrix |
invert()
Returns a matrix which is the inverse of this matrix, if it exists, otherwise throws ArithmeticException. |
Matrix |
multiply(double value)
Multiplies this matrix element-wise with a scalar value. |
Matrix |
multiply(Matrix other)
Multiplies this matrix with another matrix (Result = this*other). |
Vector3D |
multiply(Vector3D vector)
Multiplies this matrix with a vector. |
static Matrix |
ofColumnFirst(double d00,
double d10,
double d20,
double d01,
double d11,
double d21,
double d02,
double d12,
double d22)
Returns an immutable Matrix instance from column-first order values. |
static Matrix |
ofColumns(Vector3D col0,
Vector3D col1,
Vector3D col2)
Returns an immutable Matrix instance constructed from column vectors. |
static Matrix |
ofRowFirst(double d00,
double d01,
double d02,
double d10,
double d11,
double d12,
double d20,
double d21,
double d22)
Returns an immutable Matrix instance from row-first order values. |
Matrix |
subtract(Matrix other)
Subtracts the given matrix from this one. |
String |
toString()
Returns the matrix value as a 3x3 matrix formatted in a way compatible with popular scientific numerical computing applications. |
String |
toString(NumberFormat fmt)
Returns the matrix value as a 3x3 matrix formatted in a way similar to popular scientific numerical computing applications. |
double |
trace()
Calculates the trace of this matrix, i.e. the sum of the diagonal elements. |
Matrix |
transpose()
Returns a new matrix which consists of the transposed values of this matrix. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Matrix ZERO
Matrix instance representing a zero 3x3 matrix.
public static final Matrix IDENTITY
Matrix instance representing the identity 3x3 matrix.
| Method Detail |
|---|
public static Matrix ofColumnFirst(double d00,
double d10,
double d20,
double d01,
double d11,
double d21,
double d02,
double d12,
double d22)
Matrix instance from column-first order values.
d00 - Value of the matrix in field 0x0d10 - Value of the matrix in field 1x0d20 - Value of the matrix in field 2x0d01 - Value of the matrix in field 0x1d11 - Value of the matrix in field 1x1d21 - Value of the matrix in field 2x1d02 - Value of the matrix in field 0x2d12 - Value of the matrix in field 1x2d22 - Value of the matrix in field 2x2
Matrix instance
public static Matrix ofRowFirst(double d00,
double d01,
double d02,
double d10,
double d11,
double d12,
double d20,
double d21,
double d22)
Matrix instance from row-first order values.
d00 - Value of the matrix in field 0x0d01 - Value of the matrix in field 0x1d02 - Value of the matrix in field 0x2d10 - Value of the matrix in field 1x0d11 - Value of the matrix in field 1x1d12 - Value of the matrix in field 1x2d20 - Value of the matrix in field 2x0d21 - Value of the matrix in field 2x1d22 - Value of the matrix in field 2x2
Matrix instance
public static Matrix ofColumns(Vector3D col0,
Vector3D col1,
Vector3D col2)
Matrix instance constructed from column vectors.
col0 - The vector in the first column (index 0)col1 - The vector in the second column (index 1)col2 - The vector in the third column (index 2)
Matrix instancepublic double getElement00()
public double getElement01()
public double getElement02()
public double getElement10()
public double getElement11()
public double getElement12()
public double getElement20()
public double getElement21()
public double getElement22()
public double get(int row,
int col)
row - The row of the position. Must be between 0 and 2.col - The column of the position. Must be between 0 and 2.
IndexOutOfBoundsException - illegal indexpublic Vector3D getColumnVector(int col)
col - The index of the column. Must be between 0 and 2.
IndexOutOfBoundsException - illegal indexpublic Matrix transpose()
public Matrix invert()
ArithmeticException.
The matrix is invertible if its determinant is non-zero.
ArithmeticException - if the matrix is not invertibledeterminant()public double determinant()
public double trace()
public Matrix multiply(double value)
value - The scalar value.
public Vector3D multiply(Vector3D vector)
vector - The other vector.
public Matrix multiply(Matrix other)
other - The other matrix.
public Matrix add(Matrix other)
other - another matrix
public Matrix subtract(Matrix other)
other - another matrix
public String toString()
MathUtils.getDefaultNumberFormat().
The following string can be regarded as typical:
[[0.0 0.0 -1.0]; [0.0 -1.0 0.0]; [-1.0 0.0 0.0]]
toString in class Objectpublic String toString(NumberFormat fmt)
NumberFormat.format(double) method of the given formatter.
Example: The following code snippet, used on a given Matrix mat
NumberFormat fmt = NumberFormat.getNumberInstance(Locale.US); fmt.setMinimumFractionDigits(1); fmt.setMaximumFractionDigits(3); System.out.println(mat.toString(fmt));might give the following output:
[[0.707 -0.707 0.0]; [0.707 0.707 0.0]; [0.0 0.0 1.0]]
fmt - the NumberFormat used to format the number values
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectobj - Object to be compared with this matrix.
true if the object is equal to this matrix.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||