java.lang.Object
io.sf.jclf.math.linear3.Matrices
Basic operations with 3x3 matrices.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
determinant3
(double[][] a) static void
inverse3
(double[][] a, double[][] inverse) Compute the inverse of a 3x3 matrixa
.static void
multiplyByMatrix3
(double[][] a, double[][] b, double[][] result) Multiply the 3x3 matrixa
by 3x3 matrixb
.static void
multiplyByVector3
(double[][] a, double[] v, double[] result) Multiply the 3x3 matrixa
by tri-vectorv
.static void
multiplyByVector3
(double[][] a, double x, double y, double z, double[] result) Multiply the 3x3 matrixa
by a 3-vector of componentsx
,y
andz
.static double[][]
rotation
(double[] u, double angleRad) Create a rotation matrix respect to the given axis.static double[][]
rotX
(double angleRad) Create ax
-rotation matrix.static double[][]
rotY
(double angleRad) Create ay
-rotation matrix.static double[][]
rotZ
(double angleRad) Create az
-rotation matrix.static void
transpose3
(double[][] a) In-place transposition of a 3x3 matrix.
-
Constructor Details
-
Matrices
public Matrices()
-
-
Method Details
-
inverse3
public static void inverse3(double[][] a, double[][] inverse) Compute the inverse of a 3x3 matrixa
.- Parameters:
a
- the matrix whose inverse has to be computed.inverse
- the 3x3 matrix where the inverse is to be stored.- Throws:
IllegalArgumentException
- if the determinant is null and the inverse cannot be computed.
-
determinant3
public static double determinant3(double[][] a) -
multiplyByVector3
public static void multiplyByVector3(double[][] a, double[] v, double[] result) Multiply the 3x3 matrixa
by tri-vectorv
.- Parameters:
a
- the matrix to be multiplied.v
- the tri-vector.result
- the vector to store the result in.
-
multiplyByVector3
public static void multiplyByVector3(double[][] a, double x, double y, double z, double[] result) Multiply the 3x3 matrixa
by a 3-vector of componentsx
,y
andz
.- Parameters:
a
- the matrix to be multiplied.x
- the first component of the vector.y
- the second component of the vector.z
- the third component of the vector.result
- the vector to store the result in.
-
multiplyByMatrix3
public static void multiplyByMatrix3(double[][] a, double[][] b, double[][] result) Multiply the 3x3 matrixa
by 3x3 matrixb
.- Parameters:
a
- the first matrix operand.b
- the second matrix operand.result
- the 3x3 matrix where the result of the multiplication is to be stored.
-
transpose3
public static void transpose3(double[][] a) In-place transposition of a 3x3 matrix.- Parameters:
a
- the matrix to transpose.
-
rotX
public static double[][] rotX(double angleRad) Create ax
-rotation matrix.- Parameters:
angleRad
- the rotation angle, in radians.- Returns:
- the rotation matrix.
-
rotY
public static double[][] rotY(double angleRad) Create ay
-rotation matrix.- Parameters:
angleRad
- the rotation angle, in radians.- Returns:
- the rotation matrix.
-
rotZ
public static double[][] rotZ(double angleRad) Create az
-rotation matrix.- Parameters:
angleRad
- the rotation angle, in radians.- Returns:
- the rotation matrix.
-
rotation
public static double[][] rotation(double[] u, double angleRad) Create a rotation matrix respect to the given axis.- Parameters:
u
- the unit vector defining the rotation axis.angleRad
- the rotation angle, in radians.- Returns:
- the rotation matrix.
-