Contents
- Description
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getData()
- clone()
- verify()
- show(String)
- show()
- rotateX(double)
- rotateY(double)
- rotateZ(double)
- convertRotationAxisAngleToMatrix(double[])
- convertRotationFromEulerInZYX_ExXYZ(double, double, double)
- convertRotationFromEulerInXYZ_ExZYX(double, double, double)
- convertRotationToEulerInXYZ_ExZYX(Matrix)
- transpose(Matrix)
- matMul(Matrix, Matrix)
Class Matrix
java.lang.Object
org.jlab.detector.geant4.v2.SVT.Matrix
- Version:
- 1.1.0
- Author:
- pdavies
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this Matrix.static Matrix
convertRotationAxisAngleToMatrix
(double[] aAxisAngle) Converts the given axis-angle rotation to a rotation matrix.static Matrix
convertRotationFromEulerInXYZ_ExZYX
(double angle_x, double angle_y, double angle_z) Converts the given Tait-Bryan angles to a rotation matrix.static Matrix
convertRotationFromEulerInZYX_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 Matrix
Multiplies the two given matrices together with matrix multiplication.static Matrix
rotateX
(double angle) Constructs a rotation matrix for rotation about the X axis by the given angle.static Matrix
rotateY
(double angle) Constructs a rotation matrix for rotation about the Y axis by the given angle.static Matrix
rotateZ
(double angle) Constructs a rotation matrix for rotation about the Z axis by the given angle.void
show()
Prints data array with format "% 8.3f" for each element.void
Prints the given string to standard output, followed by show().static Matrix
Returns a transposed clone of the given Matrix.boolean
verify()
Returns true if the length of the data array is equal to the product of the number of rows and columns.
-
Constructor Details
-
Matrix
public Matrix(int aNRows, int aNCols, double[] aData) throws NullPointerException, IllegalArgumentException Constructs a new Matrix with given rows, columns, and data.- Parameters:
aNRows
- rowsaNCols
- columnsaData
- data- Throws:
NullPointerException
- no dataIllegalArgumentException
- negative or zero rows or columns
-
Matrix
Constructs a new Matrix with given rows and columns, and allocates an empty data array.- Parameters:
aNRows
- rowsaNCols
- columns- Throws:
IllegalArgumentException
- negative or zero rows or columns
-
-
Method Details
-
getData
public double[] getData()Returns the data array of this Matrix.- Returns:
- double[] array
-
clone
-
verify
public 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
-
show
Prints the given string to standard output, followed by show().- Parameters:
s
- string
-
show
Prints data array with format "% 8.3f" for each element.- Throws:
NullPointerException
- no data
-
rotateX
Constructs a rotation matrix for rotation about the X axis by the given angle.- Parameters:
angle
- in radians- Returns:
- Matrix column-based rotation matrix
-
rotateY
Constructs a rotation matrix for rotation about the Y axis by the given angle.- Parameters:
angle
- in radians- Returns:
- Matrix column-based rotation matrix
-
rotateZ
Constructs a rotation matrix for rotation about the Z axis by the given angle.- Parameters:
angle
- in radians- Returns:
- Matrix column-based rotation matrix
-
convertRotationAxisAngleToMatrix
Converts 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_ExXYZ
public 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 radiansangle_y
- in radiansangle_z
- in radians- Returns:
- Matrix a column-based rotation matrix
-
convertRotationFromEulerInXYZ_ExZYX
public 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 radiansangle_y
- in radiansangle_z
- in radians- Returns:
- Matrix a column-based rotation matrix
-
convertRotationToEulerInXYZ_ExZYX
Converts 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
-
transpose
-
matMul
Multiplies the two given matrices together with matrix multiplication. R = AB- Parameters:
aMatrixA
- matrixaMatrixB
- matrix- Returns:
- Matrix result
- Throws:
IllegalArgumentException
- check sizes of matrices
-