public class MatrixM4x4F extends Object implements MatrixReadable4x4FType
A 4x4 mutable matrix type with single precision elements.
Values of type MatrixM4x4F are backed by direct memory, with
the rows and columns of the matrices being stored in column-major format.
This allows the matrices to be passed to OpenGL directly, without requiring
transposition.
Values of this type cannot be accessed safely from multiple threads without explicit synchronization.
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 | Class and Description |
|---|---|
static class |
MatrixM4x4F.Context
The Context type contains the minimum storage required for all of the
functions of the
MatrixM4x4F class. |
| Constructor and Description |
|---|
MatrixM4x4F()
Construct a new identity matrix.
|
MatrixM4x4F(MatrixM4x4F source)
Construct a new copy of the given matrix.
|
| Modifier and Type | Method and Description |
|---|---|
static MatrixM4x4F |
add(MatrixReadable4x4FType m0,
MatrixReadable4x4FType m1,
MatrixM4x4F out)
Elementwise add of matrices
m0 and m1. |
static MatrixM4x4F |
addInPlace(MatrixM4x4F m0,
MatrixReadable4x4FType m1)
Elementwise add of matrices
m0 and m1,
returning the result in m0. |
static MatrixM4x4F |
addRowScaled(MatrixReadable4x4FType m,
int row_a,
int row_b,
int row_c,
double r,
MatrixM4x4F out)
Add the values in row
row_b to the values in row
row_a scaled by r, saving the resulting row in
row row_c of the matrix out. |
static MatrixM4x4F |
addRowScaledInPlace(MatrixM4x4F m,
int row_a,
int row_b,
int row_c,
double r)
Add the values in row
row_b to the values in row
row_a scaled by r, saving the resulting row in
row row_c of the matrix m. |
static MatrixM4x4F |
addRowScaledWithContext(MatrixM4x4F.Context context,
MatrixReadable4x4FType m,
int row_a,
int row_b,
int row_c,
double r,
MatrixM4x4F out)
Add the values in row
row_b to the values in row
row_a scaled by r, saving the resulting row in
row row_c of the matrix out. |
static MatrixM4x4F |
copy(MatrixReadable4x4FType input,
MatrixM4x4F output)
Copy the contents of the matrix
input to the matrix
output, completely replacing all elements. |
static double |
determinant(MatrixReadable4x4FType m)
Calculate the determinant of the matrix
m. |
boolean |
equals(Object obj) |
static MatrixM4x4F |
exchangeRows(MatrixReadable4x4FType m,
int row_a,
int row_b,
MatrixM4x4F out)
Exchange the row
row_a and row row_b of the
matrix m, saving the exchanged rows to out. |
static MatrixM4x4F |
exchangeRowsInPlace(MatrixM4x4F m,
int row_a,
int row_b)
Exchange the row
row_a and row row_b of the
matrix m, saving the exchanged rows to m. |
static MatrixM4x4F |
exchangeRowsInPlaceWithContext(MatrixM4x4F.Context context,
MatrixM4x4F m,
int row_a,
int row_b)
Exchange the row
row_a and row row_b of the
matrix m, saving the exchanged rows to m. |
static MatrixM4x4F |
exchangeRowsWithContext(MatrixM4x4F.Context context,
MatrixReadable4x4FType m,
int row_a,
int row_b,
MatrixM4x4F out)
Exchange two rows
row_a and row row_b of the
matrix m, saving the exchanged rows to out . |
static FloatBuffer |
floatBuffer(MatrixM4x4F m) |
float |
get(int row,
int column) |
static float |
get(MatrixReadable4x4FType m,
int row,
int column) |
FloatBuffer |
getFloatBuffer() |
void |
getRow4F(int row,
VectorM4F out)
Retrieve row
row, saving the result to out. |
float |
getRowColumnF(int row,
int column) |
int |
hashCode() |
static com.io7m.jfunctional.OptionType<MatrixM4x4F> |
invert(MatrixReadable4x4FType m,
MatrixM4x4F out)
Calculate the inverse of the matrix
m, saving the resulting
matrix to out. |
static com.io7m.jfunctional.OptionType<MatrixM4x4F> |
invertInPlace(MatrixM4x4F m)
Calculate the inverse of the matrix
m, saving the resulting
matrix to m. |
static com.io7m.jfunctional.OptionType<MatrixM4x4F> |
invertInPlaceWithContext(MatrixM4x4F.Context context,
MatrixM4x4F m)
Calculate the inverse of the matrix
m, saving the resulting
matrix to m. |
static com.io7m.jfunctional.OptionType<MatrixM4x4F> |
invertWithContext(MatrixM4x4F.Context context,
MatrixReadable4x4FType m,
MatrixM4x4F out)
Calculate the inverse of the matrix
m, saving the resulting
matrix to out. |
static void |
lookAtWithContext(MatrixM4x4F.Context context,
VectorReadable3FType origin,
VectorReadable3FType target,
VectorReadable3FType up,
MatrixM4x4F out_matrix)
Calculate a matrix representing a "camera" looking from the point
origin to the point target. |
static MatrixM4x4F |
makeRotation(double angle,
VectorReadable3FType axis)
Generate and return a matrix that represents a rotation of
angle radians around the axis axis. |
static MatrixM4x4F |
makeRotation(double angle,
VectorReadable3FType axis,
MatrixM4x4F out)
Generate a matrix that represents a rotation of
angle
radians around the axis axis and save to out. |
static MatrixM4x4F |
makeTranslation3F(VectorReadable3FType v)
Generate and return a matrix that represents a translation of
(v.x, v.y, v.z) from the origin. |
static MatrixM4x4F |
makeTranslation3F(VectorReadable3FType v,
MatrixM4x4F out)
Generate a matrix that represents a translation of
(v.x, v.y, v.z) from the origin, and save to
out. |
static MatrixM4x4F |
makeTranslation3I(VectorReadable3IType v)
Generate and return a matrix that represents a translation of
(v.x, v.y, v.z) from the origin. |
static MatrixM4x4F |
makeTranslation3I(VectorReadable3IType v,
MatrixM4x4F out)
Generate a matrix that represents a translation of
(v.x, v.y, v.z) from the origin, and save to
out. |
static MatrixM4x4F |
multiply(MatrixReadable4x4FType m0,
MatrixReadable4x4FType m1,
MatrixM4x4F out)
Multiply the matrix
m0 with the matrix m1,
writing the result to out. |
static MatrixM4x4F |
multiplyInPlace(MatrixM4x4F m0,
MatrixReadable4x4FType m1)
Multiply the matrix
m0 with the matrix m1,
writing the result to m0. |
static VectorM4F |
multiplyVector4F(MatrixReadable4x4FType m,
VectorReadable4FType v,
VectorM4F out)
Multiply the matrix
m with the vector v,
writing the resulting vector to out. |
static VectorM4F |
multiplyVector4FWithContext(MatrixM4x4F.Context context,
MatrixReadable4x4FType m,
VectorReadable4FType v,
VectorM4F out)
Multiply the matrix
m with the vector v,
writing the resulting vector to out. |
static MatrixM4x4F |
rotate(double angle,
MatrixReadable4x4FType m,
VectorReadable3FType axis,
MatrixM4x4F out)
Rotate the matrix
m by angle radians around the
axis axis, saving the result into out. |
static MatrixM4x4F |
rotateInPlace(double angle,
MatrixM4x4F m,
VectorReadable3FType axis)
Rotate the matrix
m by angle radians around the
axis axis, saving the result into m. |
static MatrixM4x4F |
rotateInPlaceWithContext(MatrixM4x4F.Context context,
double angle,
MatrixM4x4F m,
VectorReadable3FType axis)
Rotate the matrix
m by angle radians around the
axis axis, saving the result into m. |
static MatrixM4x4F |
rotateWithContext(MatrixM4x4F.Context context,
double angle,
MatrixReadable4x4FType m,
VectorReadable3FType axis,
MatrixM4x4F out)
Rotate the matrix
m by angle radians around the
axis axis, saving the result into out. |
static VectorM4F |
row(MatrixReadable4x4FType m,
int row,
VectorM4F out)
Return row
row of the matrix m in the vector
out. |
static MatrixM4x4F |
scale(MatrixReadable4x4FType m,
double r,
MatrixM4x4F out)
Scale all elements of the matrix
m by the scaling value
r, saving the result in out. |
static MatrixM4x4F |
scaleInPlace(MatrixM4x4F m,
double r)
Scale all elements of the matrix
m by the scaling value
r, saving the result in m. |
static MatrixM4x4F |
scaleRow(MatrixReadable4x4FType m,
int row,
double r,
MatrixM4x4F out)
Scale row
r of the matrix m by r,
saving the result to row r of out. |
static MatrixM4x4F |
scaleRowInPlace(MatrixM4x4F m,
int row,
double r)
Scale row
row of the matrix m by r
, saving the result to row r of m. |
static MatrixM4x4F |
scaleRowInPlaceWithContext(MatrixM4x4F.Context context,
MatrixM4x4F m,
int row,
double r)
Scale row
row of the matrix m by r
, saving the result to row r of m. |
static MatrixM4x4F |
scaleRowWithContext(MatrixM4x4F.Context context,
MatrixReadable4x4FType m,
int row,
double r,
MatrixM4x4F out)
Scale row
row of the matrix m by r
, saving the result to row r of out. |
MatrixM4x4F |
set(int row,
int column,
float value)
Set the value at the given row and column.
|
static MatrixM4x4F |
set(MatrixM4x4F m,
int row,
int column,
float value)
Set the value in the matrix
m at row row,
column column to value. |
static MatrixM4x4F |
setIdentity(MatrixM4x4F m)
Set the given matrix
m to the identity matrix. |
static MatrixM4x4F |
setZero(MatrixM4x4F m)
Set the given matrix
m to the zero matrix. |
String |
toString() |
static double |
trace(MatrixReadable4x4FType m)
Return the trace of the matrix
m. |
static MatrixM4x4F |
translateByVector2F(MatrixReadable4x4FType m,
VectorReadable2FType v,
MatrixM4x4F out)
Translate the matrix
m by the vector v, storing
the resulting matrix in out. |
static MatrixM4x4F |
translateByVector2FInPlace(MatrixM4x4F m,
VectorReadable2FType v)
Translate the matrix
m by the vector v, storing
the resulting matrix in m. |
static MatrixM4x4F |
translateByVector2I(MatrixReadable4x4FType m,
VectorReadable2IType v,
MatrixM4x4F out)
Translate the matrix
m by the vector v, storing
the resulting matrix in out. |
static MatrixM4x4F |
translateByVector2IInPlace(MatrixM4x4F m,
VectorReadable2IType v)
Translate the matrix
m by the vector v, storing
the resulting matrix in m. |
static MatrixM4x4F |
translateByVector3F(MatrixReadable4x4FType m,
VectorReadable3FType v,
MatrixM4x4F out)
Translate the matrix
m by the vector v, storing
the resulting matrix in out. |
static MatrixM4x4F |
translateByVector3FInPlace(MatrixM4x4F m,
VectorReadable3FType v)
Translate the matrix
m by the vector v, storing
the resulting matrix in m. |
static MatrixM4x4F |
translateByVector3I(MatrixReadable4x4FType m,
VectorReadable3IType v,
MatrixM4x4F out)
Translate the matrix
m by the vector v, storing
the resulting matrix in out. |
static MatrixM4x4F |
translateByVector3IInPlace(MatrixM4x4F m,
VectorReadable3IType v)
Translate the matrix
m by the vector v, storing
the resulting matrix in m. |
static MatrixM4x4F |
transpose(MatrixReadable4x4FType m,
MatrixM4x4F out)
Transpose the given matrix
m, writing the resulting matrix
to out. |
static MatrixM4x4F |
transposeInPlace(MatrixM4x4F m)
Transpose the given matrix
m, writing the resulting matrix
to m. |
public MatrixM4x4F()
public MatrixM4x4F(MatrixM4x4F source)
source - The source matrix.public static final MatrixM4x4F add(MatrixReadable4x4FType m0, MatrixReadable4x4FType m1, MatrixM4x4F out)
m0 and m1.m0 - The left input matrix.m1 - The right input matrix.out - The output matrix.outpublic static final MatrixM4x4F addInPlace(MatrixM4x4F m0, MatrixReadable4x4FType m1)
m0 and m1,
returning the result in m0.m0 - The left input matrix.m1 - The right input matrix.public static final MatrixM4x4F addRowScaled(MatrixReadable4x4FType m, int row_a, int row_b, int row_c, double r, MatrixM4x4F out)
Add the values in row row_b to the values in row
row_a scaled by r, saving the resulting row in
row row_c of the matrix out.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
m - The input matrix.row_a - The row on the lefthand side of the addition.row_b - The row on the righthand side of the addition.row_c - The destination row.r - The scaling value.out - The output matrix.outpublic static final MatrixM4x4F addRowScaledInPlace(MatrixM4x4F m, int row_a, int row_b, int row_c, double r)
Add the values in row row_b to the values in row
row_a scaled by r, saving the resulting row in
row row_c of the matrix m.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
m - The input matrix.row_a - The row on the lefthand side of the addition.row_b - The row on the righthand side of the addition.row_c - The destination row.r - The scaling value.mpublic static final MatrixM4x4F addRowScaledWithContext(MatrixM4x4F.Context context, MatrixReadable4x4FType m, int row_a, int row_b, int row_c, double r, MatrixM4x4F out)
Add the values in row row_b to the values in row
row_a scaled by r, saving the resulting row in
row row_c of the matrix out. The function uses
storage preallocated in context to avoid any new
allocations.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
context - Preallocated storage.m - The input matrix.row_a - The row on the lefthand side of the addition.row_b - The row on the righthand side of the addition.row_c - The destination row.r - The scaling value.out - The output matrix.outpublic static final MatrixM4x4F copy(MatrixReadable4x4FType input, MatrixM4x4F output)
input to the matrix
output, completely replacing all elements.input - The input vector.output - The output vector.outputpublic static final double determinant(MatrixReadable4x4FType m)
m.m - The input matrix.public static final MatrixM4x4F exchangeRows(MatrixReadable4x4FType m, int row_a, int row_b, MatrixM4x4F out)
Exchange the row row_a and row row_b of the
matrix m, saving the exchanged rows to out.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
m - The input matrix.row_a - The first row.row_b - The second row.out - The output matrix.outpublic static final MatrixM4x4F exchangeRowsInPlace(MatrixM4x4F m, int row_a, int row_b)
Exchange the row row_a and row row_b of the
matrix m, saving the exchanged rows to m.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
m - The input matrix.row_a - The first row.row_b - The second row.mpublic static final MatrixM4x4F exchangeRowsInPlaceWithContext(MatrixM4x4F.Context context, MatrixM4x4F m, int row_a, int row_b)
Exchange the row row_a and row row_b of the
matrix m, saving the exchanged rows to m. The
function uses storage preallocated in context to avoid
allocating memory.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
context - Preallocated storage.m - The input matrix.row_a - The first row.row_b - The second row.mpublic static final MatrixM4x4F exchangeRowsWithContext(MatrixM4x4F.Context context, MatrixReadable4x4FType m, int row_a, int row_b, MatrixM4x4F out)
Exchange two rows row_a and row row_b of the
matrix m, saving the exchanged rows to out .
The function uses storage preallocated in context to avoid
allocating memory.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
context - Preallocated storage.m - The input matrix.row_a - The first row.row_b - The second row.out - The output matrix.outpublic static final FloatBuffer floatBuffer(MatrixM4x4F m)
m - The input matrix.public static final float get(MatrixReadable4x4FType m, int row, int column)
m - The input matrixrow - The rowcolumn - The columnm at row row,
column column.public static final com.io7m.jfunctional.OptionType<MatrixM4x4F> invert(MatrixReadable4x4FType m, MatrixM4x4F out)
m, saving the resulting
matrix to out. The function returns Some(out)
iff it was possible to invert the matrix, and None
otherwise. It is not possible to invert a matrix that has a determinant
of 0. If the function returns None,
m is untouched.m - The input matrix.out - The output matrix.out.determinant(MatrixReadable4x4FType)public static final com.io7m.jfunctional.OptionType<MatrixM4x4F> invertInPlace(MatrixM4x4F m)
m, saving the resulting
matrix to m. The function returns Some(m) iff
it was possible to invert the matrix, and None otherwise. It
is not possible to invert a matrix that has a determinant of
0. If the function returns None, m
is untouched.m - The input matrix.m.determinant(MatrixReadable4x4FType)public static final com.io7m.jfunctional.OptionType<MatrixM4x4F> invertInPlaceWithContext(MatrixM4x4F.Context context, MatrixM4x4F m)
m, saving the resulting
matrix to m. The function returns Some(out) iff
it was possible to invert the matrix, and None otherwise. It
is not possible to invert a matrix that has a determinant of
0. The function uses preallocated storage in
context to avoid allocating memory. If the function returns
None, m is untouched.context - Preallocated storage.m - The input matrix.mdeterminant(MatrixReadable4x4FType)public static final com.io7m.jfunctional.OptionType<MatrixM4x4F> invertWithContext(MatrixM4x4F.Context context, MatrixReadable4x4FType m, MatrixM4x4F out)
m, saving the resulting
matrix to out. The function returns Some(out)
iff it was possible to invert the matrix, and None
otherwise. It is not possible to invert a matrix that has a determinant
of 0. The function uses preallocated storage in
context to avoid allocating memory. If the function returns
None, m is untouched.context - Preallocated storage.m - The input matrix.out - The output matrix.outdeterminant(MatrixReadable4x4FType)public static final void lookAtWithContext(MatrixM4x4F.Context context, VectorReadable3FType origin, VectorReadable3FType target, VectorReadable3FType up, MatrixM4x4F out_matrix)
Calculate a matrix representing a "camera" looking from the point
origin to the point target. target
must represent the "up" vector for the camera. Usually, this is simply a
unit vector (0, 1, 0) representing the Y axis.
The function uses preallocated storage from context.
The view is expressed as a rotation and translation matrix, written to
out_matrix.
context - Preallocated storageout_matrix - The output matrixorigin - The position of the viewertarget - The target being viewedup - The up vectorpublic static final MatrixM4x4F makeRotation(double angle, VectorReadable3FType axis)
Generate and return a matrix that represents a rotation of
angle radians around the axis axis.
The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.
angle - The angle in radians.axis - The axis.public static final MatrixM4x4F makeRotation(double angle, VectorReadable3FType axis, MatrixM4x4F out)
Generate a matrix that represents a rotation of angle
radians around the axis axis and save to out.
The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.
angle - The angle in radians.axis - The axis.out - The output matrix.outpublic static final MatrixM4x4F makeTranslation3F(VectorReadable3FType v)
(v.x, v.y, v.z) from the origin.v - The translation vector.outpublic static final MatrixM4x4F makeTranslation3F(VectorReadable3FType v, MatrixM4x4F out)
(v.x, v.y, v.z) from the origin, and save to
out.v - The translation vector.out - The output matrix.outpublic static final MatrixM4x4F makeTranslation3I(VectorReadable3IType v)
(v.x, v.y, v.z) from the origin.v - The translation vector.outpublic static final MatrixM4x4F makeTranslation3I(VectorReadable3IType v, MatrixM4x4F out)
(v.x, v.y, v.z) from the origin, and save to
out.v - The translation vector.out - The output matrix.outpublic static final MatrixM4x4F multiply(MatrixReadable4x4FType m0, MatrixReadable4x4FType m1, MatrixM4x4F out)
m0 with the matrix m1,
writing the result to out.m0 - The left input vector.m1 - The right input vector.out - The output vector.outpublic static final MatrixM4x4F multiplyInPlace(MatrixM4x4F m0, MatrixReadable4x4FType m1)
m0 with the matrix m1,
writing the result to m0.m0 - The left input vector.m1 - The right input vector.outpublic static final VectorM4F multiplyVector4F(MatrixReadable4x4FType m, VectorReadable4FType v, VectorM4F out)
m with the vector v,
writing the resulting vector to out.m - The input matrix.v - The input vector.out - The output vector.outpublic static final VectorM4F multiplyVector4FWithContext(MatrixM4x4F.Context context, MatrixReadable4x4FType m, VectorReadable4FType v, VectorM4F out)
m with the vector v,
writing the resulting vector to out. The function uses
preallocated storage in context to avoid allocating memory.context - Preallocated storage.m - The input matrix.v - The input vector.out - The output vector.outpublic static final MatrixM4x4F rotate(double angle, MatrixReadable4x4FType m, VectorReadable3FType axis, MatrixM4x4F out)
Rotate the matrix m by angle radians around the
axis axis, saving the result into out.
The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.
angle - The angle in radians.m - The input matrix.axis - A vector representing an axis.out - The output matrix.outpublic static final MatrixM4x4F rotateInPlace(double angle, MatrixM4x4F m, VectorReadable3FType axis)
Rotate the matrix m by angle radians around the
axis axis, saving the result into m.
The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.
angle - The angle in radians.m - The input matrix.axis - A vector representing an axis.mpublic static final MatrixM4x4F rotateInPlaceWithContext(MatrixM4x4F.Context context, double angle, MatrixM4x4F m, VectorReadable3FType axis)
Rotate the matrix m by angle radians around the
axis axis, saving the result into m. The
function uses preallocated storage in context to avoid
allocating memory.
The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.
context - Preallocated storage.angle - The angle in radians.m - The input matrix.axis - A vector representing an axis.mpublic static final MatrixM4x4F rotateWithContext(MatrixM4x4F.Context context, double angle, MatrixReadable4x4FType m, VectorReadable3FType axis, MatrixM4x4F out)
Rotate the matrix m by angle radians around the
axis axis, saving the result into out. The
function uses preallocated storage in context to avoid
allocating memory.
The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.
context - Preallocated storage.angle - The angle in radians.m - The input matrix.axis - A vector representing an axis.out - The output matrix.outpublic static final VectorM4F row(MatrixReadable4x4FType m, int row, VectorM4F out)
row of the matrix m in the vector
out.row - The rowm - The matrixout - The output vectorpublic static final MatrixM4x4F scale(MatrixReadable4x4FType m, double r, MatrixM4x4F out)
m by the scaling value
r, saving the result in out.out - The output matrix.m - The input matrix.r - The scaling value.outpublic static final MatrixM4x4F scaleInPlace(MatrixM4x4F m, double r)
m by the scaling value
r, saving the result in m.m - The input matrix.r - The scaling value.mpublic static final MatrixM4x4F scaleRow(MatrixReadable4x4FType m, int row, double r, MatrixM4x4F out)
Scale row r of the matrix m by r,
saving the result to row r of out.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
m - The input matrix.row - The index of the row (0 <= row < 4).r - The scaling value.out - The output matrix.outpublic static final MatrixM4x4F scaleRowInPlace(MatrixM4x4F m, int row, double r)
Scale row row of the matrix m by r
, saving the result to row r of m.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
m - The input matrix.row - The index of the row (0 <= row < 4).r - The scaling value.outpublic static final MatrixM4x4F scaleRowInPlaceWithContext(MatrixM4x4F.Context context, MatrixM4x4F m, int row, double r)
Scale row row of the matrix m by r
, saving the result to row r of m. The function
uses preallocated storage in context to avoid allocating
memory.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
context - Preallocated storage.m - The input matrix.row - The index of the row (0 <= row < 4).r - The scaling value.mpublic static final MatrixM4x4F scaleRowWithContext(MatrixM4x4F.Context context, MatrixReadable4x4FType m, int row, double r, MatrixM4x4F out)
Scale row row of the matrix m by r
, saving the result to row r of out. The
function uses preallocated storage in context to avoid
allocating memory.
This is one of the three "elementary" operations defined on matrices. See Elementary operations .
context - Preallocated storage.m - The input matrix.row - The index of the row (0 <= row < 4).r - The scaling value.out - The output matrix.outpublic static final MatrixM4x4F set(MatrixM4x4F m, int row, int column, float value)
m at row row,
column column to value.m - The input matrixrow - The rowcolumn - The columnvalue - The valuempublic static final MatrixM4x4F setIdentity(MatrixM4x4F m)
m to the identity matrix.m - The input matrixmpublic static final MatrixM4x4F setZero(MatrixM4x4F m)
m to the zero matrix.m - The matrixmpublic static final double trace(MatrixReadable4x4FType m)
m. The trace is defined as
the sum of the diagonal elements of the matrix.m - The input matrixpublic static final MatrixM4x4F translateByVector2F(MatrixReadable4x4FType m, VectorReadable2FType v, MatrixM4x4F out)
m by the vector v, storing
the resulting matrix in out.m - The input matrix.v - The translation vector.out - The output matrix.outpublic static final MatrixM4x4F translateByVector2FInPlace(MatrixM4x4F m, VectorReadable2FType v)
m by the vector v, storing
the resulting matrix in m.m - The input matrix.v - The translation vector.mpublic static final MatrixM4x4F translateByVector2I(MatrixReadable4x4FType m, VectorReadable2IType v, MatrixM4x4F out)
m by the vector v, storing
the resulting matrix in out.m - The input matrix.v - The translation vector.out - The output matrix.outpublic static final MatrixM4x4F translateByVector2IInPlace(MatrixM4x4F m, VectorReadable2IType v)
m by the vector v, storing
the resulting matrix in m.m - The input matrix.v - The translation vector.mpublic static final MatrixM4x4F translateByVector3F(MatrixReadable4x4FType m, VectorReadable3FType v, MatrixM4x4F out)
m by the vector v, storing
the resulting matrix in out.m - The input matrix.v - The translation vector.out - The output matrix.outpublic static final MatrixM4x4F translateByVector3FInPlace(MatrixM4x4F m, VectorReadable3FType v)
m by the vector v, storing
the resulting matrix in m.m - The input matrix.v - The translation vector.mpublic static final MatrixM4x4F translateByVector3I(MatrixReadable4x4FType m, VectorReadable3IType v, MatrixM4x4F out)
m by the vector v, storing
the resulting matrix in out.m - The input matrix.v - The translation vector.out - The output matrix.outpublic static final MatrixM4x4F translateByVector3IInPlace(MatrixM4x4F m, VectorReadable3IType v)
m by the vector v, storing
the resulting matrix in m.m - The input matrix.v - The translation vector.mpublic static final MatrixM4x4F transpose(MatrixReadable4x4FType m, MatrixM4x4F out)
m, writing the resulting matrix
to out.m - The input matrix.out - The output matrix.outpublic static final MatrixM4x4F transposeInPlace(MatrixM4x4F m)
m, writing the resulting matrix
to m.m - The input matrix.mpublic final float get(int row,
int column)
row - The rowcolumn - The columnpublic final FloatBuffer getFloatBuffer()
getFloatBuffer in interface MatrixReadableFTypepublic final void getRow4F(int row,
VectorM4F out)
MatrixReadable4x4FTyperow, saving the result to out.getRow4F in interface MatrixReadable4x4FTyperow - The index of the row, starting at 0.out - The output vector.public final float getRowColumnF(int row,
int column)
getRowColumnF in interface MatrixReadableFTyperow - The rowcolumn - The columnrow , column
column.public final MatrixM4x4F set(int row, int column, float value)
row - The rowcolumn - The columnvalue - The valuethisCopyright © 2014 <code@io7m.com> http://io7m.com