Field Summary |
|
static final int |
a1 Element index of first row, first column |
static final int |
a2 Element index of first row, second column |
static final int |
a3 Element index of first row, third column |
static final int |
a4 Element index of first row, fourth column |
static final int |
b1 Element index of second row, first column |
static final int |
b2 Element index of second row, second column |
static final int |
b3 Element index of second row, third column |
static final int |
b4 Element index of second row, fourth column |
static final int |
c1 Element index of third row, first column |
static final int |
c2 Element index of third row, second column |
static final int |
c3 Element index of third row, third column |
static final int |
c4 Element index of third row, fourth column |
static final int |
d1 Element index of fourth row, first column |
static final int |
d2 Element index of fourth row, second column |
static final int |
d3 Element index of fourth row, third column |
static final int |
d4 Element index of fourth row, fourth column |
Constructor Summary |
Matrix4x4f() Constructs a zero filled matrix |
Matrix4x4f(Matrix4x4f m) Constructs a copy of m |
Method Summary |
|
Matrix4x4f |
dup() Creates a copy |
float |
elemAt(int col, int row) Returns the matrix element at column and row |
float[] |
elems() Returns the internal vector of matrix elements |
bool | equals(Object obj) |
Vector3f |
getTrans() Returns the translation components into a new Vector3f |
void |
getTrans(Vector3f v) Stores the translation components into v |
void |
initIdentity() Initialzes using the identity matrix |
void |
initMatrix(Matrix4x4f m) Initializes using a copy of m |
void |
initScal(float x, float y, float z) Initialzes as a 3d scaling matrix |
void |
initScal(Vector3f v) Initialzes as a 3d scaling matrix |
void |
initTrans(float x, float y, float z) Initializes as a 3d translation matrix |
void |
initTrans(Vector3f v) Initializes as a 3d translation matrix |
void |
initXRot(float rad) Initialzes as a 3d rotation matrix around the x axis |
void |
initYRot(float rad) Initialzes as a 3d rotation matrix around the y axis |
void |
initZRot(float rad) Initialzes as a 3d rotation matrix around the z axis |
void |
initZero() Initializes using zeros |
bool |
invert() Inverts the matrix if it is non singular. |
void |
multLeft(Matrix4x4f m) Does a left multiply with Matrix m and will save the result to itself. |
void |
multRight(Matrix4x4f m) Does a right multiply with Matrix m and will save the result to itself. |
void |
multVector(Vector4f in, Vector4f out) Will transform the in vector by the matrix and write the result to the out vector. |
void |
multVector3Hg(Vector3f in, Vector3f out) Will transform the in vector by the first 3 rows of the matrix, assuming a virtual fourth component of the vector to be 1. |
void |
multVector3x3(Vector3f in, Vector3f out) Will transform the in vector by the first 3 rows of the matrix, assuming a virtual fourth component of the Vector to be 0. |
void |
setElemAt(int col, int row, float f) Sets the matrix element at column and row |
String | toString() |
Field Detail |
Constructor Detail |
public Matrix4x4f()
Constructs a zero filled matrix
public Matrix4x4f(Matrix4x4f m)
Constructs a copy of m
Method Detail |
public final Matrix4x4f dup()
Creates a copy
public final float elemAt(int col, int row)
Returns the matrix element at column and row
public final float[] elems()
Returns the internal vector of matrix elements
The internal reference is returned, so changing the elements of the vector will change the matrix and vice versa. The constants a1,a2,a3 etc can be used to index specific elements of the matrix.
Returns:
reference to internal vector of matrix elements (16)
public bool equals(Object obj)
public final Vector3f getTrans()
Returns the translation components into a new Vector3f
public final void getTrans(Vector3f v)
Stores the translation components into v
public final void initIdentity()
Initialzes using the identity matrix
public final void initMatrix(Matrix4x4f m)
Initializes using a copy of m
public final void initScal(float x, float y, float z)
Initialzes as a 3d scaling matrix
public final void initScal(Vector3f v)
Initialzes as a 3d scaling matrix
public final void initTrans(float x, float y, float z)
Initializes as a 3d translation matrix
public final void initTrans(Vector3f v)
Initializes as a 3d translation matrix
public final void initXRot(float rad)
Initialzes as a 3d rotation matrix around the x axis
Parameters:
rad | - | angle in radians |
public final void initYRot(float rad)
Initialzes as a 3d rotation matrix around the y axis
Parameters:
rad | - | angle in radians |
public final void initZRot(float rad)
Initialzes as a 3d rotation matrix around the z axis
Parameters:
rad | - | angle in radians |
public final void initZero()
Initializes using zeros
public final bool invert()
Inverts the matrix if it is non singular.
Returns false if the matrix is singular and cannot be inverted, otherwise true
public final void multLeft(Matrix4x4f m)
Does a left multiply with Matrix m and will save the result to itself.
Pseudo Formula: this = m * this
public final void multRight(Matrix4x4f m)
Does a right multiply with Matrix m and will save the result to itself.
Pseudo Formula: this = this * m
public final void multVector(Vector4f in, Vector4f out)
Will transform the in vector by the matrix and write the result to the out vector.
Pseudo Formula: out = in.x * {m.a1, m.b1, m.c1, m.d1} + in.y * {m.a2, m.b2, m.c2, m.d2} + in.z * {m.a3, m.b3, m.c3, m.d3} + in.w * {m.a4, m.b4, m.c4, m.d4} out can be the same object as in
public final void multVector3Hg(Vector3f in, Vector3f out)
Will transform the in vector by the first 3 rows of the matrix, assuming a virtual fourth component of the vector to be 1.
Pseudo Formula: out = in.x * {m.a1, m.b1, m.c1} + in.y * {m.a2, m.b2, m.c2} + in.z * {m.a3, m.b3, m.c3} + {m.a4, m.b4, m.c4} out can be the same object as in
public final void multVector3x3(Vector3f in, Vector3f out)
Will transform the in vector by the first 3 rows of the matrix, assuming a virtual fourth component of the Vector to be 0.
Pseudo Formula: out = in.x * {m.a1, m.b1, m.c1} + in.y * {m.a2, m.b2, m.c2} + in.z * {m.a3, m.b3, m.c3} out can be the same object as in
public final void setElemAt(int col, int row, float f)
Sets the matrix element at column and row
public String toString()