org.apache.commons.math3.geometry.euclidean.threed
Class Matrix3D

java.lang.Object
  extended by org.apache.commons.math3.geometry.euclidean.threed.Matrix3D
All Implemented Interfaces:
Serializable

public final class Matrix3D
extends Object
implements Serializable

This is a real 3x3 matrix designed to be used in geometric calculations. It is compatible with the Vector3D type.

Since:
1.0
Version:
$Id: Matrix3D.java 11374 2014-10-30 15:39:29Z sabatini $
Author:
Thomas Trapier, Julie Anton
See Also:
Vector3D, Serialized Form
Use sample :

Creation with a double[][] data : Matrix3D matrix = new Matrix3D(data); Multiplication with a Vector3D : Vector3D result = matrix.multiply(vector3D);

Concurrency :
immutable

Constructor Summary
Matrix3D(double[][] dataIn)
          Constructor
Needs the data to fill the matrix.
Matrix3D(RealMatrix matrix)
          Constructor
Creates a Matrix3D with a RealMatrix.
Matrix3D(Vector3D vector)
          Constructor
Builds a cross product matrix M from a vector u such as : M(u) * v = u^v
 
Method Summary
 Matrix3D add(Matrix3D added)
          Computes the addition of two Matrix3D
 boolean equals(Object other)
          Asserts two Matrix3D to be equal.
 double[][] getData()
           
 double getEntry(int row, int column)
          Returns the value of one entry of the matrix
 RealMatrix getRealMatrix()
           
 int hashCode()
          Get a hashCode for the 3D matrix.
 boolean isNaN()
          Returns true if any entry of this matrix is NaN; false otherwise
 boolean isOrthogonal(double thresholdNorm, double thresholdOrthogonality)
          Given a threshold, is this an orthogonal matrix? The method indicates if the matrix is orthogonal.
 Matrix3D multiply(double x)
          Computes a multiplication of this Matrix3D with a scalar
 Matrix3D multiply(Matrix3D mult)
          Computes a matrix multiplication between two Matrix3D objects
 Vector3D multiply(Vector3D mult)
          Computes the multiplication between a Matrix3D and a Vector3D
 Matrix3D subtract(Matrix3D sub)
          Computes the subtraction of a Matrix3D to this one
 String toString()
          Get a string representation for this matrix.
 Matrix3D transpose()
          Computes the transposition of this Matrix3D
 Vector3D transposeAndMultiply(Vector3D vector)
          Computes the multiplication of the transposed matrix of this Matrix3D with a Vector3D
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Matrix3D

public Matrix3D(double[][] dataIn)
Constructor
Needs the data to fill the matrix.

Parameters:
dataIn - data to fill the matrix
Since:
1.0

Matrix3D

public Matrix3D(RealMatrix matrix)
Constructor
Creates a Matrix3D with a RealMatrix.

Parameters:
matrix - RealMatrix to transform
Since:
1.0

Matrix3D

public Matrix3D(Vector3D vector)
Constructor
Builds a cross product matrix M from a vector u such as : M(u) * v = u^v

Parameters:
vector - the vector u such as M(u) * v = u^v
Since:
1.0
Method Detail

multiply

public Matrix3D multiply(Matrix3D mult)
Computes a matrix multiplication between two Matrix3D objects

Parameters:
mult - the Matrix3D right term of the multiplication
Returns:
the resulting Matrix3D

add

public Matrix3D add(Matrix3D added)
Computes the addition of two Matrix3D

Parameters:
added - the Matrix3D to be added
Returns:
the resulting Matrix3D

transpose

public Matrix3D transpose()
Computes the transposition of this Matrix3D

Returns:
the resulting Matrix3D

subtract

public Matrix3D subtract(Matrix3D sub)
Computes the subtraction of a Matrix3D to this one

Parameters:
sub - the Matrix3D to be subtracted
Returns:
the resulting Matrix3D

multiply

public Vector3D multiply(Vector3D mult)
Computes the multiplication between a Matrix3D and a Vector3D

Parameters:
mult - the Vector3D right term of the multiplication
Returns:
the resulting Vector3D

multiply

public Matrix3D multiply(double x)
Computes a multiplication of this Matrix3D with a scalar

Parameters:
x - the Matrix3D right term of the multiplication
Returns:
the resulting Matrix3D

transposeAndMultiply

public Vector3D transposeAndMultiply(Vector3D vector)
Computes the multiplication of the transposed matrix of this Matrix3D with a Vector3D

Parameters:
vector - the Vector3D right term of the multiplication
Returns:
the resulting Vector3D

isOrthogonal

public boolean isOrthogonal(double thresholdNorm,
                            double thresholdOrthogonality)
Given a threshold, is this an orthogonal matrix? The method indicates if the matrix is orthogonal. To do so the method checks if the column vectors of the matrix form an orthonomal set.

Parameters:
thresholdNorm - : allowed error with respect to the normality of the vectors
thresholdOrthogonality - : allowed error with respect to the mutual orthogonality of the vectors
Returns:
true if the vectors form an orthonormal set taking into account an allowed error, false otherwise

getData

public double[][] getData()
Returns:
the data

getRealMatrix

public RealMatrix getRealMatrix()
Returns:
the Array2DRowRealMatrix with identical data

equals

public boolean equals(Object other)
Asserts two Matrix3D to be equal.

Overrides:
equals in class Object
Parameters:
other - the Matrix3D to be compared to this
Returns:
true if the entries of both Matrix3D are equal

hashCode

public int hashCode()
Get a hashCode for the 3D matrix.

All NaN values have the same hash code.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object

isNaN

public boolean isNaN()
Returns true if any entry of this matrix is NaN; false otherwise

Returns:
true if any entry of this matrix is NaN; false otherwise

toString

public String toString()
Get a string representation for this matrix.

Overrides:
toString in class Object
Returns:
a string representation for this matrix

getEntry

public double getEntry(int row,
                       int column)
Returns the value of one entry of the matrix

Parameters:
row - the row of the wanted data
column - the column of the wanted data
Returns:
the data value


Copyright © 2016 CNES. All Rights Reserved.