Class Matrices2x2F
java.lang.Object
com.io7m.jtensors.core.unparameterized.matrices.Matrices2x2F
Functions over Matrix2x2F 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 TypeMethodDescriptionstatic Matrix2x2Fadd(Matrix2x2F m0, Matrix2x2F m1) Add the matricesm0andm1.static Vector2Fstatic Vector2Fstatic doubleCalculate the determinant of the matrixm.static Matrix2x2Fidentity()The identity matrix.static Optional<Matrix2x2F> invert(Matrix2x2F m) Calculate the inverse of the matrixm.static Matrix2x2Fmultiply(Matrix2x2F m0, Matrix2x2F m1) Multiply the matricesm0andm1.static Vector2FMultiply the vectorvby the matrixm.static Matrix2x2FConstruct a matrix from the column vectors(c0, c1).static Matrix2x2FConstruct a matrix from the row vectors(r0, r1).static Matrix2x2FofScale(double x, double y) Construct a matrix that will scale by(x, y).static Vector2Frow0(Matrix2x2F m) static Vector2Frow1(Matrix2x2F m) static Matrix2x2Fscale(Matrix2x2F m, double r) Scale the matrixmbyr.static Matrix2x2Fsubtract(Matrix2x2F m0, Matrix2x2F m1) Subtract the matricesm0andm1.static doubletrace(Matrix2x2F m) Return the trace of the matrixm.static Matrix2x2FCalculate the transpose of the matrixm.static Matrix2x2FwithColumn(Matrix2x2F m, int column, float r0, float r1) Set the columncolumnofmto(r0, r1).static Matrix2x2FwithRow(Matrix2x2F m, int row, float c0, float c1) Set the rowrowofmto(c0, c1).static Matrix2x2Fzero()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).- Parameters:
c0- The column 0c1- The column 1- Returns:
- A constructed matrix
-
ofRows
Construct a matrix from the row vectors(r0, r1).- Parameters:
r0- The row 0r1- The row 1- Returns:
- A constructed matrix
-
ofScale
Construct a matrix that will scale by(x, y).- Parameters:
x- The X scaling valuey- The Y scaling 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
-
column0
- Parameters:
m- The matrix- Returns:
- Column 0 of the matrix
-
column1
- Parameters:
m- The matrix- Returns:
- Column 1 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).- Parameters:
m- The matrixcolumn- The column index in the range[0, 1]* @param r0 The value of row 0 in the columnr1- The value of row 1 in the column- Returns:
- A matrix with the given row
-
withRow
Set the rowrowofmto(c0, c1).- Parameters:
m- The matrixrow- The row index in the range[0, 1]c0- The value of column 0 in the rowc1- The value of column 1 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.
-