public final class Matrices4x4D extends Object
Functions over Matrix4x4D 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).
| Modifier and Type | Method and Description |
|---|---|
static Matrix4x4D |
add(Matrix4x4D m0,
Matrix4x4D m1)
Add the matrices
m0 and m1. |
static Vector4D |
column0(Matrix4x4D m) |
static Vector4D |
column1(Matrix4x4D m) |
static Vector4D |
column2(Matrix4x4D m) |
static Vector4D |
column3(Matrix4x4D m) |
static double |
determinant(Matrix4x4D m)
Calculate the determinant of the matrix
m. |
static Matrix4x4D |
identity()
The identity matrix.
|
static Optional<Matrix4x4D> |
invert(Matrix4x4D m)
Calculate the inverse of the matrix
m. |
static Matrix4x4D |
multiply(Matrix4x4D m0,
Matrix4x4D m1)
Multiply the matrices
m0 and m1. |
static Vector4D |
multiplyVectorPost(Matrix4x4D m,
Vector4D v)
Multiply the vector
v by the matrix m. |
static Matrix4x4D |
ofAxisAngle(double axis_x,
double axis_y,
double axis_z,
double angle)
Construct a matrix that will rotate by
angle radians around the axis (x, y, z). |
static Matrix4x4D |
ofColumns(Vector4D c0,
Vector4D c1,
Vector4D c2,
Vector4D c3)
Construct a matrix from the column vectors
(c0, c1, c2, c3). |
static Matrix4x4D |
ofRows(Vector4D r0,
Vector4D r1,
Vector4D r2,
Vector4D r3)
Construct a matrix from the row vectors
(r0, r1, r2, r3). |
static Matrix4x4D |
ofScale(double x,
double y,
double z)
Construct a matrix that will scale by
(x, y, z). |
static Matrix4x4D |
ofTranslation(double x,
double y,
double z)
Construct a matrix that will translate by
(x, y, z). |
static Vector4D |
row0(Matrix4x4D m) |
static Vector4D |
row1(Matrix4x4D m) |
static Vector4D |
row2(Matrix4x4D m) |
static Vector4D |
row3(Matrix4x4D m) |
static Matrix4x4D |
scale(Matrix4x4D m,
double r)
Scale the matrix
m by r. |
static Matrix4x4D |
subtract(Matrix4x4D m0,
Matrix4x4D m1)
Subtract the matrices
m0 and m1. |
static double |
trace(Matrix4x4D m)
Return the trace of the matrix
m. |
static Matrix4x4D |
transpose(Matrix4x4D m)
Calculate the transpose of the matrix
m. |
static Matrix4x4D |
withColumn(Matrix4x4D m,
int column,
double r0,
double r1,
double r2,
double r3)
Set the column
column of m to (r0, r1, r2, r3). |
static Matrix4x4D |
withRow(Matrix4x4D m,
int row,
double c0,
double c1,
double c2,
double c3)
Set the row
row of m to (c0, c1, c2, c3). |
static Matrix4x4D |
zero()
The zero matrix.
|
public static Matrix4x4D add(Matrix4x4D m0, Matrix4x4D m1)
m0 and m1.m0 - The left matrixm1 - The right matrixm0 + m1public static double determinant(Matrix4x4D m)
m.m - The matrixmpublic static Optional<Matrix4x4D> invert(Matrix4x4D m)
m.m - The matrixm, or nothing if no inverse existspublic static Matrix4x4D multiply(Matrix4x4D m0, Matrix4x4D m1)
m0 and m1.m0 - The left matrixm1 - The right matrixm0 * m1public static Vector4D multiplyVectorPost(Matrix4x4D m, Vector4D v)
Multiply the vector v by the matrix m.
This is post multiplication.
m - The matrixv - The vectorm * vpublic static Matrix4x4D ofColumns(Vector4D c0, Vector4D c1, Vector4D c2, Vector4D c3)
(c0, c1, c2, c3).c0 - The column 0c1 - The column 1c2 - The column 2c3 - The column 3public static Matrix4x4D ofRows(Vector4D r0, Vector4D r1, Vector4D r2, Vector4D r3)
(r0, r1, r2, r3).r0 - The row 0r1 - The row 1r2 - The row 2r3 - The row 3public static Matrix4x4D ofScale(double x, double y, double z)
(x, y, z).x - The X scaling valuey - The Y scaling valuez - The Z scaling valuepublic static Matrix4x4D ofTranslation(double x, double y, double z)
(x, y, z).x - The X scaling valuey - The Y scaling valuez - The Z scaling valuepublic static Matrix4x4D ofAxisAngle(double axis_x, double axis_y, double axis_z, double angle)
angle radians around the axis (x, y, z).angle - The angle in radiansaxis_x - The X axis valueaxis_y - The Y axis valueaxis_z - The Z axis valuepublic static Vector4D row0(Matrix4x4D m)
m - The matrixpublic static Vector4D row1(Matrix4x4D m)
m - The matrixpublic static Vector4D row2(Matrix4x4D m)
m - The matrixpublic static Vector4D row3(Matrix4x4D m)
m - The matrixpublic static Vector4D column0(Matrix4x4D m)
m - The matrixpublic static Vector4D column1(Matrix4x4D m)
m - The matrixpublic static Vector4D column2(Matrix4x4D m)
m - The matrixpublic static Vector4D column3(Matrix4x4D m)
m - The matrixpublic static Matrix4x4D scale(Matrix4x4D m, double r)
m by r.m - The matrixr - The scale factorm * rpublic static Matrix4x4D subtract(Matrix4x4D m0, Matrix4x4D m1)
m0 and m1.m0 - The left matrixm1 - The right matrixm0 - m1public static double trace(Matrix4x4D m)
m. The trace is defined as the sum
of the diagonal elements of the matrix.m - The matrixpublic static Matrix4x4D transpose(Matrix4x4D m)
m.m - The matrixmpublic static Matrix4x4D withColumn(Matrix4x4D m, int column, double r0, double r1, double r2, double r3)
column of m to (r0, r1, r2, r3).m - The matrixcolumn - The column index in the range [0, 3]
* @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 columnr3 - The value of row 3 in the columnpublic static Matrix4x4D withRow(Matrix4x4D m, int row, double c0, double c1, double c2, double c3)
row of m to (c0, c1, c2, c3).m - The matrixrow - The row index in the range [0, 3]c0 - The value of column 0 in the rowc1 - The value of column 1 in the rowc2 - The value of column 2 in the rowc3 - The value of column 3 in the rowpublic static Matrix4x4D zero()
public static Matrix4x4D identity()
Copyright © 2017 <code@io7m.com> http://io7m.com