Class RMat44

All Implemented Interfaces:
ConstJoltPhysicsObject, RMat44Arg, AutoCloseable, Comparable<ConstJoltPhysicsObject>

public final class RMat44 extends JoltPhysicsObject implements RMat44Arg
A 4x4 matrix composed of 16 Real elements, used to represent transformations of 3-D coordinates.
  • Constructor Details

    • RMat44

      public RMat44()
      Instantiate an uninitialized matrix.
    • RMat44

      public RMat44(Mat44Arg spMatrix)
      Instantiate from a single-precision matrix.
      Parameters:
      spMatrix - the matrix to copy (not null, unaffected)
  • Method Details

    • 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
    • sIdentity

      public static RMat44 sIdentity()
      Create an identity matrix.
      Returns:
      a new instance
    • sRotationTranslation

      public static RMat44 sRotationTranslation(QuatArg rotation, RVec3Arg offset)
      Create a translation-and-rotation matrix.
      Parameters:
      rotation - the amount to rotate (not null, unaffected)
      offset - the amount to translate (not null, unaffected)
      Returns:
      a new instance
    • sTranslation

      public static RMat44 sTranslation(RVec3Arg offset)
      Create a pure translation matrix.
      Parameters:
      offset - the amount to translate (not null, unaffected)
      Returns:
      a new instance
    • sZero

      public static RMat44 sZero()
      Create an all-zero matrix.
      Returns:
      a new instance
    • getElement

      public double getElement(int row, int column)
      Return the specified element in double precision. The matrix is unaffected.
      Specified by:
      getElement in interface RMat44Arg
      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
    • getTranslation

      public RVec3 getTranslation()
      Return the translation component. The matrix is unaffected.
      Specified by:
      getTranslation in interface RMat44Arg
      Returns:
      a new vector
    • toString

      public String 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:
      toString in class JoltPhysicsObject
      Returns:
      the string representation (not null, not empty)