public final class PMatrices2x2F extends Object
Functions over PMatrix2x2F 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(PMatrix2x2F<A,B> m0,
PMatrix2x2F<C,D> m1)
Add the matrices
m0 and m1. |
static <A,B> Vector2F |
column0(PMatrix2x2F<A,B> m) |
static <A,B> Vector2F |
column1(PMatrix2x2F<A,B> m) |
static <A,B> double |
determinant(PMatrix2x2F<A,B> m)
Calculate the determinant of the matrix
m. |
static <A,B> PMatrix2x2F<A,B> |
identity()
The identity matrix.
|
static <A,B> Optional<PMatrix2x2F<B,A>> |
invert(PMatrix2x2F<A,B> m)
Calculate the inverse of the matrix
m. |
static <A,B,C> PMatrix2x2F<A,C> |
multiply(PMatrix2x2F<B,C> m0,
PMatrix2x2F<A,B> m1)
Multiply the matrices
m0 and m1. |
static <A,B> PVector2F<B> |
multiplyVectorPost(PMatrix2x2F<A,B> m,
PVector2F<A> v)
Multiply the vector
v by the matrix m. |
static Vector2F |
multiplyVectorPost(PMatrix2x2F m,
Vector2F v)
Multiply the vector
v by the matrix m. |
static <A,B> PMatrix2x2F<A,B> |
ofColumns(Vector2F c0,
Vector2F c1)
Construct a matrix from the column vectors
(c0, c1). |
static <A,B> PMatrix2x2F<A,B> |
ofRows(Vector2F r0,
Vector2F r1)
Construct a matrix from the row vectors
(r0, r1). |
static <A,B> PMatrix2x2F<A,B> |
ofScale(double x,
double y)
Construct a matrix that will scale by
(x, y). |
static <A,B> Vector2F |
row0(PMatrix2x2F<A,B> m) |
static <A,B> Vector2F |
row1(PMatrix2x2F<A,B> m) |
static <A,B,C,D> PMatrix2x2F<C,D> |
scale(PMatrix2x2F<A,B> m,
double r)
Scale the matrix
m by r. |
static <A,B,C,D,E,F> |
subtract(PMatrix2x2F<A,B> m0,
PMatrix2x2F<C,D> m1)
Subtract the matrices
m0 and m1. |
static <A,B> PMatrix2x2F<A,B> |
toParameterized(Matrix2x2F m) |
static <A,B> Matrix2x2F |
toUnparameterized(PMatrix2x2F<A,B> m) |
static <A,B> double |
trace(PMatrix2x2F<A,B> m)
Return the trace of the matrix
m. |
static <A,B> PMatrix2x2F<A,B> |
transpose(PMatrix2x2F<A,B> m)
Calculate the transpose of the matrix
m. |
static <A,B> PMatrix2x2F<A,B> |
withColumn(PMatrix2x2F<A,B> m,
int column,
float r0,
float r1)
Set the column
column of m to (r0, r1). |
static <A,B> PMatrix2x2F<A,B> |
withRow(PMatrix2x2F<A,B> m,
int row,
float c0,
float c1)
Set the row
row of m to (c0, c1). |
static <A,B> PMatrix2x2F<A,B> |
zero()
The zero matrix.
|
public static <A,B,C,D,E,F> PMatrix2x2F<E,F> add(PMatrix2x2F<A,B> m0, PMatrix2x2F<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(PMatrix2x2F<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<PMatrix2x2F<B,A>> invert(PMatrix2x2F<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> PMatrix2x2F<A,C> multiply(PMatrix2x2F<B,C> m0, PMatrix2x2F<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> PVector2F<B> multiplyVectorPost(PMatrix2x2F<A,B> m, PVector2F<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 Vector2F multiplyVectorPost(PMatrix2x2F m, Vector2F v)
Multiply the vector v by the matrix m.
This is post multiplication.
m - The matrixv - The vectorm * vpublic static <A,B> PMatrix2x2F<A,B> ofColumns(Vector2F c0, Vector2F c1)
(c0, c1).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 1public static <A,B> PMatrix2x2F<A,B> ofRows(Vector2F r0, Vector2F r1)
(r0, r1).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 1public static <A,B> PMatrix2x2F<A,B> ofScale(double x, double y)
(x, y).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 valuepublic static <A,B> Vector2F row0(PMatrix2x2F<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> Vector2F row1(PMatrix2x2F<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> Vector2F column0(PMatrix2x2F<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> Vector2F column1(PMatrix2x2F<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> PMatrix2x2F<C,D> scale(PMatrix2x2F<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> PMatrix2x2F<E,F> subtract(PMatrix2x2F<A,B> m0, PMatrix2x2F<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(PMatrix2x2F<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> PMatrix2x2F<A,B> transpose(PMatrix2x2F<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> PMatrix2x2F<A,B> withColumn(PMatrix2x2F<A,B> m, int column, float r0, float r1)
column of m to (r0, r1).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, 1]r1 - The value of row 1 in the columnpublic static <A,B> PMatrix2x2F<A,B> withRow(PMatrix2x2F<A,B> m, int row, float c0, float c1)
row of m to (c0, c1).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, 1]c0 - The value of column 0 in the rowc1 - The value of column 1 in the rowpublic static <A,B> PMatrix2x2F<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> PMatrix2x2F<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)public static <A,B> Matrix2x2F toUnparameterized(PMatrix2x2F<A,B> 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 input matrixm but without type parameterspublic static <A,B> PMatrix2x2F<A,B> toParameterized(Matrix2x2F 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 input matrixm with type parametersCopyright © 2017 <code@io7m.com> http://io7m.com