Package com.github.stephengold.joltjni
Class Mat44
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.Mat44
- All Implemented Interfaces:
ConstJoltPhysicsObject,Mat44Arg,AutoCloseable,Comparable<ConstJoltPhysicsObject>
A 4x4 matrix composed of 16 single-precision elements, used to represent
transformations of 3-D coordinates.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatgetElement(int row, int column) Return the specified element.Convert the rotation to aQuat.booleanTest whether the current matrix is equal to the argument.multiply3x3(Mat44Arg arg) Multiply the current 3x3 matrix by the specified 3x3 matrix.multiply3x3(Vec3Arg vec3Arg) Multiply the 3x3 matrix by the specified vector.multiply3x3Transposed(Vec3Arg vec3Arg) Multiply the transpose of the 3x3 matrix by the specified vector.voidsetElement(int row, int column, float value) Alter the specified element.static Mat44Create an identity matrix.static Mat44Create a matrix from the specified quaternion.static Mat44sZero()Create an all-zero matrix.toString()Return a string representation of the matrix, which is unaffected.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, va
-
Constructor Details
-
Mat44
public Mat44()Instantiate an uninitialized matrix. -
Mat44
public Mat44(float... elements) Instantiate a matrix with the specified elements.- Parameters:
elements- in column-major order (not null)
-
-
Method Details
-
setElement
public void setElement(int row, int column, float value) Alter the specified element.- Parameters:
row- the zero-origin index of the row (≥0, <4)column- the zero-origin index of the column (≥0, <4)value- the desired value
-
sIdentity
Create an identity matrix.- Returns:
- a new instance
-
sRotation
Create a matrix from the specified quaternion.- Parameters:
rotation- the rotation quaternion to use (not null, unaffected)- Returns:
- a new instance
-
sZero
Create an all-zero matrix.- Returns:
- a new instance
-
getElement
public float getElement(int row, int column) Return the specified element. The matrix is unaffected.- Specified by:
getElementin interfaceMat44Arg- Parameters:
row- the zero-origin index of the row (≥0, <4)column- the zero-origin index of the column (≥0, <4)- Returns:
- the element's value
-
getQuaternion
Convert the rotation to aQuat. The matrix is unaffected.- Specified by:
getQuaternionin interfaceMat44Arg- Returns:
- a new rotation quaternion
-
isEqual
Test whether the current matrix is equal to the argument. The current matrix is unaffected. -
multiply3x3
Multiply the current 3x3 matrix by the specified 3x3 matrix. The matrix is unaffected.- Specified by:
multiply3x3in interfaceMat44Arg- Parameters:
arg- the factor (not null, unaffected)- Returns:
- a new matrix
-
multiply3x3
Multiply the 3x3 matrix by the specified vector. The matrix is unaffected.- Specified by:
multiply3x3in interfaceMat44Arg- Parameters:
vec3Arg- the right factor (not null, unaffected)- Returns:
- a new vector
-
multiply3x3Transposed
Multiply the transpose of the 3x3 matrix by the specified vector. The matrix is unaffected.- Specified by:
multiply3x3Transposedin interfaceMat44Arg- Parameters:
vec3Arg- the right factor (not null, unaffected)- Returns:
- a new vector
-
toString
Return a string representation of the matrix, which is unaffected. For example, an identity matrix is represented by:Mat44[ 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 ]
- Overrides:
toStringin classJoltPhysicsObject- Returns:
- the string representation (not null, not empty)
-