Package org.jlab.detector.geant4.v2.SVT
Class Matrix
java.lang.Object
org.jlab.detector.geant4.v2.SVT.Matrix
Geometry Base
Universal class for simple matrix algebra and rotation conversions.- Version:
- 1.1.0
- Author:
- pdavies
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionclone()Clones this Matrix.static MatrixconvertRotationAxisAngleToMatrix(double[] aAxisAngle) Converts the given axis-angle rotation to a rotation matrix.static MatrixconvertRotationFromEulerInXYZ_ExZYX(double angle_x, double angle_y, double angle_z) Converts the given Tait-Bryan angles to a rotation matrix.static MatrixconvertRotationFromEulerInZYX_ExXYZ(double angle_x, double angle_y, double angle_z) Converts the given Tait-Bryan angles to a rotation matrix.static double[]convertRotationToEulerInXYZ_ExZYX(Matrix aMatrix) Converts the given rotation matrix to Tait-Bryan angles.double[]getData()Returns the data array of this Matrix.static MatrixMultiplies the two given matrices together with matrix multiplication.static MatrixrotateX(double angle) Constructs a rotation matrix for rotation about the X axis by the given angle.static MatrixrotateY(double angle) Constructs a rotation matrix for rotation about the Y axis by the given angle.static MatrixrotateZ(double angle) Constructs a rotation matrix for rotation about the Z axis by the given angle.voidshow()Prints data array with format "% 8.3f" for each element.voidPrints the given string to standard output, followed by show().static MatrixReturns a transposed clone of the given Matrix.booleanverify()Returns true if the length of the data array is equal to the product of the number of rows and columns.
- 
Constructor Details- 
Matrixpublic Matrix(int aNRows, int aNCols, double[] aData) throws NullPointerException, IllegalArgumentException Constructs a new Matrix with given rows, columns, and data.- Parameters:
- aNRows- rows
- aNCols- columns
- aData- data
- Throws:
- NullPointerException- no data
- IllegalArgumentException- negative or zero rows or columns
 
- 
MatrixConstructs a new Matrix with given rows and columns, and allocates an empty data array.- Parameters:
- aNRows- rows
- aNCols- columns
- Throws:
- IllegalArgumentException- negative or zero rows or columns
 
 
- 
- 
Method Details- 
getDatapublic double[] getData()Returns the data array of this Matrix.- Returns:
- double[] array
 
- 
cloneClones this Matrix.
- 
verifypublic boolean verify()Returns true if the length of the data array is equal to the product of the number of rows and columns.- Returns:
- boolean true/false
 
- 
showPrints the given string to standard output, followed by show().- Parameters:
- s- string
 
- 
showPrints data array with format "% 8.3f" for each element.- Throws:
- NullPointerException- no data
 
- 
rotateXConstructs a rotation matrix for rotation about the X axis by the given angle.- Parameters:
- angle- in radians
- Returns:
- Matrix column-based rotation matrix
 
- 
rotateYConstructs a rotation matrix for rotation about the Y axis by the given angle.- Parameters:
- angle- in radians
- Returns:
- Matrix column-based rotation matrix
 
- 
rotateZConstructs a rotation matrix for rotation about the Z axis by the given angle.- Parameters:
- angle- in radians
- Returns:
- Matrix column-based rotation matrix
 
- 
convertRotationAxisAngleToMatrixConverts the given axis-angle rotation to a rotation matrix. http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/- Parameters:
- aAxisAngle- axis-angle rotation, format: { rx, ry, rz, ra }, angle in radians
- Returns:
- Matrix a column-based rotation matrix
 
- 
convertRotationFromEulerInZYX_ExXYZpublic static Matrix convertRotationFromEulerInZYX_ExXYZ(double angle_x, double angle_y, double angle_z) Converts the given Tait-Bryan angles to a rotation matrix. Tait-Bryan Euler: intrinsic ZY'X" == extrinsic XYZ rotation matrix M = Z(c)*Y(b)*X(a) http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q36- Parameters:
- angle_x- in radians
- angle_y- in radians
- angle_z- in radians
- Returns:
- Matrix a column-based rotation matrix
 
- 
convertRotationFromEulerInXYZ_ExZYXpublic static Matrix convertRotationFromEulerInXYZ_ExZYX(double angle_x, double angle_y, double angle_z) Converts the given Tait-Bryan angles to a rotation matrix. Tait-Bryan Euler: intrinsic XY'Z" == extrinsic ZYX rotation matrix M = X(a)*Y(b)*Z(c) http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q36- Parameters:
- angle_x- in radians
- angle_y- in radians
- angle_z- in radians
- Returns:
- Matrix a column-based rotation matrix
 
- 
convertRotationToEulerInXYZ_ExZYXConverts the given rotation matrix to Tait-Bryan angles. Tait-Bryan Euler: intrinsic XY'Z" == extrinsic ZYX rotation matrix M = X(a)*Y(b)*Z(c)- Parameters:
- aMatrix- a column-based rotation matrix
- Returns:
- double[] xyz angles in radians
 
- 
transposeReturns a transposed clone of the given Matrix.- Parameters:
- aMatrix- matrix
- Returns:
- Matrix tranposed clone
 
- 
matMulMultiplies the two given matrices together with matrix multiplication. R = AB- Parameters:
- aMatrixA- matrix
- aMatrixB- matrix
- Returns:
- Matrix result
- Throws:
- IllegalArgumentException- check sizes of matrices
 
 
-