Class Mat4

java.lang.Object
rosequartz.math.Mat4
All Implemented Interfaces:
Serializable

public class Mat4 extends Object implements Serializable
Represents any 4x4 Matrix. The matrix values are named:

     [ m00 m10 m20 m30 ]
     | m01 m11 m21 m31 |
     | m02 m12 m22 m32 |
     [ m03 m13 m23 m33 ]
 
See Also:
Serialized Form
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
    float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new Matrix4 and calls identity.
    Mat4​(float m00, float m10, float m20, float m30, float m01, float m11, float m21, float m31, float m02, float m12, float m22, float m32, float m03, float m13, float m23, float m33)
    Creates a new Matrix4 and calls set with the given values.
    Mat4​(Mat4 mat)
    Creates a new Matrix4 with the values of the given matrix.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    get​(int column, int row)
    Returns the given value.
    getColumn​(int column)
    Returns the given column as a vector.
    getRow​(int row)
    Returns the given row as a vector.
    float[]
    Returns the values in the matrix as an array.
    Sets the values of the matrix to these values:
    mul​(Mat4 mat)
    Multiplies this matrix with the given matrix and stores the result in this.
    mul​(Mat4 mat, Mat4 dest)
    Multiplies this matrix with the given matrix and stores the result in dest
    mulN​(Mat4 mat)
    Multiplies this matrix with the given matrix and stores the result in a new matrix, returning it.
    set​(float m00, float m10, float m20, float m30, float m01, float m11, float m21, float m31, float m02, float m12, float m22, float m32, float m03, float m13, float m23, float m33)
    Sets the values of the matrix.
    set​(int column, int row, float value)
    Sets the component in the given row and column to a given value.
    set​(Mat4 mat)
    Sets the values of this matrix to the values of the given matrix.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • m00

      public float m00
    • m10

      public float m10
    • m20

      public float m20
    • m30

      public float m30
    • m01

      public float m01
    • m11

      public float m11
    • m21

      public float m21
    • m31

      public float m31
    • m02

      public float m02
    • m12

      public float m12
    • m22

      public float m22
    • m32

      public float m32
    • m03

      public float m03
    • m13

      public float m13
    • m23

      public float m23
    • m33

      public float m33
  • Constructor Details

  • Method Details

    • set

      public Mat4 set(float m00, float m10, float m20, float m30, float m01, float m11, float m21, float m31, float m02, float m12, float m22, float m32, float m03, float m13, float m23, float m33)
      Sets the values of the matrix.
      Parameters:
      m00 - value (see class for layout)
      m01 - value (see class for layout)
      m02 - value (see class for layout)
      m03 - value (see class for layout)
      m10 - value (see class for layout)
      m11 - value (see class for layout)
      m12 - value (see class for layout)
      m13 - value (see class for layout)
      m20 - value (see class for layout)
      m21 - value (see class for layout)
      m22 - value (see class for layout)
      m23 - value (see class for layout)
      m30 - value (see class for layout)
      m31 - value (see class for layout)
      m32 - value (see class for layout)
      m33 - value (see class for layout)
      Returns:
      this
      See Also:
      Mat4
    • set

      public Mat4 set(Mat4 mat)
      Sets the values of this matrix to the values of the given matrix.
      Parameters:
      mat - matrix to copy values from
      Returns:
      this
    • set

      public Mat4 set(int column, int row, float value)
      Sets the component in the given row and column to a given value.
      Parameters:
      column - column of component (0, 1, 2 or 3)
      row - row of component (0, 1, 2 or 3)
      value - value to set
      Returns:
      this
    • getColumn

      public Vec4 getColumn(int column)
      Returns the given column as a vector.
      Parameters:
      column - index of column (0, 1, 2 or 3)
      Returns:
      column as vector
    • getRow

      public Vec4 getRow(int row)
      Returns the given row as a vector.
      Parameters:
      row - index of row (0, 1, 2 or 3)
      Returns:
      row as vector
    • get

      public float get(int column, int row)
      Returns the given value.
      Parameters:
      column - index of column (0, 1, 2 or 3)
      row - index of row (0, 1, 2 or 3)
      Returns:
      value
    • identity

      public Mat4 identity()
      Sets the values of the matrix to these values:
      
           [ 1 0 0 0 ]
           | 0 1 0 0 |
           | 0 0 1 0 |
           [ 0 0 0 1 ]
       
      Returns:
      this
    • mul

      public Mat4 mul(Mat4 mat)
      Multiplies this matrix with the given matrix and stores the result in this.
      Parameters:
      mat - matrix to multiply with this one
      Returns:
      result in this
    • mul

      public Mat4 mul(Mat4 mat, Mat4 dest)
      Multiplies this matrix with the given matrix and stores the result in dest
      Parameters:
      mat - matrix to multiply with this one
      dest - matrix to store result in
      Returns:
      this
    • mulN

      public Mat4 mulN(Mat4 mat)
      Multiplies this matrix with the given matrix and stores the result in a new matrix, returning it.
      Parameters:
      mat - matrix to multiply with this one
      Returns:
      new matrix holding the result
    • getValues

      public float[] getValues()
      Returns the values in the matrix as an array.
      Returns:
      values of matrix as array
    • toString

      public String toString()
      Overrides:
      toString in class Object