public final class Matrix4f
extends java.lang.Object
implements java.lang.Cloneable
The rightmost column (column 3) stores the translation vector. Element numbering is (row,column), so m03 is the row 0, column 3, which is the X translation.
Methods with names ending in "Local" modify the current instance. They are used to avoid creating garbage.
| Modifier and Type | Field and Description |
|---|---|
float |
m00
The element in row 0, column 0.
|
float |
m01
The element in row 0, column 1.
|
float |
m02
The element in row 0, column 2.
|
float |
m03
The element in row 0, column 3 (the X translation).
|
float |
m10
The element in row 1, column 0.
|
float |
m11
The element in row 1, column 1.
|
float |
m12
The element in row 1, column 2.
|
float |
m13
The element in row 1, column 3 (the Y translation).
|
float |
m20
The element in row 2, column 0.
|
float |
m21
The element in row 2, column 1.
|
float |
m22
The element in row 2, column 2.
|
float |
m23
The element in row 2, column 3 (the Z translation).
|
float |
m30
The element in row 3, column 0.
|
float |
m31
The element in row 3, column 1.
|
float |
m32
The element in row 3, column 2.
|
float |
m33
The element in row 3, column 3.
|
| Constructor and Description |
|---|
Matrix4f()
Instantiates an identity matrix (diagonals = 1, other elements = 0).
|
| Modifier and Type | Method and Description |
|---|---|
Matrix4f |
clone()
Creates a copy.
|
boolean |
equals(java.lang.Object o)
Tests for exact equality with the argument, distinguishing -0 from 0.
|
int |
hashCode()
Returns a hash code.
|
Matrix4f |
invertLocal()
Inverts in place.
|
void |
loadIdentity()
Configures as an identity matrix (diagonals = 1, other elements = 0).
|
void |
multLocal(float scalar)
Multiplies in place by the scalar argument.
|
void |
setScale(float x,
float y,
float z)
Alters the scale component of the coordinate transform.
|
void |
setScale(Vector3f scale)
Alters the scale component of the coordinate transform.
|
void |
setTranslation(Vector3f translation)
Alters the translation component of the coordinate transform.
|
void |
toRotationMatrix(Matrix3f mat)
Determines the rotation component of the coordinate transform.
|
Quaternion |
toRotationQuat(Quaternion q)
Returns the rotation component of the coordinate transform.
|
Vector3f |
toScaleVector(Vector3f store)
Determines the scale component of the coordinate transform.
|
java.lang.String |
toString()
Returns a string representation of the matrix, which is unaffected.
|
Vector3f |
toTranslationVector(Vector3f vector)
Returns the translation component of the coordinate transform.
|
Matrix4f |
zero()
Sets all elements to zero.
|
public float m00
public float m01
public float m02
public float m03
public float m10
public float m11
public float m12
public float m13
public float m20
public float m21
public float m22
public float m23
public float m30
public float m31
public float m32
public float m33
public Matrix4f()
public void loadIdentity()
public void multLocal(float scalar)
scalar - the scaling factor to apply to all elementspublic Matrix4f invertLocal()
public Matrix4f zero()
public Vector3f toTranslationVector(Vector3f vector)
vector - storage for the result (not null, modified)vector) for chainingpublic Quaternion toRotationQuat(Quaternion q)
Assumes (but does not verify) that the transform consists entirely of translation, rotation, and positive scaling -- no reflection or shear.
q - storage for the result (not null, modified)q) for chainingpublic void toRotationMatrix(Matrix3f mat)
If the transform includes scaling or reflection or shear, the result might not be a valid rotation matrix.
mat - storage for the result (not null, modified)public Vector3f toScaleVector(Vector3f store)
All components of the result will be non-negative, even if the coordinate transform includes reflection.
store - storage for the result (not null, modified)store) for chainingpublic void setScale(float x,
float y,
float z)
x - the desired scale factor for the X axisy - the desired scale factor for the Y axisz - the desired scale factor for the Z axispublic void setScale(Vector3f scale)
scale - the desired scale factors (not null, unaffected)public void setTranslation(Vector3f translation)
translation - the desired translation (not null, unaffected)public java.lang.String toString()
Matrix4f [ 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 ]
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public boolean equals(java.lang.Object o)
o is null, false is returned. Either way, the current instance is
unaffected.equals in class java.lang.Objecto - the object to compare (may be null, unaffected)this and o have identical values,
otherwise falsepublic Matrix4f clone()
clone in class java.lang.Object