Package org.eclipse.mosaic.lib.math
Class Matrix3d
java.lang.Object
org.eclipse.mosaic.lib.math.Matrix3d
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
RotationMatrix
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a matrix to this matrix.Adds a matrix to this matrix and writes the result into the result matrix.copy()
Creates copy of this matrix.boolean
double
get
(int row, int col) Get a specific value from the matrix by row and column indexdouble[]
getAsDoubleArray
(double[] result, MatrixElementOrder outputOrder) Returns the values of the matrix and writes it into the the given double array.float[]
getAsFloatArray
(float[] result, MatrixElementOrder outputOrder) Returns the values of the matrix and writes it into the the given float array.int
hashCode()
static Matrix3d
Creates a new identity matrix in 3x3 format.boolean
Writes a inverted version of this matrix into the result matrix.boolean
invert()
Inverts this matrix.boolean
isFuzzyEqual
(Matrix3d other) Multiplies this matrix with another matrix and writes the result into the result matrix.Multiplies this matrix with a 3-dimensional vector.Multiplies this matrix with a 3-dimensional vector and writes the result into the given vector.set
(double[] values, MatrixElementOrder inputOrder) Sets the values of the matrix by the given double array.set
(float[] values, MatrixElementOrder inputOrder) Sets the values of the matrix by the given float array.set
(int row, int col, double value) Sets a specific value in the matrix by row and column indexCopies the values from the given matrix to this matrix.Sets all values to match identity matrix.setZero()
Sets all values to zero.Subtracts a matrix from this matrix.Subtracts a matrix from this matrix and writes the result into the result matrix.toString()
Transposes this matrix.Writes a transposed version of this matrix into the result matrix.
-
Field Details
-
m
protected final double[] mArray holding value of the matrix. Values are stored in column-major order.- See Also:
-
-
Constructor Details
-
Matrix3d
public Matrix3d()Creates a new 3x3 matrix, with all values being zero. -
Matrix3d
Creates a new 3x3 matrix, with the values being copied from the given matrix.
-
-
Method Details
-
identityMatrix
Creates a new identity matrix in 3x3 format. -
setIdentity
Sets all values to match identity matrix. -
setZero
Sets all values to zero. -
set
Copies the values from the given matrix to this matrix. -
set
Sets the values of the matrix by the given double array. The order parameter defines how the values in the given array are arranged (either column or row-wise). -
set
Sets the values of the matrix by the given float array. The order parameter defines how the values in the given array are arranged (either column or row-wise). -
getAsDoubleArray
Returns the values of the matrix and writes it into the the given double array. The order parameter defines how the values in the given array will be arranged (either column or row-wise). -
getAsFloatArray
Returns the values of the matrix and writes it into the the given float array. The order parameter defines how the values in the given array will be arranged (either column or row-wise). -
get
public double get(int row, int col) Get a specific value from the matrix by row and column index -
set
Sets a specific value in the matrix by row and column index -
add
Adds a matrix to this matrix. -
add
Adds a matrix to this matrix and writes the result into the result matrix. -
subtract
Subtracts a matrix from this matrix. -
subtract
Subtracts a matrix from this matrix and writes the result into the result matrix. -
multiply
Multiplies this matrix with another matrix and writes the result into the result matrix. -
multiply
Multiplies this matrix with a 3-dimensional vector. -
multiply
Multiplies this matrix with a 3-dimensional vector and writes the result into the given vector. -
transpose
Transposes this matrix. -
transpose
Writes a transposed version of this matrix into the result matrix. -
invert
public boolean invert()Inverts this matrix.- Returns:
true
, if the inverse could be created.
-
inverse
Writes a inverted version of this matrix into the result matrix.- Returns:
true
, if the inverse could be created.
-
copy
Creates copy of this matrix. -
isFuzzyEqual
-
equals
-
hashCode
public int hashCode() -
toString
-