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