Class Matrix


  • public class Matrix
    extends java.lang.Object
    4x4 Matrix representing translation, scale, and rotation. Column major, right handed [0, 4, 8, 12] [1, 5, 9, 13] [2, 6, 10, 14] [3, 7, 11, 15]
    • Field Detail

      • IDENTITY_DATA

        public static final float[] IDENTITY_DATA
      • data

        public float[] data
    • Constructor Detail

      • Matrix

        public Matrix()
      • Matrix

        public Matrix​(float[] data)
    • Method Detail

      • set

        public void set​(float[] data)
      • set

        public void set​(Matrix m)
      • decomposeTranslation

        public void decomposeTranslation​(Vector3 destTranslation)
      • decomposeScale

        public void decomposeScale​(Vector3 destScale)
      • decomposeRotation

        public void decomposeRotation​(Vector3 decomposedScale,
                                      Quaternion destRotation)
      • decomposeRotation

        public void decomposeRotation​(Vector3 decomposedScale,
                                      Matrix destMatrix)
      • extractQuaternion

        public void extractQuaternion​(Quaternion destQuaternion)
      • makeTranslation

        public void makeTranslation​(Vector3 translation)
      • setTranslation

        public void setTranslation​(Vector3 translation)
      • makeRotation

        public void makeRotation​(Quaternion rotation)
      • makeScale

        public void makeScale​(float scale)
      • makeScale

        public void makeScale​(Vector3 scale)
      • transformDirection

        public Vector3 transformDirection​(Vector3 vector)
        Transforms a direction by ignoring any translation.

        If the matrix is uniformly (positively) scaled, then the resulting direction will be correct but scaled by the same factor. If a unit direction is required then the result should be normalized.

        If the scale is non-uniform or negative then the result vector will be distorted. In this case the matrix used should be the inverse transpose of the incoming matrix.

      • invert

        public static boolean invert​(Matrix matrix,
                                     Matrix dest)
      • equals

        public static boolean equals​(Matrix lhs,
                                     Matrix rhs)
        Compares Matrix values