java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.RMat44
- All Implemented Interfaces:
ConstJoltPhysicsObject,RMat44Arg,AutoCloseable,Comparable<JoltPhysicsObject>
A 4x4 matrix used to represent transformations of 3-D coordinates.
-
Constructor Summary
ConstructorsConstructorDescriptionRMat44()Instantiate an uninitialized matrix.Instantiate from the specified single-precision matrix.Instantiate a copy of the specified matrix.Instantiate a matrix with the specified columns. -
Method Summary
Modifier and TypeMethodDescriptiongetAxisX()Copy the first column to aVec3.getAxisY()Copy the 2nd column to aVec3.getAxisZ()Copy the 3rd column to aVec3.Copy the diagonal elements to aVec3.doublegetElement(int row, int column) Return the specified element in double precision.Convert the rotation to aQuat.Copy the translation component.inversed()Return the inverse of the current matrix, which is unaffected.Return the inverse of the current matrix, assuming the current matrix consists entirely of rotation and translation.booleanTest whether the current matrix is equal to the argument.booleanTest whether the current matrix is an identity matrix.voidleftMultiplyInPlace(RMat44Arg leftFactor) Left-multiply the current matrix by the argument.voidSet the current matrix to identity.Multiply the current matrix by the specified single-precision matrix.Multiply the current matrix by the argument.multiply3x3(Vec3Arg vec3Arg) Multiply the 3x3 matrix by the specified column vector.multiply3x3Transposed(Vec3Arg rightVector) Multiply the transpose of the 3x3 matrix by the specified column vector.multiply3x4(RVec3Arg rightVector) Multiply the 3x4 matrix by the specified column vector, with the 4th component of the right factor implied to be one.multiply3x4(Vec3Arg vec3) Multiply the 3x4 matrix by the specified column vector, with the 4th component of the right factor implied to be one.voidmultiply3x4InPlace(RVec3 doubleBuffer) Multiply the 3x4 matrix by the specified column vector, with the 4th component of the right factor implied to be one.postTranslated(RVec3Arg leftVector) Post multiply by the specified translation vector.postTranslated(Vec3Arg vec3) Post multiply by the specified translation vector.static RMat44Return the product of the specified matrices.voidput3x3ColumnMajor(FloatBuffer storeFloats) Write the 3x3 matrix in single precision to the specified buffer in column-major order and advance the buffer's position by 9.voidputColumnMajor(FloatBuffer storeFloats) Write all 16 components in single precision to the specified buffer in column-major order and advance the buffer's position by 16.voidrightMultiplyInPlace(RMat44Arg rightFactor) Right-multiply the current matrix by the argument.voidCopy all elements of the argument to the current matrix.voidSet the first column to the specified vector.voidSet the 2nd column to the specified vector.voidSet the 3rd column to the specified vector.voidsetElement(int row, int column, double value) Alter the specified element in double precision.voidsetTranslation(RVec3Arg offset) Alter the translation component.static RMat44Create an identity matrix.static RMat44Create a rotation matrix from the specified quaternion.static RMat44sRotationTranslation(QuatArg rotation, RVec3Arg offset) Create a translation-and-rotation matrix.static RMat44sScale(float factor) Create a uniform scaling matrix.static RMat44Create a pure scaling matrix.static RMat44sTranslation(RVec3Arg offset) Create a pure translation matrix.static RMat44sZero()Create an all-zero matrix.toMat44()Copy the current matrix to a new, single-precision matrix.toString()Return a string representation of the matrix, which is unaffected.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, 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, targetVa
-
Constructor Details
-
RMat44
public RMat44()Instantiate an uninitialized matrix. -
RMat44
Instantiate from the specified single-precision matrix.- Parameters:
spMatrix- the matrix to copy (notnull, unaffected)
-
RMat44
Instantiate a copy of the specified matrix.- Parameters:
original- the matrix to duplicate (notnull, unaffected)
-
RMat44
Instantiate a matrix with the specified columns.- Parameters:
c1- the desired first/leftmost column (notnull, unaffected)c2- the desired 2nd column (notnull, unaffected)c3- the desired 3rd column (notnull, unaffected)c4- the desired 4th/rightmost column (notnull, unaffected)
-
-
Method Details
-
leftMultiplyInPlace
Left-multiply the current matrix by the argument.- Parameters:
leftFactor- the left factor (notnull, unaffected)
-
loadIdentity
public void loadIdentity()Set the current matrix to identity. -
product
Return the product of the specified matrices.- Parameters:
mArray- an array of input matrices (notnull, unaffected)- Returns:
- a new matrix
-
rightMultiplyInPlace
Right-multiply the current matrix by the argument.- Parameters:
rightFactor- the right factor (notnull, unaffected)
-
set
Copy all elements of the argument to the current matrix.- Parameters:
source- the matrix to copy (notnull, unaffected)
-
setAxisX
Set the first column to the specified vector.- Parameters:
vec- the vector to use (notnull, unaffected)
-
setAxisY
Set the 2nd column to the specified vector.- Parameters:
vec- the vector to use (notnull, unaffected)
-
setAxisZ
Set the 3rd column to the specified vector.- Parameters:
vec- the vector to use (notnull, unaffected)
-
setElement
public void setElement(int row, int column, double value) Alter the specified element in double precision.- 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
-
setTranslation
Alter the translation component.- Parameters:
offset- the desired translation (notnull, unaffected)
-
sIdentity
Create an identity matrix.- Returns:
- a new matrix
-
sRotation
Create a rotation matrix from the specified quaternion.- Parameters:
rotation- the rotation quaternion to use (notnull, unaffected)- Returns:
- a new object
-
sRotationTranslation
Create a translation-and-rotation matrix.- Parameters:
rotation- the amount to rotate (notnull, unaffected)offset- the amount to translate (notnull, unaffected)- Returns:
- a new object
-
sScale
Create a uniform scaling matrix.- Parameters:
factor- the amount to scale each axis- Returns:
- a new matrix
-
sScale
Create a pure scaling matrix.- Parameters:
factors- the amount to scale each axis (notnull, unaffected)- Returns:
- a new matrix
-
sTranslation
Create a pure translation matrix.- Parameters:
offset- the amount to translate (notnull, unaffected)- Returns:
- a new matrix
-
sZero
Create an all-zero matrix.- Returns:
- a new matrix
-
getAxisX
Copy the first column to aVec3. The matrix is unaffected. -
getAxisY
Copy the 2nd column to aVec3. The matrix is unaffected. -
getAxisZ
Copy the 3rd column to aVec3. The matrix is unaffected. -
getDiagonal3
Copy the diagonal elements to aVec3. The matrix is unaffected.- Specified by:
getDiagonal3in interfaceRMat44Arg- Returns:
- a new vector
-
getElement
public double getElement(int row, int column) Return the specified element in double precision. The matrix is unaffected.- Specified by:
getElementin interfaceRMat44Arg- 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 interfaceRMat44Arg- Returns:
- a new rotation quaternion
-
getTranslation
Copy the translation component. The matrix is unaffected.- Specified by:
getTranslationin interfaceRMat44Arg- Returns:
- a new vector
-
inversed
Return the inverse of the current matrix, which is unaffected. -
inversedRotationTranslation
Return the inverse of the current matrix, assuming the current matrix consists entirely of rotation and translation. The current matrix is unaffected.- Specified by:
inversedRotationTranslationin interfaceRMat44Arg- Returns:
- a new matrix
-
isEqual
Test whether the current matrix is equal to the argument. The current matrix is unaffected. -
isIdentity
public boolean isIdentity()Test whether the current matrix is an identity matrix. The matrix is unaffected.- Specified by:
isIdentityin interfaceRMat44Arg- Returns:
trueif exactly equal, otherwisefalse
-
multiply
Multiply the current matrix by the specified single-precision matrix. The current matrix is unaffected. -
multiply
Multiply the current matrix by the argument. The current matrix is unaffected. -
multiply3x3
Multiply the 3x3 matrix by the specified column vector. The matrix is unaffected.- Specified by:
multiply3x3in interfaceRMat44Arg- Parameters:
vec3Arg- the right factor (notnull, unaffected)- Returns:
- a new vector
-
multiply3x3Transposed
Multiply the transpose of the 3x3 matrix by the specified column vector. The matrix is unaffected.- Specified by:
multiply3x3Transposedin interfaceRMat44Arg- Parameters:
rightVector- the right factor (notnull, unaffected)- Returns:
- a new vector
-
multiply3x4
Multiply the 3x4 matrix by the specified column vector, with the 4th component of the right factor implied to be one. The matrix is unaffected.- Specified by:
multiply3x4in interfaceRMat44Arg- Parameters:
rightVector- the right factor (notnull, unaffected)- Returns:
- a new vector
-
multiply3x4
Multiply the 3x4 matrix by the specified column vector, with the 4th component of the right factor implied to be one. The matrix is unaffected.- Specified by:
multiply3x4in interfaceRMat44Arg- Parameters:
vec3- the right factor (notnull, unaffected)- Returns:
- a new vector
-
multiply3x4InPlace
Multiply the 3x4 matrix by the specified column vector, with the 4th component of the right factor implied to be one. Store the result in the argument vector. The matrix is unaffected.- Specified by:
multiply3x4InPlacein interfaceRMat44Arg- Parameters:
doubleBuffer- the right factor and storage for the result (not null)
-
postTranslated
Post multiply by the specified translation vector. The current matrix is unaffected.- Specified by:
postTranslatedin interfaceRMat44Arg- Parameters:
leftVector- the left factor (notnull, unaffected)- Returns:
- a new matrix
-
postTranslated
Post multiply by the specified translation vector. The current matrix is unaffected.- Specified by:
postTranslatedin interfaceRMat44Arg- Parameters:
vec3- the left factor (notnull, unaffected)- Returns:
- a new matrix
-
put3x3ColumnMajor
Write the 3x3 matrix in single precision to the specified buffer in column-major order and advance the buffer's position by 9. The matrix is unaffected.- Specified by:
put3x3ColumnMajorin interfaceRMat44Arg- Parameters:
storeFloats- the destination buffer (notnull)
-
putColumnMajor
Write all 16 components in single precision to the specified buffer in column-major order and advance the buffer's position by 16. The matrix is unaffected.- Specified by:
putColumnMajorin interfaceRMat44Arg- Parameters:
storeFloats- the destination buffer (notnull)
-
toMat44
Copy the current matrix to a new, single-precision matrix. The current matrix is unaffected. -
toString
Return a string representation of the matrix, which is unaffected. For example, an identity matrix is represented by:RMat44[ 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)
-