Package toxi.geom

Class Matrix4f

java.lang.Object
toxi.geom.Matrix4f
All Implemented Interfaces:
Serializable, Cloneable

public class Matrix4f extends Object implements Serializable, Cloneable
A single precision floating point 4 by 4 matrix. Primarily to support 3D rotations.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
    The first element of the first row.
    float
    The second element of the first row.
    float
    The third element of the first row.
    float
    The fourth element of the first row.
    float
    The first element of the second row.
    float
    The second element of the second row.
    float
    The third element of the second row.
    float
    The fourth element of the second row.
    float
    The first element of the third row.
    float
    The second element of the third row.
    float
    The third element of the third row.
    float
    The fourth element of the third row.
    float
    The first element of the fourth row.
    float
    The second element of the fourth row.
    float
    The third element of the fourth row.
    float
    The fourth element of the fourth row.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs and initializes a Matrix4f to all zeros.
    Matrix4f(float[] v)
    Constructs and initializes a Matrix4f from the specified 16 element array.
    Matrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
    Constructs and initializes a Matrix4f from the specified 16 values.
    Matrix4f(Matrix3d m1, Vec3D t1, float s)
    Constructs and initializes a Matrix4f from the rotation matrix, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components of the matrix.
    Constructs a new matrix with the same values as the Matrix4f parameter.
    Matrix4f(Quaternion q1, Vec3D t1, float s)
    Constructs and initializes a Matrix4f from the quaternion, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    add(float scalar)
    Adds a scalar to each component of this matrix.
    final void
    add(float scalar, Matrix4f m1)
    Adds a scalar to each component of the matrix m1 and places the result into this.
    final void
    Sets the value of this matrix to the sum of itself and matrix m1.
    final void
    Sets the value of this matrix to the matrix sum of matrices m1 and m2.
    Creates a new object of the same class as this object.
    final float
    Computes the determinate of this matrix.
    boolean
    epsilonEquals(Matrix4f m1, float epsilon)
    Returns true if the L-infinite distance between this matrix and matrix m1 is less than or equal to the epsilon parameter, otherwise returns false.
    boolean
    Returns true if the Object t1 is of type Matrix4f and all of the data members of t1 are equal to the corresponding data members in this Matrix4f.
    boolean
    Returns true if all of the data members of Matrix4f m1 are equal to the corresponding data members in this Matrix4f.
    final void
    Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Matrix3d parameter.
    final double
    get(Matrix3d m1, Vec3D t1)
    Performs an SVD normalization of this matrix to calculate the rotation as a 3x3 matrix, the translation, and the scale.
    final void
    Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Quat4f parameter.
    final void
    get(Vec3D trans)
    Retrieves the translational components of this matrix.
    final void
    getColumn(int column, float[] v)
    Copies the matrix values in the specified column into the array parameter.
    final void
    getColumn(int column, Vec4D v)
    Copies the matrix values in the specified column into the vector parameter.
    final float
    getElement(int row, int column)
    Retrieves the value at the specified row and column of this matrix.
    final float
    Get the first matrix element in the first row.
    final float
    Get the second matrix element in the first row.
    final float
    Get the third matrix element in the first row.
    final float
    Get the fourth element of the first row.
    final float
    Get first matrix element in the second row.
    final float
    Get second matrix element in the second row.
    final float
    Get the third matrix element in the second row.
    final float
    Get the fourth element of the second row.
    final float
    Get the first matrix element in the third row.
    final float
    Get the second matrix element in the third row.
    final float
    Get the third matrix element in the third row.
    final float
    Get the fourth element of the third row.
    final float
    Get the first element of the fourth row.
    final float
    Get the second element of the fourth row.
    final float
    Get the third element of the fourth row.
    final float
    Get the fourth element of the fourth row.
    final void
    Gets the upper 3x3 values of this matrix and places them into the matrix m1.
    final void
    getRow(int row, float[] v)
    Copies the matrix values in the specified row into the array parameter.
    final void
    getRow(int row, Vec4D v)
    Copies the matrix values in the specified row into the vector parameter.
    final float
    Performs an SVD normalization of this matrix to calculate and return the uniform scale factor.
    int
    Returns a hash code value based on the data values in this object.
    final void
    Inverts this matrix in place.
    final void
    Sets the value of this matrix to the matrix inverse of the passed (user declared) matrix m1.
    final void
    mul(float scalar)
    Multiplies each element of this matrix by a scalar.
    final void
    mul(float scalar, Matrix4f m1)
    Multiplies each element of matrix m1 by a scalar and places the result into this.
    final void
    Sets the value of this matrix to the result of multiplying itself with matrix m1.
    final void
    Sets the value of this matrix to the result of multiplying the two argument matrices together.
    final void
    Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this.
    final void
    Multiplies the transpose of matrix m1 times matrix m2, and places the result into this.
    final void
    Multiplies matrix m1 times the transpose of matrix m2, and places the result into this.
    final void
    Negates the value of this matrix: this = -this.
    final void
    Sets the value of this matrix equal to the negation of of the Matrix4f parameter.
    final void
    rotX(float angle)
    Sets the value of this matrix to a counter clockwise rotation about the x axis.
    final void
    rotY(float angle)
    Sets the value of this matrix to a counter clockwise rotation about the y axis.
    final void
    rotZ(float angle)
    Sets the value of this matrix to a counter clockwise rotation about the z axis.
    final void
    set(float scale)
    Sets the value of this matrix to a scale matrix with the the passed scale amount.
    final void
    set(float[] m)
    Sets the values in this Matrix4f equal to the row-major array parameter (ie, the first four elements of the array will be copied into the first row of this matrix, etc.).
    final void
    set(float scale, Vec3D t1)
    Sets the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.
    final void
    Sets the rotational component (upper 3x3) of this matrix to the matrix values in the double precision Matrix3d argument; the other elements of this matrix are initialized as if this were an identity matrix (i.e., affine matrix with no translational component).
    final void
    set(Matrix3d m1, Vec3D t1, double scale)
    Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale factor.
    final void
    Sets the value of this matrix to a copy of the passed matrix m1.
    final void
    Sets the value of this matrix to the matrix conversion of the single precision quaternion argument.
    final void
    set(Quaternion q1, Vec3D t1, double s)
    Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.
    final void
    set(Quaternion q1, Vec3D t1, float s)
    Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.
    final void
    set(Vec3D v1)
    Sets the value of this matrix to a translate matrix with the passed translation value.
    final void
    set(Vec3D t1, float scale)
    Sets the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.
    final void
    setColumn(int column, float[] v)
    Sets the specified column of this matrix4f to the four values provided.
    final void
    setColumn(int column, float x, float y, float z, float w)
    Sets the specified column of this matrix4f to the four values provided.
    final void
    setColumn(int column, Vec4D v)
    Sets the specified column of this matrix4f to the vector provided.
    final void
    setElement(int row, int column, float value)
    Sets the specified element of this matrix4f to the value provided.
    final void
    Sets this Matrix4f to identity.
    final void
    setM00(float m00)
    Set the first matrix element in the first row.
    final void
    setM01(float m01)
    Set the second matrix element in the first row.
    final void
    setM02(float m02)
    Set the third matrix element in the first row.
    final void
    setM03(float m03)
    Set the fourth element of the first row.
    final void
    setM10(float m10)
    Set first matrix element in the second row.
    final void
    setM11(float m11)
    Set the second matrix element in the second row.
    final void
    setM12(float m12)
    Set the third matrix element in the second row.
    final void
    setM13(float m13)
    Set the fourth element of the second row.
    final void
    setM20(float m20)
    Set the first matrix element in the third row.
    final void
    setM21(float m21)
    Set the second matrix element in the third row.
    final void
    setM22(float m22)
    Set the third matrix element in the third row.
    final void
    setM23(float m23)
    Set the fourth element of the third row.
    final void
    setM30(float m30)
    Set the first element of the fourth row.
    final void
    setM31(float m31)
    Set the second element of the fourth row.
    final void
    setM32(float m32)
    Set the third element of the fourth row.
    final void
    setM33(float m33)
    Set the fourth element of the fourth row.
    final void
    Sets the rotational component (upper 3x3) of this matrix to the matrix values in the double precision Matrix3d argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the passed rotation components, and then the scale is reapplied to the rotational components.
    final void
    Sets the rotational component (upper 3x3) of this matrix to the matrix equivalent values of the quaternion argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the matrix equivalent of the quaternion, and then the scale is reapplied to the rotational components.
    final void
    Replaces the upper 3x3 matrix values of this matrix with the values in the matrix m1.
    final void
    setRow(int row, float[] v)
    Sets the specified row of this matrix4f to the four values provided in the passed array.
    final void
    setRow(int row, float x, float y, float z, float w)
    Sets the specified row of this matrix4f to the four values provided.
    final void
    setRow(int row, Vec4D v)
    Sets the specified row of this matrix4f to the Vector provided.
    final void
    setScale(float scale)
    Sets the scale component of the current matrix by factoring out the current scale (by doing an SVD) from the rotational component and multiplying by the new scale.
    final void
    Modifies the translational components of this matrix to the values of the Vector3f argument; the other values of this matrix are not modified.
    final void
    Sets this matrix to all zeros.
    final void
    Sets this matrix to the matrix difference of itself and matrix m1 (this = this - m1).
    final void
    Performs an element-by-element subtraction of matrix m2 from matrix m1 and places the result into matrix this (this = m2 - m1).
    Returns a string that contains the values of this Matrix4f.
    final void
    Transform the vector vec using this Transform and place the result back into vec.
    final void
    transform(Vec4D vec, Vec4D vecOut)
    Transform the vector vec using this Matrix4f and place the result into vecOut.
    final void
    Transforms the point parameter with this Matrix4f and places the result back into point.
    final void
    transformOne(Vec3D point, Vec3D pointOut)
    Transforms the point parameter with this Matrix4f and places the result into pointOut.
    final void
    Transforms the normal parameter by this transform and places the value back into normal.
    final void
    transformZero(Vec3D normal, Vec3D normalOut)
    Transforms the normal parameter by this Matrix4f and places the value into normalOut.
    final void
    Sets the value of this matrix to its transpose in place.
    final void
    Sets the value of this matrix to the transpose of the argument matrix.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • m00

      public float m00
      The first element of the first row.
    • m01

      public float m01
      The second element of the first row.
    • m02

      public float m02
      The third element of the first row.
    • m03

      public float m03
      The fourth element of the first row.
    • m10

      public float m10
      The first element of the second row.
    • m11

      public float m11
      The second element of the second row.
    • m12

      public float m12
      The third element of the second row.
    • m13

      public float m13
      The fourth element of the second row.
    • m20

      public float m20
      The first element of the third row.
    • m21

      public float m21
      The second element of the third row.
    • m22

      public float m22
      The third element of the third row.
    • m23

      public float m23
      The fourth element of the third row.
    • m30

      public float m30
      The first element of the fourth row.
    • m31

      public float m31
      The second element of the fourth row.
    • m32

      public float m32
      The third element of the fourth row.
    • m33

      public float m33
      The fourth element of the fourth row.
  • Constructor Details

    • Matrix4f

      public Matrix4f()
      Constructs and initializes a Matrix4f to all zeros.
    • Matrix4f

      public Matrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
      Constructs and initializes a Matrix4f from the specified 16 values.
      Parameters:
      m00 - the [0][0] element
      m01 - the [0][1] element
      m02 - the [0][2] element
      m03 - the [0][3] element
      m10 - the [1][0] element
      m11 - the [1][1] element
      m12 - the [1][2] element
      m13 - the [1][3] element
      m20 - the [2][0] element
      m21 - the [2][1] element
      m22 - the [2][2] element
      m23 - the [2][3] element
      m30 - the [3][0] element
      m31 - the [3][1] element
      m32 - the [3][2] element
      m33 - the [3][3] element
    • Matrix4f

      public Matrix4f(float[] v)
      Constructs and initializes a Matrix4f from the specified 16 element array. this.m00 =v[0], this.m01=v[1], etc.
      Parameters:
      v - the array of length 16 containing in order
    • Matrix4f

      public Matrix4f(Matrix3d m1, Vec3D t1, float s)
      Constructs and initializes a Matrix4f from the rotation matrix, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components of the matrix.
      Parameters:
      m1 - the rotation matrix representing the rotational components
      t1 - the translational components of the matrix
      s - the scale value applied to the rotational components
    • Matrix4f

      public Matrix4f(Matrix4f m1)
      Constructs a new matrix with the same values as the Matrix4f parameter.
      Parameters:
      m1 - the source matrix
    • Matrix4f

      public Matrix4f(Quaternion q1, Vec3D t1, float s)
      Constructs and initializes a Matrix4f from the quaternion, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components.
      Parameters:
      q1 - the quaternion value representing the rotational component
      t1 - the translational component of the matrix
      s - the scale value applied to the rotational components
  • Method Details

    • add

      public final void add(float scalar)
      Adds a scalar to each component of this matrix.
      Parameters:
      scalar - the scalar adder
    • add

      public final void add(float scalar, Matrix4f m1)
      Adds a scalar to each component of the matrix m1 and places the result into this. Matrix m1 is not modified.
      Parameters:
      scalar - the scalar adder
      m1 - the original matrix values
    • add

      public final void add(Matrix4f m1)
      Sets the value of this matrix to the sum of itself and matrix m1.
      Parameters:
      m1 - the other matrix
    • add

      public final void add(Matrix4f m1, Matrix4f m2)
      Sets the value of this matrix to the matrix sum of matrices m1 and m2.
      Parameters:
      m1 - the first matrix
      m2 - the second matrix
    • clone

      public Object clone()
      Creates a new object of the same class as this object.
      Returns:
      a clone of this instance.
      Throws:
      OutOfMemoryError - if there is not enough memory.
      Since:
      vecmath 1.3
      See Also:
    • determinant

      public final float determinant()
      Computes the determinate of this matrix.
      Returns:
      the determinate of the matrix
    • epsilonEquals

      public boolean epsilonEquals(Matrix4f m1, float epsilon)
      Returns true if the L-infinite distance between this matrix and matrix m1 is less than or equal to the epsilon parameter, otherwise returns false. The L-infinite distance is equal to MAX[i=0,1,2,3 ; j=0,1,2,3 ; abs(this.m(i,j) - m1.m(i,j)]
      Parameters:
      m1 - the matrix to be compared to this matrix
      epsilon - the threshold value
    • equals

      public boolean equals(Matrix4f m1)
      Returns true if all of the data members of Matrix4f m1 are equal to the corresponding data members in this Matrix4f.
      Parameters:
      m1 - the matrix with which the comparison is made.
      Returns:
      true or false
    • equals

      public boolean equals(Object t1)
      Returns true if the Object t1 is of type Matrix4f and all of the data members of t1 are equal to the corresponding data members in this Matrix4f.
      Overrides:
      equals in class Object
      Parameters:
      t1 - the matrix with which the comparison is made.
      Returns:
      true or false
    • get

      public final void get(Matrix3d m1)
      Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Matrix3d parameter.
      Parameters:
      m1 - matrix into which the rotational component is placed
    • get

      public final double get(Matrix3d m1, Vec3D t1)
      Performs an SVD normalization of this matrix to calculate the rotation as a 3x3 matrix, the translation, and the scale. None of the matrix values are modified.
      Parameters:
      m1 - the normalized matrix representing the rotation
      t1 - the translation component
      Returns:
      the scale component of this transform
    • get

      public final void get(Quaternion q1)
      Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Quat4f parameter.
      Parameters:
      q1 - quaternion into which the rotation component is placed
    • get

      public final void get(Vec3D trans)
      Retrieves the translational components of this matrix.
      Parameters:
      trans - the vector that will receive the translational component
    • getColumn

      public final void getColumn(int column, float[] v)
      Copies the matrix values in the specified column into the array parameter.
      Parameters:
      column - the matrix column
      v - the array into which the matrix row values will be copied
    • getColumn

      public final void getColumn(int column, Vec4D v)
      Copies the matrix values in the specified column into the vector parameter.
      Parameters:
      column - the matrix column
      v - the vector into which the matrix row values will be copied
    • getElement

      public final float getElement(int row, int column)
      Retrieves the value at the specified row and column of this matrix.
      Parameters:
      row - the row number to be retrieved (zero indexed)
      column - the column number to be retrieved (zero indexed)
      Returns:
      the value at the indexed element
    • getM00

      public final float getM00()
      Get the first matrix element in the first row.
      Returns:
      Returns the m00.
      Since:
      vecmath 1.5
    • getM01

      public final float getM01()
      Get the second matrix element in the first row.
      Returns:
      Returns the m01.
      Since:
      vecmath 1.5
    • getM02

      public final float getM02()
      Get the third matrix element in the first row.
      Returns:
      Returns the m02.
      Since:
      vecmath 1.5
    • getM03

      public final float getM03()
      Get the fourth element of the first row.
      Returns:
      Returns the m03.
      Since:
      vecmath 1.5
    • getM10

      public final float getM10()
      Get first matrix element in the second row.
      Returns:
      Returns the m10.
      Since:
      vecmath 1.5
    • getM11

      public final float getM11()
      Get second matrix element in the second row.
      Returns:
      Returns the m11.
      Since:
      vecmath 1.5
    • getM12

      public final float getM12()
      Get the third matrix element in the second row.
      Returns:
      Returns the m12.
      Since:
      vecmath 1.5
    • getM13

      public final float getM13()
      Get the fourth element of the second row.
      Returns:
      Returns the m13.
      Since:
      vecmath 1.5
    • getM20

      public final float getM20()
      Get the first matrix element in the third row.
      Returns:
      Returns the m20.
      Since:
      vecmath 1.5
    • getM21

      public final float getM21()
      Get the second matrix element in the third row.
      Returns:
      Returns the m21.
      Since:
      vecmath 1.5
    • getM22

      public final float getM22()
      Get the third matrix element in the third row.
      Returns:
      Returns the m22.
      Since:
      vecmath 1.5
    • getM23

      public final float getM23()
      Get the fourth element of the third row.
      Returns:
      Returns the m23.
      Since:
      vecmath 1.5
    • getM30

      public final float getM30()
      Get the first element of the fourth row.
      Returns:
      Returns the m30.
      Since:
      vecmath 1.5
    • getM31

      public final float getM31()
      Get the second element of the fourth row.
      Returns:
      Returns the m31.
      Since:
      vecmath 1.5
    • getM32

      public final float getM32()
      Get the third element of the fourth row.
      Returns:
      Returns the m32.
      Since:
      vecmath 1.5
    • getM33

      public final float getM33()
      Get the fourth element of the fourth row.
      Returns:
      Returns the m33.
      Since:
      vecmath 1.5
    • getRotationScale

      public final void getRotationScale(Matrix3d m1)
      Gets the upper 3x3 values of this matrix and places them into the matrix m1.
      Parameters:
      m1 - the matrix that will hold the values
    • getRow

      public final void getRow(int row, float[] v)
      Copies the matrix values in the specified row into the array parameter.
      Parameters:
      row - the matrix row
      v - the array into which the matrix row values will be copied
    • getRow

      public final void getRow(int row, Vec4D v)
      Copies the matrix values in the specified row into the vector parameter.
      Parameters:
      row - the matrix row
      v - the vector into which the matrix row values will be copied
    • getScale

      public final float getScale()
      Performs an SVD normalization of this matrix to calculate and return the uniform scale factor. If the matrix has non-uniform scale factors, the largest of the x, y, and z scale factors will be returned. This matrix is not modified.
      Returns:
      the scale factor of this matrix
    • hashCode

      public int hashCode()
      Returns a hash code value based on the data values in this object. Two different Matrix4f objects with identical data values (i.e., Matrix4f.equals returns true) will return the same hash code value. Two objects with different data members may return the same hash value, although this is not likely.
      Overrides:
      hashCode in class Object
      Returns:
      the integer hash code value
    • invert

      public final void invert()
      Inverts this matrix in place.
    • invert

      public final void invert(Matrix4f m1)
      Sets the value of this matrix to the matrix inverse of the passed (user declared) matrix m1.
      Parameters:
      m1 - the matrix to be inverted
    • mul

      public final void mul(float scalar)
      Multiplies each element of this matrix by a scalar.
      Parameters:
      scalar - the scalar multiplier.
    • mul

      public final void mul(float scalar, Matrix4f m1)
      Multiplies each element of matrix m1 by a scalar and places the result into this. Matrix m1 is not modified.
      Parameters:
      scalar - the scalar multiplier.
      m1 - the original matrix.
    • mul

      public final void mul(Matrix4f m1)
      Sets the value of this matrix to the result of multiplying itself with matrix m1.
      Parameters:
      m1 - the other matrix
    • mul

      public final void mul(Matrix4f m1, Matrix4f m2)
      Sets the value of this matrix to the result of multiplying the two argument matrices together.
      Parameters:
      m1 - the first matrix
      m2 - the second matrix
    • mulTransposeBoth

      public final void mulTransposeBoth(Matrix4f m1, Matrix4f m2)
      Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this.
      Parameters:
      m1 - the matrix on the left hand side of the multiplication
      m2 - the matrix on the right hand side of the multiplication
    • mulTransposeLeft

      public final void mulTransposeLeft(Matrix4f m1, Matrix4f m2)
      Multiplies the transpose of matrix m1 times matrix m2, and places the result into this.
      Parameters:
      m1 - the matrix on the left hand side of the multiplication
      m2 - the matrix on the right hand side of the multiplication
    • mulTransposeRight

      public final void mulTransposeRight(Matrix4f m1, Matrix4f m2)
      Multiplies matrix m1 times the transpose of matrix m2, and places the result into this.
      Parameters:
      m1 - the matrix on the left hand side of the multiplication
      m2 - the matrix on the right hand side of the multiplication
    • negate

      public final void negate()
      Negates the value of this matrix: this = -this.
    • negate

      public final void negate(Matrix4f m1)
      Sets the value of this matrix equal to the negation of of the Matrix4f parameter.
      Parameters:
      m1 - the source matrix
    • rotX

      public final void rotX(float angle)
      Sets the value of this matrix to a counter clockwise rotation about the x axis.
      Parameters:
      angle - the angle to rotate about the X axis in radians
    • rotY

      public final void rotY(float angle)
      Sets the value of this matrix to a counter clockwise rotation about the y axis.
      Parameters:
      angle - the angle to rotate about the Y axis in radians
    • rotZ

      public final void rotZ(float angle)
      Sets the value of this matrix to a counter clockwise rotation about the z axis.
      Parameters:
      angle - the angle to rotate about the Z axis in radians
    • set

      public final void set(float scale)
      Sets the value of this matrix to a scale matrix with the the passed scale amount.
      Parameters:
      scale - the scale factor for the matrix
    • set

      public final void set(float scale, Vec3D t1)
      Sets the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.
      Parameters:
      scale - the scale factor for the matrix
      t1 - the translation amount
    • set

      public final void set(float[] m)
      Sets the values in this Matrix4f equal to the row-major array parameter (ie, the first four elements of the array will be copied into the first row of this matrix, etc.).
      Parameters:
      m - the single precision array of length 16
    • set

      public final void set(Matrix3d m1)
      Sets the rotational component (upper 3x3) of this matrix to the matrix values in the double precision Matrix3d argument; the other elements of this matrix are initialized as if this were an identity matrix (i.e., affine matrix with no translational component).
      Parameters:
      m1 - the double-precision 3x3 matrix
    • set

      public final void set(Matrix3d m1, Vec3D t1, double scale)
      Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale factor. The translation is not modified by the scale.
      Parameters:
      m1 - the rotation component
      t1 - the translation component
      scale - the scale factor
    • set

      public final void set(Matrix4f m1)
      Sets the value of this matrix to a copy of the passed matrix m1.
      Parameters:
      m1 - the matrix to be copied
    • set

      public final void set(Quaternion q1)
      Sets the value of this matrix to the matrix conversion of the single precision quaternion argument.
      Parameters:
      q1 - the quaternion to be converted
    • set

      public final void set(Quaternion q1, Vec3D t1, double s)
      Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.
      Parameters:
      q1 - the rotation expressed as a quaternion
      t1 - the translation
      s - the scale value
    • set

      public final void set(Quaternion q1, Vec3D t1, float s)
      Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.
      Parameters:
      q1 - the rotation expressed as a quaternion
      t1 - the translation
      s - the scale value
    • set

      public final void set(Vec3D v1)
      Sets the value of this matrix to a translate matrix with the passed translation value.
      Parameters:
      v1 - the translation amount
    • set

      public final void set(Vec3D t1, float scale)
      Sets the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.
      Parameters:
      t1 - the translation amount
      scale - the scale factor for the matrix
    • setColumn

      public final void setColumn(int column, float[] v)
      Sets the specified column of this matrix4f to the four values provided.
      Parameters:
      column - the column number to be modified (zero indexed)
      v - the replacement column
    • setColumn

      public final void setColumn(int column, float x, float y, float z, float w)
      Sets the specified column of this matrix4f to the four values provided.
      Parameters:
      column - the column number to be modified (zero indexed)
      x - the first row element
      y - the second row element
      z - the third row element
      w - the fourth row element
    • setColumn

      public final void setColumn(int column, Vec4D v)
      Sets the specified column of this matrix4f to the vector provided.
      Parameters:
      column - the column number to be modified (zero indexed)
      v - the replacement column
    • setElement

      public final void setElement(int row, int column, float value)
      Sets the specified element of this matrix4f to the value provided.
      Parameters:
      row - the row number to be modified (zero indexed)
      column - the column number to be modified (zero indexed)
      value - the new value
    • setIdentity

      public final void setIdentity()
      Sets this Matrix4f to identity.
    • setM00

      public final void setM00(float m00)
      Set the first matrix element in the first row.
      Parameters:
      m00 - The m00 to set.
      Since:
      vecmath 1.5
    • setM01

      public final void setM01(float m01)
      Set the second matrix element in the first row.
      Parameters:
      m01 - The m01 to set.
      Since:
      vecmath 1.5
    • setM02

      public final void setM02(float m02)
      Set the third matrix element in the first row.
      Parameters:
      m02 - The m02 to set.
      Since:
      vecmath 1.5
    • setM03

      public final void setM03(float m03)
      Set the fourth element of the first row.
      Parameters:
      m03 - The m03 to set.
      Since:
      vecmath 1.5
    • setM10

      public final void setM10(float m10)
      Set first matrix element in the second row.
      Parameters:
      m10 - The m10 to set.
      Since:
      vecmath 1.5
    • setM11

      public final void setM11(float m11)
      Set the second matrix element in the second row.
      Parameters:
      m11 - The m11 to set.
      Since:
      vecmath 1.5
    • setM12

      public final void setM12(float m12)
      Set the third matrix element in the second row.
      Parameters:
      m12 - The m12 to set.
      Since:
      vecmath 1.5
    • setM13

      public final void setM13(float m13)
      Set the fourth element of the second row.
      Parameters:
      m13 - The m13 to set.
      Since:
      vecmath 1.5
    • setM20

      public final void setM20(float m20)
      Set the first matrix element in the third row.
      Parameters:
      m20 - The m20 to set.
      Since:
      vecmath 1.5
    • setM21

      public final void setM21(float m21)
      Set the second matrix element in the third row.
      Parameters:
      m21 - The m21 to set.
      Since:
      vecmath 1.5
    • setM22

      public final void setM22(float m22)
      Set the third matrix element in the third row.
      Parameters:
      m22 - The m22 to set.
      Since:
      vecmath 1.5
    • setM23

      public final void setM23(float m23)
      Set the fourth element of the third row.
      Parameters:
      m23 - The m23 to set.
      Since:
      vecmath 1.5
    • setM30

      public final void setM30(float m30)
      Set the first element of the fourth row.
      Parameters:
      m30 - The m30 to set.
      Since:
      vecmath 1.5
    • setM31

      public final void setM31(float m31)
      Set the second element of the fourth row.
      Parameters:
      m31 - The m31 to set.
      Since:
      vecmath 1.5
    • setM32

      public final void setM32(float m32)
      Set the third element of the fourth row.
      Parameters:
      m32 - The m32 to set.
      Since:
      vecmath 1.5
    • setM33

      public final void setM33(float m33)
      Set the fourth element of the fourth row.
      Parameters:
      m33 - The m33 to set.
      Since:
      vecmath 1.5
    • setRotation

      public final void setRotation(Matrix3d m1)
      Sets the rotational component (upper 3x3) of this matrix to the matrix values in the double precision Matrix3d argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the passed rotation components, and then the scale is reapplied to the rotational components.
      Parameters:
      m1 - double precision 3x3 matrix
    • setRotation

      public final void setRotation(Quaternion q1)
      Sets the rotational component (upper 3x3) of this matrix to the matrix equivalent values of the quaternion argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the matrix equivalent of the quaternion, and then the scale is reapplied to the rotational components.
      Parameters:
      q1 - the quaternion that specifies the rotation
    • setRotationScale

      public final void setRotationScale(Matrix3d m1)
      Replaces the upper 3x3 matrix values of this matrix with the values in the matrix m1.
      Parameters:
      m1 - the matrix that will be the new upper 3x3
    • setRow

      public final void setRow(int row, float[] v)
      Sets the specified row of this matrix4f to the four values provided in the passed array.
      Parameters:
      row - the row number to be modified (zero indexed)
      v - the replacement row
    • setRow

      public final void setRow(int row, float x, float y, float z, float w)
      Sets the specified row of this matrix4f to the four values provided.
      Parameters:
      row - the row number to be modified (zero indexed)
      x - the first column element
      y - the second column element
      z - the third column element
      w - the fourth column element
    • setRow

      public final void setRow(int row, Vec4D v)
      Sets the specified row of this matrix4f to the Vector provided.
      Parameters:
      row - the row number to be modified (zero indexed)
      v - the replacement row
    • setScale

      public final void setScale(float scale)
      Sets the scale component of the current matrix by factoring out the current scale (by doing an SVD) from the rotational component and multiplying by the new scale.
      Parameters:
      scale - the new scale amount
    • setTranslation

      public final void setTranslation(Vec3D trans)
      Modifies the translational components of this matrix to the values of the Vector3f argument; the other values of this matrix are not modified.
      Parameters:
      trans - the translational component
    • setZero

      public final void setZero()
      Sets this matrix to all zeros.
    • sub

      public final void sub(Matrix4f m1)
      Sets this matrix to the matrix difference of itself and matrix m1 (this = this - m1).
      Parameters:
      m1 - the other matrix
    • sub

      public final void sub(Matrix4f m1, Matrix4f m2)
      Performs an element-by-element subtraction of matrix m2 from matrix m1 and places the result into matrix this (this = m2 - m1).
      Parameters:
      m1 - the first matrix
      m2 - the second matrix
    • toString

      public String toString()
      Returns a string that contains the values of this Matrix4f.
      Overrides:
      toString in class Object
      Returns:
      the String representation
    • transform

      public final void transform(Vec4D vec)
      Transform the vector vec using this Transform and place the result back into vec.
      Parameters:
      vec - the single precision vector to be transformed
    • transform

      public final void transform(Vec4D vec, Vec4D vecOut)
      Transform the vector vec using this Matrix4f and place the result into vecOut.
      Parameters:
      vec - the single precision vector to be transformed
      vecOut - the vector into which the transformed values are placed
    • transformOne

      public final void transformOne(Vec3D point)
      Transforms the point parameter with this Matrix4f and places the result back into point. The fourth element of the point input paramter is assumed to be one.
      Parameters:
      point - the input point to be transformed.
    • transformOne

      public final void transformOne(Vec3D point, Vec3D pointOut)
      Transforms the point parameter with this Matrix4f and places the result into pointOut. The fourth element of the point input paramter is assumed to be one.
      Parameters:
      point - the input point to be transformed.
      pointOut - the transformed point
    • transformZero

      public final void transformZero(Vec3D normal)
      Transforms the normal parameter by this transform and places the value back into normal. The fourth element of the normal is assumed to be zero.
      Parameters:
      normal - the input normal to be transformed.
    • transformZero

      public final void transformZero(Vec3D normal, Vec3D normalOut)
      Transforms the normal parameter by this Matrix4f and places the value into normalOut. The fourth element of the normal is assumed to be zero.
      Parameters:
      normal - the input normal to be transformed.
      normalOut - the transformed normal
    • transpose

      public final void transpose()
      Sets the value of this matrix to its transpose in place.
    • transpose

      public final void transpose(Matrix4f m1)
      Sets the value of this matrix to the transpose of the argument matrix.
      Parameters:
      m1 - the matrix to be transposed