Class Matrices3x3F
java.lang.Object
com.io7m.jtensors.core.unparameterized.matrices.Matrices3x3F
public final class Matrices3x3F
extends java.lang.Object
Functions over Matrix3x3F values.
See "Mathematics for 3D Game Programming and Computer Graphics" 2nd Ed for the derivations of most of the code in this class (ISBN: 1-58450-277-0).
- Since:
- 8.0.0
-
Method Summary
Modifier and Type Method Description static Matrix3x3Fadd(Matrix3x3F m0, Matrix3x3F m1)Add the matricesm0andm1.static Vector3Fcolumn0(Matrix3x3F m)static Vector3Fcolumn1(Matrix3x3F m)static Vector3Fcolumn2(Matrix3x3F m)static doubledeterminant(Matrix3x3F m)Calculate the determinant of the matrixm.static Matrix3x3Fidentity()The identity matrix.static java.util.Optional<Matrix3x3F>invert(Matrix3x3F m)Calculate the inverse of the matrixm.static Matrix3x3Fmultiply(Matrix3x3F m0, Matrix3x3F m1)Multiply the matricesm0andm1.static Vector3FmultiplyVectorPost(Matrix3x3F m, Vector3F v)Multiply the vectorvby the matrixm.static Matrix3x3FofAxisAngle(double axis_x, double axis_y, double axis_z, double angle)Construct a matrix that will rotate byangleradians around the axis(x, y, z).static Matrix3x3FofColumns(Vector3F c0, Vector3F c1, Vector3F c2)Construct a matrix from the column vectors(c0, c1, c2).static Matrix3x3FofRows(Vector3F r0, Vector3F r1, Vector3F r2)Construct a matrix from the row vectors(r0, r1, r2).static Matrix3x3FofScale(double x, double y, double z)Construct a matrix that will scale by(x, y, z).static Vector3Frow0(Matrix3x3F m)static Vector3Frow1(Matrix3x3F m)static Vector3Frow2(Matrix3x3F m)static Matrix3x3Fscale(Matrix3x3F m, double r)Scale the matrixmbyr.static Matrix3x3Fsubtract(Matrix3x3F m0, Matrix3x3F m1)Subtract the matricesm0andm1.static doubletrace(Matrix3x3F m)Return the trace of the matrixm.static Matrix3x3Ftranspose(Matrix3x3F m)Calculate the transpose of the matrixm.static Matrix3x3FwithColumn(Matrix3x3F m, int column, float r0, float r1, float r2)Set the columncolumnofmto(r0, r1, r2).static Matrix3x3FwithRow(Matrix3x3F m, int row, float c0, float c1, float c2)Set the rowrowofmto(c0, c1, c2).static Matrix3x3Fzero()The zero matrix.
-
Method Details
-
add
Add the matricesm0andm1.- Parameters:
m0- The left matrixm1- The right matrix- Returns:
m0 + m1
-
determinant
Calculate the determinant of the matrixm.- Parameters:
m- The matrix- Returns:
- The determinant of
m
-
invert
Calculate the inverse of the matrixm.- Parameters:
m- The matrix- Returns:
- The inverse of
m, or nothing if no inverse exists
-
multiply
Multiply the matricesm0andm1.- Parameters:
m0- The left matrixm1- The right matrix- Returns:
m0 * m1
-
multiplyVectorPost
Multiply the vector
vby the matrixm.This is post multiplication.
- Parameters:
m- The matrixv- The vector- Returns:
m * v
-
ofColumns
Construct a matrix from the column vectors(c0, c1, c2).- Parameters:
c0- The column 0c1- The column 1c2- The column 2- Returns:
- A constructed matrix
-
ofRows
Construct a matrix from the row vectors(r0, r1, r2).- Parameters:
r0- The row 0r1- The row 1r2- The row 2- Returns:
- A constructed matrix
-
ofScale
Construct a matrix that will scale by(x, y, z).- Parameters:
x- The X scaling valuey- The Y scaling valuez- The Z scaling value- Returns:
- A constructed matrix
-
ofAxisAngle
Construct a matrix that will rotate byangleradians around the axis(x, y, z).- Parameters:
angle- The angle in radiansaxis_x- The X axis valueaxis_y- The Y axis valueaxis_z- The Z axis value- Returns:
- A constructed matrix
-
row0
- Parameters:
m- The matrix- Returns:
- Row 0 of the matrix
-
row1
- Parameters:
m- The matrix- Returns:
- Row 1 of the matrix
-
row2
- Parameters:
m- The matrix- Returns:
- Row 2 of the matrix
-
column0
- Parameters:
m- The matrix- Returns:
- Column 0 of the matrix
-
column1
- Parameters:
m- The matrix- Returns:
- Column 1 of the matrix
-
column2
- Parameters:
m- The matrix- Returns:
- Column 2 of the matrix
-
scale
Scale the matrixmbyr.- Parameters:
m- The matrixr- The scale factor- Returns:
m * r
-
subtract
Subtract the matricesm0andm1.- Parameters:
m0- The left matrixm1- The right matrix- Returns:
m0 - m1
-
trace
Return the trace of the matrixm. The trace is defined as the sum of the diagonal elements of the matrix.- Parameters:
m- The matrix- Returns:
- The trace of the matrix
-
transpose
Calculate the transpose of the matrixm.- Parameters:
m- The matrix- Returns:
- The transpose of
m
-
withColumn
Set the columncolumnofmto(r0, r1, r2).- Parameters:
m- The matrixcolumn- The column index in the range[0, 2]* @param r0 The value of row 0 in the columnr1- The value of row 1 in the columnr2- The value of row 2 in the column- Returns:
- A matrix with the given row
-
withRow
Set the rowrowofmto(c0, c1, c2).- Parameters:
m- The matrixrow- The row index in the range[0, 2]c0- The value of column 0 in the rowc1- The value of column 1 in the rowc2- The value of column 2 in the row- Returns:
- A matrix with the given row
-
zero
The zero matrix.- Returns:
- A matrix with all zero components
-
identity
The identity matrix.- Returns:
- A matrix with all diagonal components set to 1 and all other components set to 0.
-