Package org.joml

Class Matrix3f

java.lang.Object
org.joml.Matrix3f
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Matrix3fc
Direct Known Subclasses:
Matrix3fStack

public class Matrix3f extends Object implements Externalizable, Cloneable, Matrix3fc
Contains the definition of a 3x3 matrix of floats, and associated functions to transform it. The matrix is column-major to match OpenGL's interpretation, and it looks like this:

m00 m10 m20
m01 m11 m21
m02 m12 m22

Author:
Richard Greenlees, Kai Burjack
See Also:
  • Field Summary

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

    Constructors
    Constructor
    Description
    Create a new Matrix3f and set it to identity.
    Matrix3f(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
    Create a new 3x3 matrix using the supplied float values.
    Create a new Matrix3f by reading its 9 float components from the given FloatBuffer at the buffer's current position.
    Create a new Matrix3f by setting its uppper left 2x2 submatrix to the values of the given Matrix2fc and the rest to identity.
    Create a new Matrix3f and make it a copy of the given matrix.
    Create a new Matrix3f and make it a copy of the upper left 3x3 of the given Matrix4fc.
    Matrix3f(Vector3fc col0, Vector3fc col1, Vector3fc col2)
    Create a new Matrix3f and initialize its three columns using the supplied vectors.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Matrix3fc other)
    Component-wise add this and other.
    add(Matrix3fc other, Matrix3f dest)
    Component-wise add this and other and store the result in dest.
     
    Compute the cofactor matrix of this.
    Compute the cofactor matrix of this and store it into dest.
    float
    Return the determinant of this matrix.
    boolean
     
    boolean
    equals(Matrix3fc m, float delta)
    Compare the matrix elements of this matrix with the given matrix using the given delta and return whether all of them are equal within a maximum difference of delta.
    float[]
    get(float[] arr)
    Store this matrix into the supplied float array in column-major order.
    float[]
    get(float[] arr, int offset)
    Store this matrix into the supplied float array in column-major order at the given offset.
    float
    get(int column, int row)
    Get the matrix element value at the given column and row.
    get(int index, ByteBuffer buffer)
    Store this matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.
    get(int index, FloatBuffer buffer)
    Store this matrix in column-major order into the supplied FloatBuffer starting at the specified absolute buffer position/index.
    get(ByteBuffer buffer)
    Store this matrix in column-major order into the supplied ByteBuffer at the current buffer position.
    get(FloatBuffer buffer)
    Store this matrix in column-major order into the supplied FloatBuffer at the current buffer position.
    get(Matrix3f dest)
    Get the current values of this matrix and store them into dest.
    get(Matrix4f dest)
    Get the current values of this matrix and store them as the rotational component of dest.
    get3x4(int index, ByteBuffer buffer)
    Store this matrix as 3x4 matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index, with the m03, m13 and m23 components being zero.
    get3x4(int index, FloatBuffer buffer)
    Store this matrix as 3x4 matrix in column-major order into the supplied FloatBuffer starting at the specified absolute buffer position/index, with the m03, m13 and m23 components being zero.
    Store this matrix as 3x4 matrix in column-major order into the supplied ByteBuffer at the current buffer position, with the m03, m13 and m23 components being zero.
    Store this matrix as 3x4 matrix in column-major order into the supplied FloatBuffer at the current buffer position, with the m03, m13 and m23 components being zero.
    getColumn(int column, Vector3f dest)
    Get the column at the given column index, starting with 0.
    Extract the Euler angles from the rotation represented by this matrix and store the extracted Euler angles in dest.
    Get the current values of this matrix and store the represented rotation into the given Quaterniond.
    Get the current values of this matrix and store the represented rotation into the given Quaternionf.
    Get the current values of this matrix and store the represented rotation into the given AxisAngle4f.
    getRow(int row, Vector3f dest)
    Get the row at the given row index, starting with 0.
    float
    getRowColumn(int row, int column)
    Get the matrix element value at the given row and column.
    Get the scaling factors of this matrix for the three base axes.
    getToAddress(long address)
    Store this matrix in column-major order at the given off-heap address.
    getTransposed(int index, ByteBuffer buffer)
    Store the transpose of this matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.
    getTransposed(int index, FloatBuffer buffer)
    Store the transpose of this matrix in column-major order into the supplied FloatBuffer starting at the specified absolute buffer position/index.
    Store the transpose of this matrix in column-major order into the supplied ByteBuffer at the current buffer position.
    Store the transpose of this matrix in column-major order into the supplied FloatBuffer at the current buffer position.
    Get the current values of this matrix and store the represented rotation into the given Quaterniond.
    Get the current values of this matrix and store the represented rotation into the given Quaternionf.
    int
     
    Set this matrix to the identity.
    Invert this matrix.
    Invert the this matrix and store the result in dest.
    boolean
    Determine whether all matrix elements are finite floating-point values, that is, they are not NaN and not infinity.
    lerp(Matrix3fc other, float t)
    Linearly interpolate this and other using the given interpolation factor t and store the result in this.
    lerp(Matrix3fc other, float t, Matrix3f dest)
    Linearly interpolate this and other using the given interpolation factor t and store the result in dest.
    lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
    Apply a rotation transformation to this matrix to make -z point along dir.
    lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix3f dest)
    Apply a rotation transformation to this matrix to make -z point along dir and store the result in dest.
    Apply a rotation transformation to this matrix to make -z point along dir.
    Apply a rotation transformation to this matrix to make -z point along dir and store the result in dest.
    float
    m00()
    Return the value of the matrix element at column 0 and row 0.
    m00(float m00)
    Set the value of the matrix element at column 0 and row 0.
    float
    m01()
    Return the value of the matrix element at column 0 and row 1.
    m01(float m01)
    Set the value of the matrix element at column 0 and row 1.
    float
    m02()
    Return the value of the matrix element at column 0 and row 2.
    m02(float m02)
    Set the value of the matrix element at column 0 and row 2.
    float
    m10()
    Return the value of the matrix element at column 1 and row 0.
    m10(float m10)
    Set the value of the matrix element at column 1 and row 0.
    float
    m11()
    Return the value of the matrix element at column 1 and row 1.
    m11(float m11)
    Set the value of the matrix element at column 1 and row 1.
    float
    m12()
    Return the value of the matrix element at column 1 and row 2.
    m12(float m12)
    Set the value of the matrix element at column 1 and row 2.
    float
    m20()
    Return the value of the matrix element at column 2 and row 0.
    m20(float m20)
    Set the value of the matrix element at column 2 and row 0.
    float
    m21()
    Return the value of the matrix element at column 2 and row 1.
    m21(float m21)
    Set the value of the matrix element at column 2 and row 1.
    float
    m22()
    Return the value of the matrix element at column 2 and row 2.
    m22(float m22)
    Set the value of the matrix element at column 2 and row 2.
    mul(Matrix3fc right)
    Multiply this matrix by the supplied right matrix.
    mul(Matrix3fc right, Matrix3f dest)
    Multiply this matrix by the supplied right matrix and store the result in dest.
    Component-wise multiply this by other.
    Component-wise multiply this by other and store the result in dest.
    Pre-multiply this matrix by the supplied left matrix and store the result in this.
    Pre-multiply this matrix by the supplied left matrix and store the result in dest.
    Set this matrix to its own normal matrix.
    Compute a normal matrix from this matrix and store it into dest.
    Obtain the direction of +X before the transformation represented by this orthogonal matrix is applied.
    Obtain the direction of +Y before the transformation represented by this orthogonal matrix is applied.
    Obtain the direction of +Z before the transformation represented by this orthogonal matrix is applied.
    obliqueZ(float a, float b)
    Apply an oblique projection transformation to this matrix with the given values for a and b.
    obliqueZ(float a, float b, Matrix3f dest)
    Apply an oblique projection transformation to this matrix with the given values for a and b and store the result in dest.
    Obtain the direction of +X before the transformation represented by this matrix is applied.
    Obtain the direction of +Y before the transformation represented by this matrix is applied.
    Obtain the direction of +Z before the transformation represented by this matrix is applied.
    float
    quadraticFormProduct(float x, float y, float z)
    Compute (x, y, z)^T * this * (x, y, z).
    float
    Compute v^T * this * v.
    void
     
    reflect(float nx, float ny, float nz)
    Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal.
    reflect(float nx, float ny, float nz, Matrix3f dest)
    Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal (nx, ny, nz), and store the result in dest.
    reflect(Quaternionfc orientation)
    Apply a mirror/reflection transformation to this matrix that reflects about a plane specified via the plane orientation.
    reflect(Quaternionfc orientation, Matrix3f dest)
    Apply a mirror/reflection transformation to this matrix that reflects through a plane specified via the plane orientation, and store the result in dest.
    Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal.
    reflect(Vector3fc normal, Matrix3f dest)
    Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal, and store the result in dest.
    reflection(float nx, float ny, float nz)
    Set this matrix to a mirror/reflection transformation that reflects through the given plane specified via the plane normal.
    reflection(Quaternionfc orientation)
    Set this matrix to a mirror/reflection transformation that reflects through a plane specified via the plane orientation.
    Set this matrix to a mirror/reflection transformation that reflects through the given plane specified via the plane normal.
    rotate(float ang, float x, float y, float z)
    Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components.
    rotate(float ang, float x, float y, float z, Matrix3f dest)
    Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components, and store the result in dest.
    rotate(float angle, Vector3fc axis)
    Apply a rotation transformation, rotating the given radians about the specified axis, to this matrix.
    rotate(float angle, Vector3fc axis, Matrix3f dest)
    Apply a rotation transformation, rotating the given radians about the specified axis and store the result in dest.
    rotate(AxisAngle4f axisAngle)
    Apply a rotation transformation, rotating about the given AxisAngle4f, to this matrix.
    rotate(AxisAngle4f axisAngle, Matrix3f dest)
    Apply a rotation transformation, rotating about the given AxisAngle4f and store the result in dest.
    Apply the rotation - and possibly scaling - transformation of the given Quaternionfc to this matrix.
    Apply the rotation - and possibly scaling - transformation of the given Quaternionfc to this matrix and store the result in dest.
    rotateLocal(float ang, float x, float y, float z)
    Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified (x, y, z) axis.
    rotateLocal(float ang, float x, float y, float z, Matrix3f dest)
    Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified (x, y, z) axis and store the result in dest.
    Pre-multiply the rotation - and possibly scaling - transformation of the given Quaternionfc to this matrix.
    Pre-multiply the rotation - and possibly scaling - transformation of the given Quaternionfc to this matrix and store the result in dest.
    rotateLocalX(float ang)
    Pre-multiply a rotation to this matrix by rotating the given amount of radians about the X axis.
    rotateLocalX(float ang, Matrix3f dest)
    Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result in dest.
    rotateLocalY(float ang)
    Pre-multiply a rotation to this matrix by rotating the given amount of radians about the Y axis.
    rotateLocalY(float ang, Matrix3f dest)
    Pre-multiply a rotation around the Y axis to this matrix by rotating the given amount of radians about the Y axis and store the result in dest.
    rotateLocalZ(float ang)
    Pre-multiply a rotation to this matrix by rotating the given amount of radians about the Z axis.
    rotateLocalZ(float ang, Matrix3f dest)
    Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in dest.
    rotateTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
    Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with direction.
    rotateTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix3f dest)
    Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with dir and store the result in dest.
    Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with direction.
    rotateTowards(Vector3fc direction, Vector3fc up, Matrix3f dest)
    Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with direction and store the result in dest.
    rotateX(float ang)
    Apply rotation about the X axis to this matrix by rotating the given amount of radians.
    rotateX(float ang, Matrix3f dest)
    Apply rotation about the X axis to this matrix by rotating the given amount of radians and store the result in dest.
    rotateXYZ(float angleX, float angleY, float angleZ)
    Apply rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.
    rotateXYZ(float angleX, float angleY, float angleZ, Matrix3f dest)
    Apply rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis and store the result in dest.
    Apply rotation of angles.x radians about the X axis, followed by a rotation of angles.y radians about the Y axis and followed by a rotation of angles.z radians about the Z axis.
    rotateY(float ang)
    Apply rotation about the Y axis to this matrix by rotating the given amount of radians.
    rotateY(float ang, Matrix3f dest)
    Apply rotation about the Y axis to this matrix by rotating the given amount of radians and store the result in dest.
    rotateYXZ(float angleY, float angleX, float angleZ)
    Apply rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.
    rotateYXZ(float angleY, float angleX, float angleZ, Matrix3f dest)
    Apply rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis and store the result in dest.
    Apply rotation of angles.y radians about the Y axis, followed by a rotation of angles.x radians about the X axis and followed by a rotation of angles.z radians about the Z axis.
    rotateZ(float ang)
    Apply rotation about the Z axis to this matrix by rotating the given amount of radians.
    rotateZ(float ang, Matrix3f dest)
    Apply rotation about the Z axis to this matrix by rotating the given amount of radians and store the result in dest.
    rotateZYX(float angleZ, float angleY, float angleX)
    Apply rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.
    rotateZYX(float angleZ, float angleY, float angleX, Matrix3f dest)
    Apply rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis and store the result in dest.
    Apply rotation of angles.z radians about the Z axis, followed by a rotation of angles.y radians about the Y axis and followed by a rotation of angles.x radians about the X axis.
    rotation(float angle, float x, float y, float z)
    Set this matrix to a rotation matrix which rotates the given radians about a given axis.
    rotation(float angle, Vector3fc axis)
    Set this matrix to a rotation matrix which rotates the given radians about a given axis.
    rotation(AxisAngle4f axisAngle)
    Set this matrix to a rotation transformation using the given AxisAngle4f.
    Set this matrix to the rotation - and possibly scaling - transformation of the given Quaternionfc.
    rotationTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
    Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local -z axis with center - eye.
    Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local -z axis with center - eye.
    rotationX(float ang)
    Set this matrix to a rotation transformation about the X axis.
    rotationXYZ(float angleX, float angleY, float angleZ)
    Set this matrix to a rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.
    rotationY(float ang)
    Set this matrix to a rotation transformation about the Y axis.
    rotationYXZ(float angleY, float angleX, float angleZ)
    Set this matrix to a rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.
    rotationZ(float ang)
    Set this matrix to a rotation transformation about the Z axis.
    rotationZYX(float angleZ, float angleY, float angleX)
    Set this matrix to a rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.
    scale(float xyz)
    Apply scaling to this matrix by uniformly scaling all base axes by the given xyz factor.
    scale(float x, float y, float z)
    Apply scaling to this matrix by scaling the base axes by the given x, y and z factors.
    scale(float x, float y, float z, Matrix3f dest)
    Apply scaling to this matrix by scaling the base axes by the given x, y and z factors and store the result in dest.
    scale(float xyz, Matrix3f dest)
    Apply scaling to this matrix by uniformly scaling all base axes by the given xyz factor and store the result in dest.
    Apply scaling to this matrix by scaling the base axes by the given xyz.x, xyz.y and xyz.z factors, respectively.
    scale(Vector3fc xyz, Matrix3f dest)
    Apply scaling to this matrix by scaling the base axes by the given xyz.x, xyz.y and xyz.z factors, respectively and store the result in dest.
    scaleLocal(float x, float y, float z)
    Pre-multiply scaling to this matrix by scaling the base axes by the given x, y and z factors.
    scaleLocal(float x, float y, float z, Matrix3f dest)
    Pre-multiply scaling to this matrix by scaling the base axes by the given x, y and z factors and store the result in dest.
    scaling(float factor)
    Set this matrix to be a simple scale matrix, which scales all axes uniformly by the given factor.
    scaling(float x, float y, float z)
    Set this matrix to be a simple scale matrix.
    Set this matrix to be a simple scale matrix which scales the base axes by xyz.x, xyz.y and xyz.z respectively.
    set(float[] m)
    Set the values in this matrix based on the supplied float array.
    set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
    Set the values within this matrix to the supplied float values.
    set(int column, int row, float value)
    Set the matrix element at the given column and row to the specified value.
    set(int index, ByteBuffer buffer)
    Set the values of this matrix by reading 9 float values from the given ByteBuffer in column-major order, starting at the specified absolute buffer position/index.
    set(int index, FloatBuffer buffer)
    Set the values of this matrix by reading 9 float values from the given FloatBuffer in column-major order, starting at the specified absolute buffer position/index.
    set(ByteBuffer buffer)
    Set the values of this matrix by reading 9 float values from the given ByteBuffer in column-major order, starting at its current position.
    set(FloatBuffer buffer)
    Set the values of this matrix by reading 9 float values from the given FloatBuffer in column-major order, starting at its current position.
    set(AxisAngle4d axisAngle)
    Set this matrix to be equivalent to the rotation specified by the given AxisAngle4d.
    set(AxisAngle4f axisAngle)
    Set this matrix to be equivalent to the rotation specified by the given AxisAngle4f.
    Set the upper left 2x2 submatrix of this Matrix3f to the given Matrix2fc and the rest to identity.
    Set the elements of this matrix to the ones in m.
    Set the elements of this matrix to the upper left 3x3 of the given Matrix4fc.
    Set the elements of this matrix to the left 3x3 submatrix of m.
    Set this matrix to a rotation - and possibly scaling - equivalent to the given quaternion.
    Set this matrix to be equivalent to the rotation - and possibly scaling - specified by the given Quaternionfc.
    set(Vector3fc col0, Vector3fc col1, Vector3fc col2)
    Set the three columns of this matrix to the supplied vectors, respectively.
    setColumn(int column, float x, float y, float z)
    Set the column at the given column index, starting with 0.
    setColumn(int column, Vector3fc src)
    Set the column at the given column index, starting with 0.
    setFromAddress(long address)
    Set the values of this matrix by reading 9 float values from off-heap memory in column-major order, starting at the given address.
    setLookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
    Set this matrix to a rotation transformation to make -z point along dir.
    Set this matrix to a rotation transformation to make -z point along dir.
    setRow(int row, float x, float y, float z)
    Set the row at the given row index, starting with 0.
    setRow(int row, Vector3fc src)
    Set the row at the given row index, starting with 0.
    setRowColumn(int row, int column, float value)
    Set the matrix element at the given row and column to the specified value.
    setSkewSymmetric(float a, float b, float c)
    Set this matrix to a skew-symmetric matrix using the following layout:
    Store the values of the transpose of the given matrix m into this matrix.
    sub(Matrix3fc subtrahend)
    Component-wise subtract subtrahend from this.
    sub(Matrix3fc subtrahend, Matrix3f dest)
    Component-wise subtract subtrahend from this and store the result in dest.
    swap(Matrix3f other)
    Exchange the values of this matrix with the given other matrix.
    Return a string representation of this matrix.
    Return a string representation of this matrix by formatting the matrix elements with the given NumberFormat.
    transform(float x, float y, float z, Vector3f dest)
    Transform the vector (x, y, z) by this matrix and store the result in dest.
    Transform the given vector by this matrix.
    Transform the given vector by this matrix and store the result in dest.
    transformTranspose(float x, float y, float z, Vector3f dest)
    Transform the vector (x, y, z) by the transpose of this matrix and store the result in dest.
    Transform the given vector by the transpose of this matrix.
    Transform the given vector by the transpose of this matrix and store the result in dest.
    Transpose this matrix.
    Transpose this matrix and store the result in dest.
    void
     
    Set all values within this matrix to zero.

    Methods inherited from class java.lang.Object

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

    • m00

      public float m00
    • m01

      public float m01
    • m02

      public float m02
    • m10

      public float m10
    • m11

      public float m11
    • m12

      public float m12
    • m20

      public float m20
    • m21

      public float m21
    • m22

      public float m22
  • Constructor Details

    • Matrix3f

      public Matrix3f()
      Create a new Matrix3f and set it to identity.
    • Matrix3f

      public Matrix3f(Matrix2fc mat)
      Create a new Matrix3f by setting its uppper left 2x2 submatrix to the values of the given Matrix2fc and the rest to identity.
      Parameters:
      mat - the Matrix2fc
    • Matrix3f

      public Matrix3f(Matrix3fc mat)
      Create a new Matrix3f and make it a copy of the given matrix.
      Parameters:
      mat - the Matrix3fc to copy the values from
    • Matrix3f

      public Matrix3f(Matrix4fc mat)
      Create a new Matrix3f and make it a copy of the upper left 3x3 of the given Matrix4fc.
      Parameters:
      mat - the Matrix4fc to copy the values from
    • Matrix3f

      public Matrix3f(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
      Create a new 3x3 matrix using the supplied float values. The order of the parameter is column-major, so the first three parameters specify the three elements of the first column.
      Parameters:
      m00 - the value of m00
      m01 - the value of m01
      m02 - the value of m02
      m10 - the value of m10
      m11 - the value of m11
      m12 - the value of m12
      m20 - the value of m20
      m21 - the value of m21
      m22 - the value of m22
    • Matrix3f

      public Matrix3f(FloatBuffer buffer)
      Create a new Matrix3f by reading its 9 float components from the given FloatBuffer at the buffer's current position.

      That FloatBuffer is expected to hold the values in column-major order.

      The buffer's position will not be changed by this method.

      Parameters:
      buffer - the FloatBuffer to read the matrix values from
    • Matrix3f

      public Matrix3f(Vector3fc col0, Vector3fc col1, Vector3fc col2)
      Create a new Matrix3f and initialize its three columns using the supplied vectors.
      Parameters:
      col0 - the first column
      col1 - the second column
      col2 - the third column
  • Method Details

    • m00

      public float m00()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 0 and row 0.
      Specified by:
      m00 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m01

      public float m01()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 0 and row 1.
      Specified by:
      m01 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m02

      public float m02()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 0 and row 2.
      Specified by:
      m02 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m10

      public float m10()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 1 and row 0.
      Specified by:
      m10 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m11

      public float m11()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 1 and row 1.
      Specified by:
      m11 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m12

      public float m12()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 1 and row 2.
      Specified by:
      m12 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m20

      public float m20()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 2 and row 0.
      Specified by:
      m20 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m21

      public float m21()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 2 and row 1.
      Specified by:
      m21 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m22

      public float m22()
      Description copied from interface: Matrix3fc
      Return the value of the matrix element at column 2 and row 2.
      Specified by:
      m22 in interface Matrix3fc
      Returns:
      the value of the matrix element
    • m00

      public Matrix3f m00(float m00)
      Set the value of the matrix element at column 0 and row 0.
      Parameters:
      m00 - the new value
      Returns:
      this
    • m01

      public Matrix3f m01(float m01)
      Set the value of the matrix element at column 0 and row 1.
      Parameters:
      m01 - the new value
      Returns:
      this
    • m02

      public Matrix3f m02(float m02)
      Set the value of the matrix element at column 0 and row 2.
      Parameters:
      m02 - the new value
      Returns:
      this
    • m10

      public Matrix3f m10(float m10)
      Set the value of the matrix element at column 1 and row 0.
      Parameters:
      m10 - the new value
      Returns:
      this
    • m11

      public Matrix3f m11(float m11)
      Set the value of the matrix element at column 1 and row 1.
      Parameters:
      m11 - the new value
      Returns:
      this
    • m12

      public Matrix3f m12(float m12)
      Set the value of the matrix element at column 1 and row 2.
      Parameters:
      m12 - the new value
      Returns:
      this
    • m20

      public Matrix3f m20(float m20)
      Set the value of the matrix element at column 2 and row 0.
      Parameters:
      m20 - the new value
      Returns:
      this
    • m21

      public Matrix3f m21(float m21)
      Set the value of the matrix element at column 2 and row 1.
      Parameters:
      m21 - the new value
      Returns:
      this
    • m22

      public Matrix3f m22(float m22)
      Set the value of the matrix element at column 2 and row 2.
      Parameters:
      m22 - the new value
      Returns:
      this
    • set

      public Matrix3f set(Matrix3fc m)
      Set the elements of this matrix to the ones in m.
      Parameters:
      m - the matrix to copy the elements from
      Returns:
      this
    • setTransposed

      public Matrix3f setTransposed(Matrix3fc m)
      Store the values of the transpose of the given matrix m into this matrix.
      Parameters:
      m - the matrix to copy the transposed values from
      Returns:
      this
    • set

      public Matrix3f set(Matrix4x3fc m)
      Set the elements of this matrix to the left 3x3 submatrix of m.
      Parameters:
      m - the matrix to copy the elements from
      Returns:
      this
    • set

      public Matrix3f set(Matrix4fc mat)
      Set the elements of this matrix to the upper left 3x3 of the given Matrix4fc.
      Parameters:
      mat - the Matrix4fc to copy the values from
      Returns:
      this
    • set

      public Matrix3f set(Matrix2fc mat)
      Set the upper left 2x2 submatrix of this Matrix3f to the given Matrix2fc and the rest to identity.
      Parameters:
      mat - the Matrix2fc
      Returns:
      this
      See Also:
    • set

      public Matrix3f set(AxisAngle4f axisAngle)
      Set this matrix to be equivalent to the rotation specified by the given AxisAngle4f.
      Parameters:
      axisAngle - the AxisAngle4f
      Returns:
      this
    • set

      public Matrix3f set(AxisAngle4d axisAngle)
      Set this matrix to be equivalent to the rotation specified by the given AxisAngle4d.
      Parameters:
      axisAngle - the AxisAngle4d
      Returns:
      this
    • set

      public Matrix3f set(Quaternionfc q)
      Set this matrix to be equivalent to the rotation - and possibly scaling - specified by the given Quaternionfc.

      This method is equivalent to calling: rotation(q)

      Reference: http://www.euclideanspace.com/

      Parameters:
      q - the Quaternionfc
      Returns:
      this
      See Also:
    • set

      public Matrix3f set(Quaterniondc q)
      Set this matrix to a rotation - and possibly scaling - equivalent to the given quaternion.

      Reference: http://www.euclideanspace.com/

      Parameters:
      q - the quaternion
      Returns:
      this
    • mul

      public Matrix3f mul(Matrix3fc right)
      Multiply this matrix by the supplied right matrix.

      If M is this matrix and R the right matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

      Parameters:
      right - the right operand of the matrix multiplication
      Returns:
      this
    • mul

      public Matrix3f mul(Matrix3fc right, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Multiply this matrix by the supplied right matrix and store the result in dest.

      If M is this matrix and R the right matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

      Specified by:
      mul in interface Matrix3fc
      Parameters:
      right - the right operand of the matrix multiplication
      dest - will hold the result
      Returns:
      dest
    • mulLocal

      public Matrix3f mulLocal(Matrix3fc left)
      Pre-multiply this matrix by the supplied left matrix and store the result in this.

      If M is this matrix and L the left matrix, then the new matrix will be L * M. So when transforming a vector v with the new matrix by using L * M * v, the transformation of this matrix will be applied first!

      Parameters:
      left - the left operand of the matrix multiplication
      Returns:
      this
    • mulLocal

      public Matrix3f mulLocal(Matrix3fc left, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Pre-multiply this matrix by the supplied left matrix and store the result in dest.

      If M is this matrix and L the left matrix, then the new matrix will be L * M. So when transforming a vector v with the new matrix by using L * M * v, the transformation of this matrix will be applied first!

      Specified by:
      mulLocal in interface Matrix3fc
      Parameters:
      left - the left operand of the matrix multiplication
      dest - the destination matrix, which will hold the result
      Returns:
      dest
    • set

      public Matrix3f set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
      Set the values within this matrix to the supplied float values. The result looks like this:

      m00, m10, m20
      m01, m11, m21
      m02, m12, m22

      Parameters:
      m00 - the new value of m00
      m01 - the new value of m01
      m02 - the new value of m02
      m10 - the new value of m10
      m11 - the new value of m11
      m12 - the new value of m12
      m20 - the new value of m20
      m21 - the new value of m21
      m22 - the new value of m22
      Returns:
      this
    • set

      public Matrix3f set(float[] m)
      Set the values in this matrix based on the supplied float array. The result looks like this:

      0, 3, 6
      1, 4, 7
      2, 5, 8
      This method only uses the first 9 values, all others are ignored.

      Parameters:
      m - the array to read the matrix values from
      Returns:
      this
    • set

      public Matrix3f set(Vector3fc col0, Vector3fc col1, Vector3fc col2)
      Set the three columns of this matrix to the supplied vectors, respectively.
      Parameters:
      col0 - the first column
      col1 - the second column
      col2 - the third column
      Returns:
      this
    • determinant

      public float determinant()
      Description copied from interface: Matrix3fc
      Return the determinant of this matrix.
      Specified by:
      determinant in interface Matrix3fc
      Returns:
      the determinant
    • invert

      public Matrix3f invert()
      Invert this matrix.
      Returns:
      this
    • invert

      public Matrix3f invert(Matrix3f dest)
      Description copied from interface: Matrix3fc
      Invert the this matrix and store the result in dest.
      Specified by:
      invert in interface Matrix3fc
      Parameters:
      dest - will hold the result
      Returns:
      dest
    • transpose

      public Matrix3f transpose()
      Transpose this matrix.
      Returns:
      this
    • transpose

      public Matrix3f transpose(Matrix3f dest)
      Description copied from interface: Matrix3fc
      Transpose this matrix and store the result in dest.
      Specified by:
      transpose in interface Matrix3fc
      Parameters:
      dest - will hold the result
      Returns:
      dest
    • toString

      public String toString()
      Return a string representation of this matrix.

      This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".

      Overrides:
      toString in class Object
      Returns:
      the string representation
    • toString

      public String toString(NumberFormat formatter)
      Return a string representation of this matrix by formatting the matrix elements with the given NumberFormat.
      Parameters:
      formatter - the NumberFormat used to format the matrix values with
      Returns:
      the string representation
    • get

      public Matrix3f get(Matrix3f dest)
      Get the current values of this matrix and store them into dest.

      This is the reverse method of set(Matrix3fc) and allows to obtain intermediate calculation results when chaining multiple transformations.

      Specified by:
      get in interface Matrix3fc
      Parameters:
      dest - the destination matrix
      Returns:
      the passed in destination
      See Also:
    • get

      public Matrix4f get(Matrix4f dest)
      Description copied from interface: Matrix3fc
      Get the current values of this matrix and store them as the rotational component of dest. All other values of dest will be set to identity.
      Specified by:
      get in interface Matrix3fc
      Parameters:
      dest - the destination matrix
      Returns:
      the passed in destination
      See Also:
    • getRotation

      public AxisAngle4f getRotation(AxisAngle4f dest)
      Description copied from interface: Matrix3fc
      Get the current values of this matrix and store the represented rotation into the given AxisAngle4f.
      Specified by:
      getRotation in interface Matrix3fc
      Parameters:
      dest - the destination AxisAngle4f
      Returns:
      the passed in destination
      See Also:
    • getUnnormalizedRotation

      public Quaternionf getUnnormalizedRotation(Quaternionf dest)
      Description copied from interface: Matrix3fc
      Get the current values of this matrix and store the represented rotation into the given Quaternionf.

      This method assumes that the three column vectors of this matrix are not normalized and thus allows to ignore any additional scaling factor that is applied to the matrix.

      Specified by:
      getUnnormalizedRotation in interface Matrix3fc
      Parameters:
      dest - the destination Quaternionf
      Returns:
      the passed in destination
      See Also:
    • getNormalizedRotation

      public Quaternionf getNormalizedRotation(Quaternionf dest)
      Description copied from interface: Matrix3fc
      Get the current values of this matrix and store the represented rotation into the given Quaternionf.

      This method assumes that the three column vectors of this matrix are normalized.

      Specified by:
      getNormalizedRotation in interface Matrix3fc
      Parameters:
      dest - the destination Quaternionf
      Returns:
      the passed in destination
      See Also:
    • getUnnormalizedRotation

      public Quaterniond getUnnormalizedRotation(Quaterniond dest)
      Description copied from interface: Matrix3fc
      Get the current values of this matrix and store the represented rotation into the given Quaterniond.

      This method assumes that the three column vectors of this matrix are not normalized and thus allows to ignore any additional scaling factor that is applied to the matrix.

      Specified by:
      getUnnormalizedRotation in interface Matrix3fc
      Parameters:
      dest - the destination Quaterniond
      Returns:
      the passed in destination
      See Also:
    • getNormalizedRotation

      public Quaterniond getNormalizedRotation(Quaterniond dest)
      Description copied from interface: Matrix3fc
      Get the current values of this matrix and store the represented rotation into the given Quaterniond.

      This method assumes that the three column vectors of this matrix are normalized.

      Specified by:
      getNormalizedRotation in interface Matrix3fc
      Parameters:
      dest - the destination Quaterniond
      Returns:
      the passed in destination
      See Also:
    • get

      public FloatBuffer get(FloatBuffer buffer)
      Description copied from interface: Matrix3fc
      Store this matrix in column-major order into the supplied FloatBuffer at the current buffer position.

      This method will not increment the position of the given FloatBuffer.

      In order to specify the offset into the FloatBuffer at which the matrix is stored, use Matrix3fc.get(int, FloatBuffer), taking the absolute position as parameter.

      Specified by:
      get in interface Matrix3fc
      Parameters:
      buffer - will receive the values of this matrix in column-major order at its current position
      Returns:
      the passed in buffer
      See Also:
    • get

      public FloatBuffer get(int index, FloatBuffer buffer)
      Description copied from interface: Matrix3fc
      Store this matrix in column-major order into the supplied FloatBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given FloatBuffer.

      Specified by:
      get in interface Matrix3fc
      Parameters:
      index - the absolute position into the FloatBuffer
      buffer - will receive the values of this matrix in column-major order
      Returns:
      the passed in buffer
    • get

      public ByteBuffer get(ByteBuffer buffer)
      Description copied from interface: Matrix3fc
      Store this matrix in column-major order into the supplied ByteBuffer at the current buffer position.

      This method will not increment the position of the given ByteBuffer.

      In order to specify the offset into the ByteBuffer at which the matrix is stored, use Matrix3fc.get(int, ByteBuffer), taking the absolute position as parameter.

      Specified by:
      get in interface Matrix3fc
      Parameters:
      buffer - will receive the values of this matrix in column-major order at its current position
      Returns:
      the passed in buffer
      See Also:
    • get

      public ByteBuffer get(int index, ByteBuffer buffer)
      Description copied from interface: Matrix3fc
      Store this matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given ByteBuffer.

      Specified by:
      get in interface Matrix3fc
      Parameters:
      index - the absolute position into the ByteBuffer
      buffer - will receive the values of this matrix in column-major order
      Returns:
      the passed in buffer
    • get3x4

      public FloatBuffer get3x4(FloatBuffer buffer)
      Description copied from interface: Matrix3fc
      Store this matrix as 3x4 matrix in column-major order into the supplied FloatBuffer at the current buffer position, with the m03, m13 and m23 components being zero.

      This method will not increment the position of the given FloatBuffer.

      In order to specify the offset into the FloatBuffer at which the matrix is stored, use Matrix3fc.get3x4(int, FloatBuffer), taking the absolute position as parameter.

      Specified by:
      get3x4 in interface Matrix3fc
      Parameters:
      buffer - will receive the values of this 3x3 matrix as 3x4 matrix in column-major order at its current position
      Returns:
      the passed in buffer
      See Also:
    • get3x4

      public FloatBuffer get3x4(int index, FloatBuffer buffer)
      Description copied from interface: Matrix3fc
      Store this matrix as 3x4 matrix in column-major order into the supplied FloatBuffer starting at the specified absolute buffer position/index, with the m03, m13 and m23 components being zero.

      This method will not increment the position of the given FloatBuffer.

      Specified by:
      get3x4 in interface Matrix3fc
      Parameters:
      index - the absolute position into the FloatBuffer
      buffer - will receive the values of this 3x3 matrix as 3x4 matrix in column-major order
      Returns:
      the passed in buffer
    • get3x4

      public ByteBuffer get3x4(ByteBuffer buffer)
      Description copied from interface: Matrix3fc
      Store this matrix as 3x4 matrix in column-major order into the supplied ByteBuffer at the current buffer position, with the m03, m13 and m23 components being zero.

      This method will not increment the position of the given ByteBuffer.

      In order to specify the offset into the ByteBuffer at which the matrix is stored, use Matrix3fc.get3x4(int, ByteBuffer), taking the absolute position as parameter.

      Specified by:
      get3x4 in interface Matrix3fc
      Parameters:
      buffer - will receive the values of this 3x3 matrix as 3x4 matrix in column-major order at its current position
      Returns:
      the passed in buffer
      See Also:
    • get3x4

      public ByteBuffer get3x4(int index, ByteBuffer buffer)
      Description copied from interface: Matrix3fc
      Store this matrix as 3x4 matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index, with the m03, m13 and m23 components being zero.

      This method will not increment the position of the given ByteBuffer.

      Specified by:
      get3x4 in interface Matrix3fc
      Parameters:
      index - the absolute position into the ByteBuffer
      buffer - will receive the values of this 3x3 matrix as 3x4 matrix in column-major order
      Returns:
      the passed in buffer
    • getTransposed

      public FloatBuffer getTransposed(FloatBuffer buffer)
      Description copied from interface: Matrix3fc
      Store the transpose of this matrix in column-major order into the supplied FloatBuffer at the current buffer position.

      This method will not increment the position of the given FloatBuffer.

      In order to specify the offset into the FloatBuffer at which the matrix is stored, use Matrix3fc.getTransposed(int, FloatBuffer), taking the absolute position as parameter.

      Specified by:
      getTransposed in interface Matrix3fc
      Parameters:
      buffer - will receive the values of this matrix in column-major order at its current position
      Returns:
      the passed in buffer
      See Also:
    • getTransposed

      public FloatBuffer getTransposed(int index, FloatBuffer buffer)
      Description copied from interface: Matrix3fc
      Store the transpose of this matrix in column-major order into the supplied FloatBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given FloatBuffer.

      Specified by:
      getTransposed in interface Matrix3fc
      Parameters:
      index - the absolute position into the FloatBuffer
      buffer - will receive the values of this matrix in column-major order
      Returns:
      the passed in buffer
    • getTransposed

      public ByteBuffer getTransposed(ByteBuffer buffer)
      Description copied from interface: Matrix3fc
      Store the transpose of this matrix in column-major order into the supplied ByteBuffer at the current buffer position.

      This method will not increment the position of the given ByteBuffer.

      In order to specify the offset into the ByteBuffer at which the matrix is stored, use Matrix3fc.getTransposed(int, ByteBuffer), taking the absolute position as parameter.

      Specified by:
      getTransposed in interface Matrix3fc
      Parameters:
      buffer - will receive the values of this matrix in column-major order at its current position
      Returns:
      the passed in buffer
      See Also:
    • getTransposed

      public ByteBuffer getTransposed(int index, ByteBuffer buffer)
      Description copied from interface: Matrix3fc
      Store the transpose of this matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.

      This method will not increment the position of the given ByteBuffer.

      Specified by:
      getTransposed in interface Matrix3fc
      Parameters:
      index - the absolute position into the ByteBuffer
      buffer - will receive the values of this matrix in column-major order
      Returns:
      the passed in buffer
    • getToAddress

      public Matrix3fc getToAddress(long address)
      Description copied from interface: Matrix3fc
      Store this matrix in column-major order at the given off-heap address.

      This method will throw an UnsupportedOperationException when JOML is used with `-Djoml.nounsafe`.

      This method is unsafe as it can result in a crash of the JVM process when the specified address range does not belong to this process.

      Specified by:
      getToAddress in interface Matrix3fc
      Parameters:
      address - the off-heap address where to store this matrix
      Returns:
      this
    • get

      public float[] get(float[] arr, int offset)
      Description copied from interface: Matrix3fc
      Store this matrix into the supplied float array in column-major order at the given offset.
      Specified by:
      get in interface Matrix3fc
      Parameters:
      arr - the array to write the matrix values into
      offset - the offset into the array
      Returns:
      the passed in array
    • get

      public float[] get(float[] arr)
      Description copied from interface: Matrix3fc
      Store this matrix into the supplied float array in column-major order.

      In order to specify an explicit offset into the array, use the method Matrix3fc.get(float[], int).

      Specified by:
      get in interface Matrix3fc
      Parameters:
      arr - the array to write the matrix values into
      Returns:
      the passed in array
      See Also:
    • set

      public Matrix3f set(FloatBuffer buffer)
      Set the values of this matrix by reading 9 float values from the given FloatBuffer in column-major order, starting at its current position.

      The FloatBuffer is expected to contain the values in column-major order.

      The position of the FloatBuffer will not be changed by this method.

      Parameters:
      buffer - the FloatBuffer to read the matrix values from in column-major order
      Returns:
      this
    • set

      public Matrix3f set(ByteBuffer buffer)
      Set the values of this matrix by reading 9 float values from the given ByteBuffer in column-major order, starting at its current position.

      The ByteBuffer is expected to contain the values in column-major order.

      The position of the ByteBuffer will not be changed by this method.

      Parameters:
      buffer - the ByteBuffer to read the matrix values from in column-major order
      Returns:
      this
    • set

      public Matrix3f set(int index, FloatBuffer buffer)
      Set the values of this matrix by reading 9 float values from the given FloatBuffer in column-major order, starting at the specified absolute buffer position/index.

      The FloatBuffer is expected to contain the values in column-major order.

      The position of the FloatBuffer will not be changed by this method.

      Parameters:
      index - the absolute position into the FloatBuffer
      buffer - the FloatBuffer to read the matrix values from in column-major order
      Returns:
      this
    • set

      public Matrix3f set(int index, ByteBuffer buffer)
      Set the values of this matrix by reading 9 float values from the given ByteBuffer in column-major order, starting at the specified absolute buffer position/index.

      The ByteBuffer is expected to contain the values in column-major order.

      The position of the ByteBuffer will not be changed by this method.

      Parameters:
      index - the absolute position into the ByteBuffer
      buffer - the ByteBuffer to read the matrix values from in column-major order
      Returns:
      this
    • setFromAddress

      public Matrix3f setFromAddress(long address)
      Set the values of this matrix by reading 9 float values from off-heap memory in column-major order, starting at the given address.

      This method will throw an UnsupportedOperationException when JOML is used with `-Djoml.nounsafe`.

      This method is unsafe as it can result in a crash of the JVM process when the specified address range does not belong to this process.

      Parameters:
      address - the off-heap memory address to read the matrix values from in column-major order
      Returns:
      this
    • zero

      public Matrix3f zero()
      Set all values within this matrix to zero.
      Returns:
      this
    • identity

      public Matrix3f identity()
      Set this matrix to the identity.
      Returns:
      this
    • scale

      public Matrix3f scale(Vector3fc xyz, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply scaling to this matrix by scaling the base axes by the given xyz.x, xyz.y and xyz.z factors, respectively and store the result in dest.

      If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v , the scaling will be applied first!

      Specified by:
      scale in interface Matrix3fc
      Parameters:
      xyz - the factors of the x, y and z component, respectively
      dest - will hold the result
      Returns:
      dest
    • scale

      public Matrix3f scale(Vector3fc xyz)
      Apply scaling to this matrix by scaling the base axes by the given xyz.x, xyz.y and xyz.z factors, respectively.

      If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

      Parameters:
      xyz - the factors of the x, y and z component, respectively
      Returns:
      this
    • scale

      public Matrix3f scale(float x, float y, float z, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply scaling to this matrix by scaling the base axes by the given x, y and z factors and store the result in dest.

      If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v , the scaling will be applied first!

      Specified by:
      scale in interface Matrix3fc
      Parameters:
      x - the factor of the x component
      y - the factor of the y component
      z - the factor of the z component
      dest - will hold the result
      Returns:
      dest
    • scale

      public Matrix3f scale(float x, float y, float z)
      Apply scaling to this matrix by scaling the base axes by the given x, y and z factors.

      If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v , the scaling will be applied first!

      Parameters:
      x - the factor of the x component
      y - the factor of the y component
      z - the factor of the z component
      Returns:
      this
    • scale

      public Matrix3f scale(float xyz, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply scaling to this matrix by uniformly scaling all base axes by the given xyz factor and store the result in dest.

      If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v , the scaling will be applied first!

      Specified by:
      scale in interface Matrix3fc
      Parameters:
      xyz - the factor for all components
      dest - will hold the result
      Returns:
      dest
      See Also:
    • scale

      public Matrix3f scale(float xyz)
      Apply scaling to this matrix by uniformly scaling all base axes by the given xyz factor.

      If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v , the scaling will be applied first!

      Parameters:
      xyz - the factor for all components
      Returns:
      this
      See Also:
    • scaleLocal

      public Matrix3f scaleLocal(float x, float y, float z, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Pre-multiply scaling to this matrix by scaling the base axes by the given x, y and z factors and store the result in dest.

      If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v , the scaling will be applied last!

      Specified by:
      scaleLocal in interface Matrix3fc
      Parameters:
      x - the factor of the x component
      y - the factor of the y component
      z - the factor of the z component
      dest - will hold the result
      Returns:
      dest
    • scaleLocal

      public Matrix3f scaleLocal(float x, float y, float z)
      Pre-multiply scaling to this matrix by scaling the base axes by the given x, y and z factors.

      If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

      Parameters:
      x - the factor of the x component
      y - the factor of the y component
      z - the factor of the z component
      Returns:
      this
    • scaling

      public Matrix3f scaling(float factor)
      Set this matrix to be a simple scale matrix, which scales all axes uniformly by the given factor.

      The resulting matrix can be multiplied against another transformation matrix to obtain an additional scaling.

      In order to post-multiply a scaling transformation directly to a matrix, use scale() instead.

      Parameters:
      factor - the scale factor in x, y and z
      Returns:
      this
      See Also:
    • scaling

      public Matrix3f scaling(float x, float y, float z)
      Set this matrix to be a simple scale matrix.
      Parameters:
      x - the scale in x
      y - the scale in y
      z - the scale in z
      Returns:
      this
    • scaling

      public Matrix3f scaling(Vector3fc xyz)
      Set this matrix to be a simple scale matrix which scales the base axes by xyz.x, xyz.y and xyz.z respectively.

      The resulting matrix can be multiplied against another transformation matrix to obtain an additional scaling.

      In order to post-multiply a scaling transformation directly to a matrix use scale() instead.

      Parameters:
      xyz - the scale in x, y and z respectively
      Returns:
      this
      See Also:
    • rotation

      public Matrix3f rotation(float angle, Vector3fc axis)
      Set this matrix to a rotation matrix which rotates the given radians about a given axis.

      The axis described by the axis vector needs to be a unit vector.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.

      In order to post-multiply a rotation transformation directly to a matrix, use rotate() instead.

      Parameters:
      angle - the angle in radians
      axis - the axis to rotate about (needs to be normalized)
      Returns:
      this
      See Also:
    • rotation

      public Matrix3f rotation(AxisAngle4f axisAngle)
      Set this matrix to a rotation transformation using the given AxisAngle4f.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.

      In order to apply the rotation transformation to an existing transformation, use rotate() instead.

      Reference: http://en.wikipedia.org

      Parameters:
      axisAngle - the AxisAngle4f (needs to be normalized)
      Returns:
      this
      See Also:
    • rotation

      public Matrix3f rotation(float angle, float x, float y, float z)
      Set this matrix to a rotation matrix which rotates the given radians about a given axis.

      The axis described by the three components needs to be a unit vector.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.

      In order to apply the rotation transformation to an existing transformation, use rotate() instead.

      Reference: http://en.wikipedia.org

      Parameters:
      angle - the angle in radians
      x - the x-component of the rotation axis
      y - the y-component of the rotation axis
      z - the z-component of the rotation axis
      Returns:
      this
      See Also:
    • rotationX

      public Matrix3f rotationX(float ang)
      Set this matrix to a rotation transformation about the X axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians
      Returns:
      this
    • rotationY

      public Matrix3f rotationY(float ang)
      Set this matrix to a rotation transformation about the Y axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians
      Returns:
      this
    • rotationZ

      public Matrix3f rotationZ(float ang)
      Set this matrix to a rotation transformation about the Z axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians
      Returns:
      this
    • rotationXYZ

      public Matrix3f rotationXYZ(float angleX, float angleY, float angleZ)
      Set this matrix to a rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      This method is equivalent to calling: rotationX(angleX).rotateY(angleY).rotateZ(angleZ)

      Parameters:
      angleX - the angle to rotate about X
      angleY - the angle to rotate about Y
      angleZ - the angle to rotate about Z
      Returns:
      this
    • rotationZYX

      public Matrix3f rotationZYX(float angleZ, float angleY, float angleX)
      Set this matrix to a rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      This method is equivalent to calling: rotationZ(angleZ).rotateY(angleY).rotateX(angleX)

      Parameters:
      angleZ - the angle to rotate about Z
      angleY - the angle to rotate about Y
      angleX - the angle to rotate about X
      Returns:
      this
    • rotationYXZ

      public Matrix3f rotationYXZ(float angleY, float angleX, float angleZ)
      Set this matrix to a rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      This method is equivalent to calling: rotationY(angleY).rotateX(angleX).rotateZ(angleZ)

      Parameters:
      angleY - the angle to rotate about Y
      angleX - the angle to rotate about X
      angleZ - the angle to rotate about Z
      Returns:
      this
    • rotation

      public Matrix3f rotation(Quaternionfc quat)
      Set this matrix to the rotation - and possibly scaling - transformation of the given Quaternionfc.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.

      In order to apply the rotation transformation to an existing transformation, use rotate() instead.

      Reference: http://en.wikipedia.org

      Parameters:
      quat - the Quaternionfc
      Returns:
      this
      See Also:
    • transform

      public Vector3f transform(Vector3f v)
      Description copied from interface: Matrix3fc
      Transform the given vector by this matrix.
      Specified by:
      transform in interface Matrix3fc
      Parameters:
      v - the vector to transform
      Returns:
      v
    • transform

      public Vector3f transform(Vector3fc v, Vector3f dest)
      Description copied from interface: Matrix3fc
      Transform the given vector by this matrix and store the result in dest.
      Specified by:
      transform in interface Matrix3fc
      Parameters:
      v - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transform

      public Vector3f transform(float x, float y, float z, Vector3f dest)
      Description copied from interface: Matrix3fc
      Transform the vector (x, y, z) by this matrix and store the result in dest.
      Specified by:
      transform in interface Matrix3fc
      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformTranspose

      public Vector3f transformTranspose(Vector3f v)
      Description copied from interface: Matrix3fc
      Transform the given vector by the transpose of this matrix.
      Specified by:
      transformTranspose in interface Matrix3fc
      Parameters:
      v - the vector to transform
      Returns:
      v
    • transformTranspose

      public Vector3f transformTranspose(Vector3fc v, Vector3f dest)
      Description copied from interface: Matrix3fc
      Transform the given vector by the transpose of this matrix and store the result in dest.
      Specified by:
      transformTranspose in interface Matrix3fc
      Parameters:
      v - the vector to transform
      dest - will hold the result
      Returns:
      dest
    • transformTranspose

      public Vector3f transformTranspose(float x, float y, float z, Vector3f dest)
      Description copied from interface: Matrix3fc
      Transform the vector (x, y, z) by the transpose of this matrix and store the result in dest.
      Specified by:
      transformTranspose in interface Matrix3fc
      Parameters:
      x - the x coordinate of the vector to transform
      y - the y coordinate of the vector to transform
      z - the z coordinate of the vector to transform
      dest - will hold the result
      Returns:
      dest
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
    • rotateX

      public Matrix3f rotateX(float ang, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply rotation about the X axis to this matrix by rotating the given amount of radians and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

      Reference: http://en.wikipedia.org

      Specified by:
      rotateX in interface Matrix3fc
      Parameters:
      ang - the angle in radians
      dest - will hold the result
      Returns:
      dest
    • rotateX

      public Matrix3f rotateX(float ang)
      Apply rotation about the X axis to this matrix by rotating the given amount of radians.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians
      Returns:
      this
    • rotateY

      public Matrix3f rotateY(float ang, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply rotation about the Y axis to this matrix by rotating the given amount of radians and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

      Reference: http://en.wikipedia.org

      Specified by:
      rotateY in interface Matrix3fc
      Parameters:
      ang - the angle in radians
      dest - will hold the result
      Returns:
      dest
    • rotateY

      public Matrix3f rotateY(float ang)
      Apply rotation about the Y axis to this matrix by rotating the given amount of radians.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians
      Returns:
      this
    • rotateZ

      public Matrix3f rotateZ(float ang, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply rotation about the Z axis to this matrix by rotating the given amount of radians and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

      Reference: http://en.wikipedia.org

      Specified by:
      rotateZ in interface Matrix3fc
      Parameters:
      ang - the angle in radians
      dest - will hold the result
      Returns:
      dest
    • rotateZ

      public Matrix3f rotateZ(float ang)
      Apply rotation about the Z axis to this matrix by rotating the given amount of radians.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians
      Returns:
      this
    • rotateXYZ

      public Matrix3f rotateXYZ(Vector3f angles)
      Apply rotation of angles.x radians about the X axis, followed by a rotation of angles.y radians about the Y axis and followed by a rotation of angles.z radians about the Z axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)

      Parameters:
      angles - the Euler angles
      Returns:
      this
    • rotateXYZ

      public Matrix3f rotateXYZ(float angleX, float angleY, float angleZ)
      Apply rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateX(angleX).rotateY(angleY).rotateZ(angleZ)

      Parameters:
      angleX - the angle to rotate about X
      angleY - the angle to rotate about Y
      angleZ - the angle to rotate about Z
      Returns:
      this
    • rotateXYZ

      public Matrix3f rotateXYZ(float angleX, float angleY, float angleZ, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply rotation of angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateX(angleX, dest).rotateY(angleY).rotateZ(angleZ)

      Specified by:
      rotateXYZ in interface Matrix3fc
      Parameters:
      angleX - the angle to rotate about X
      angleY - the angle to rotate about Y
      angleZ - the angle to rotate about Z
      dest - will hold the result
      Returns:
      dest
    • rotateZYX

      public Matrix3f rotateZYX(Vector3f angles)
      Apply rotation of angles.z radians about the Z axis, followed by a rotation of angles.y radians about the Y axis and followed by a rotation of angles.x radians about the X axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateZ(angles.z).rotateY(angles.y).rotateX(angles.x)

      Parameters:
      angles - the Euler angles
      Returns:
      this
    • rotateZYX

      public Matrix3f rotateZYX(float angleZ, float angleY, float angleX)
      Apply rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateZ(angleZ).rotateY(angleY).rotateX(angleX)

      Parameters:
      angleZ - the angle to rotate about Z
      angleY - the angle to rotate about Y
      angleX - the angle to rotate about X
      Returns:
      this
    • rotateZYX

      public Matrix3f rotateZYX(float angleZ, float angleY, float angleX, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply rotation of angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateZ(angleZ, dest).rotateY(angleY).rotateX(angleX)

      Specified by:
      rotateZYX in interface Matrix3fc
      Parameters:
      angleZ - the angle to rotate about Z
      angleY - the angle to rotate about Y
      angleX - the angle to rotate about X
      dest - will hold the result
      Returns:
      dest
    • rotateYXZ

      public Matrix3f rotateYXZ(Vector3f angles)
      Apply rotation of angles.y radians about the Y axis, followed by a rotation of angles.x radians about the X axis and followed by a rotation of angles.z radians about the Z axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)

      Parameters:
      angles - the Euler angles
      Returns:
      this
    • rotateYXZ

      public Matrix3f rotateYXZ(float angleY, float angleX, float angleZ)
      Apply rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateY(angleY).rotateX(angleX).rotateZ(angleZ)

      Parameters:
      angleY - the angle to rotate about Y
      angleX - the angle to rotate about X
      angleZ - the angle to rotate about Z
      Returns:
      this
    • rotateYXZ

      public Matrix3f rotateYXZ(float angleY, float angleX, float angleZ, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply rotation of angleY radians about the Y axis, followed by a rotation of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

      This method is equivalent to calling: rotateY(angleY, dest).rotateX(angleX).rotateZ(angleZ)

      Specified by:
      rotateYXZ in interface Matrix3fc
      Parameters:
      angleY - the angle to rotate about Y
      angleX - the angle to rotate about X
      angleZ - the angle to rotate about Z
      dest - will hold the result
      Returns:
      dest
    • rotate

      public Matrix3f rotate(float ang, float x, float y, float z)
      Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components.

      The axis described by the three components needs to be a unit vector.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians
      x - the x component of the axis
      y - the y component of the axis
      z - the z component of the axis
      Returns:
      this
    • rotate

      public Matrix3f rotate(float ang, float x, float y, float z, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components, and store the result in dest.

      The axis described by the three components needs to be a unit vector.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

      Reference: http://en.wikipedia.org

      Specified by:
      rotate in interface Matrix3fc
      Parameters:
      ang - the angle in radians
      x - the x component of the axis
      y - the y component of the axis
      z - the z component of the axis
      dest - will hold the result
      Returns:
      dest
    • rotateLocal

      public Matrix3f rotateLocal(float ang, float x, float y, float z, Matrix3f dest)
      Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified (x, y, z) axis and store the result in dest.

      The axis described by the three components needs to be a unit vector.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

      In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotation().

      Reference: http://en.wikipedia.org

      Specified by:
      rotateLocal in interface Matrix3fc
      Parameters:
      ang - the angle in radians
      x - the x component of the axis
      y - the y component of the axis
      z - the z component of the axis
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotateLocal

      public Matrix3f rotateLocal(float ang, float x, float y, float z)
      Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified (x, y, z) axis.

      The axis described by the three components needs to be a unit vector.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

      In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotation().

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians
      x - the x component of the axis
      y - the y component of the axis
      z - the z component of the axis
      Returns:
      this
      See Also:
    • rotateLocalX

      public Matrix3f rotateLocalX(float ang, Matrix3f dest)
      Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

      In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotationX().

      Reference: http://en.wikipedia.org

      Specified by:
      rotateLocalX in interface Matrix3fc
      Parameters:
      ang - the angle in radians to rotate about the X axis
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotateLocalX

      public Matrix3f rotateLocalX(float ang)
      Pre-multiply a rotation to this matrix by rotating the given amount of radians about the X axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

      In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotationX().

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians to rotate about the X axis
      Returns:
      this
      See Also:
    • rotateLocalY

      public Matrix3f rotateLocalY(float ang, Matrix3f dest)
      Pre-multiply a rotation around the Y axis to this matrix by rotating the given amount of radians about the Y axis and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

      In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotationY().

      Reference: http://en.wikipedia.org

      Specified by:
      rotateLocalY in interface Matrix3fc
      Parameters:
      ang - the angle in radians to rotate about the Y axis
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotateLocalY

      public Matrix3f rotateLocalY(float ang)
      Pre-multiply a rotation to this matrix by rotating the given amount of radians about the Y axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

      In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotationY().

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians to rotate about the Y axis
      Returns:
      this
      See Also:
    • rotateLocalZ

      public Matrix3f rotateLocalZ(float ang, Matrix3f dest)
      Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

      In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotationZ().

      Reference: http://en.wikipedia.org

      Specified by:
      rotateLocalZ in interface Matrix3fc
      Parameters:
      ang - the angle in radians to rotate about the Z axis
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotateLocalZ

      public Matrix3f rotateLocalZ(float ang)
      Pre-multiply a rotation to this matrix by rotating the given amount of radians about the Z axis.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

      In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotationY().

      Reference: http://en.wikipedia.org

      Parameters:
      ang - the angle in radians to rotate about the Z axis
      Returns:
      this
      See Also:
    • rotate

      public Matrix3f rotate(Quaternionfc quat)
      Apply the rotation - and possibly scaling - transformation of the given Quaternionfc to this matrix.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and Q the rotation matrix obtained from the given quaternion, then the new matrix will be M * Q. So when transforming a vector v with the new matrix by using M * Q * v, the quaternion rotation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying, use rotation(Quaternionfc).

      Reference: http://en.wikipedia.org

      Parameters:
      quat - the Quaternionfc
      Returns:
      this
      See Also:
    • rotate

      public Matrix3f rotate(Quaternionfc quat, Matrix3f dest)
      Apply the rotation - and possibly scaling - transformation of the given Quaternionfc to this matrix and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and Q the rotation matrix obtained from the given quaternion, then the new matrix will be M * Q. So when transforming a vector v with the new matrix by using M * Q * v, the quaternion rotation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying, use rotation(Quaternionfc).

      Reference: http://en.wikipedia.org

      Specified by:
      rotate in interface Matrix3fc
      Parameters:
      quat - the Quaternionfc
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotateLocal

      public Matrix3f rotateLocal(Quaternionfc quat, Matrix3f dest)
      Pre-multiply the rotation - and possibly scaling - transformation of the given Quaternionfc to this matrix and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and Q the rotation matrix obtained from the given quaternion, then the new matrix will be Q * M. So when transforming a vector v with the new matrix by using Q * M * v, the quaternion rotation will be applied last!

      In order to set the matrix to a rotation transformation without pre-multiplying, use rotation(Quaternionfc).

      Reference: http://en.wikipedia.org

      Specified by:
      rotateLocal in interface Matrix3fc
      Parameters:
      quat - the Quaternionfc
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotateLocal

      public Matrix3f rotateLocal(Quaternionfc quat)
      Pre-multiply the rotation - and possibly scaling - transformation of the given Quaternionfc to this matrix.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and Q the rotation matrix obtained from the given quaternion, then the new matrix will be Q * M. So when transforming a vector v with the new matrix by using Q * M * v, the quaternion rotation will be applied last!

      In order to set the matrix to a rotation transformation without pre-multiplying, use rotation(Quaternionfc).

      Reference: http://en.wikipedia.org

      Parameters:
      quat - the Quaternionfc
      Returns:
      this
      See Also:
    • rotate

      public Matrix3f rotate(AxisAngle4f axisAngle)
      Apply a rotation transformation, rotating about the given AxisAngle4f, to this matrix.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and A the rotation matrix obtained from the given AxisAngle4f, then the new matrix will be M * A. So when transforming a vector v with the new matrix by using M * A * v, the AxisAngle4f rotation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying, use rotation(AxisAngle4f).

      Reference: http://en.wikipedia.org

      Parameters:
      axisAngle - the AxisAngle4f (needs to be normalized)
      Returns:
      this
      See Also:
    • rotate

      public Matrix3f rotate(AxisAngle4f axisAngle, Matrix3f dest)
      Apply a rotation transformation, rotating about the given AxisAngle4f and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and A the rotation matrix obtained from the given AxisAngle4f, then the new matrix will be M * A. So when transforming a vector v with the new matrix by using M * A * v, the AxisAngle4f rotation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying, use rotation(AxisAngle4f).

      Reference: http://en.wikipedia.org

      Specified by:
      rotate in interface Matrix3fc
      Parameters:
      axisAngle - the AxisAngle4f (needs to be normalized)
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotate

      public Matrix3f rotate(float angle, Vector3fc axis)
      Apply a rotation transformation, rotating the given radians about the specified axis, to this matrix.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and A the rotation matrix obtained from the given angle and axis, then the new matrix will be M * A. So when transforming a vector v with the new matrix by using M * A * v, the axis-angle rotation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying, use rotation(float, Vector3fc).

      Reference: http://en.wikipedia.org

      Parameters:
      angle - the angle in radians
      axis - the rotation axis (needs to be normalized)
      Returns:
      this
      See Also:
    • rotate

      public Matrix3f rotate(float angle, Vector3fc axis, Matrix3f dest)
      Apply a rotation transformation, rotating the given radians about the specified axis and store the result in dest.

      When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.

      If M is this matrix and A the rotation matrix obtained from the given angle and axis, then the new matrix will be M * A. So when transforming a vector v with the new matrix by using M * A * v, the axis-angle rotation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying, use rotation(float, Vector3fc).

      Reference: http://en.wikipedia.org

      Specified by:
      rotate in interface Matrix3fc
      Parameters:
      angle - the angle in radians
      axis - the rotation axis (needs to be normalized)
      dest - will hold the result
      Returns:
      dest
      See Also:
    • lookAlong

      public Matrix3f lookAlong(Vector3fc dir, Vector3fc up)
      Apply a rotation transformation to this matrix to make -z point along dir.

      If M is this matrix and L the lookalong rotation matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookalong rotation transformation will be applied first!

      In order to set the matrix to a lookalong transformation without post-multiplying it, use setLookAlong().

      Parameters:
      dir - the direction in space to look along
      up - the direction of 'up'
      Returns:
      this
      See Also:
    • lookAlong

      public Matrix3f lookAlong(Vector3fc dir, Vector3fc up, Matrix3f dest)
      Apply a rotation transformation to this matrix to make -z point along dir and store the result in dest.

      If M is this matrix and L the lookalong rotation matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookalong rotation transformation will be applied first!

      In order to set the matrix to a lookalong transformation without post-multiplying it, use setLookAlong().

      Specified by:
      lookAlong in interface Matrix3fc
      Parameters:
      dir - the direction in space to look along
      up - the direction of 'up'
      dest - will hold the result
      Returns:
      dest
      See Also:
    • lookAlong

      public Matrix3f lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix3f dest)
      Apply a rotation transformation to this matrix to make -z point along dir and store the result in dest.

      If M is this matrix and L the lookalong rotation matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookalong rotation transformation will be applied first!

      In order to set the matrix to a lookalong transformation without post-multiplying it, use setLookAlong()

      Specified by:
      lookAlong in interface Matrix3fc
      Parameters:
      dirX - the x-coordinate of the direction to look along
      dirY - the y-coordinate of the direction to look along
      dirZ - the z-coordinate of the direction to look along
      upX - the x-coordinate of the up vector
      upY - the y-coordinate of the up vector
      upZ - the z-coordinate of the up vector
      dest - will hold the result
      Returns:
      dest
      See Also:
    • lookAlong

      public Matrix3f lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
      Apply a rotation transformation to this matrix to make -z point along dir.

      If M is this matrix and L the lookalong rotation matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookalong rotation transformation will be applied first!

      In order to set the matrix to a lookalong transformation without post-multiplying it, use setLookAlong()

      Parameters:
      dirX - the x-coordinate of the direction to look along
      dirY - the y-coordinate of the direction to look along
      dirZ - the z-coordinate of the direction to look along
      upX - the x-coordinate of the up vector
      upY - the y-coordinate of the up vector
      upZ - the z-coordinate of the up vector
      Returns:
      this
      See Also:
    • setLookAlong

      public Matrix3f setLookAlong(Vector3fc dir, Vector3fc up)
      Set this matrix to a rotation transformation to make -z point along dir.

      In order to apply the lookalong transformation to any previous existing transformation, use lookAlong(Vector3fc, Vector3fc).

      Parameters:
      dir - the direction in space to look along
      up - the direction of 'up'
      Returns:
      this
      See Also:
    • setLookAlong

      public Matrix3f setLookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
      Set this matrix to a rotation transformation to make -z point along dir.

      In order to apply the lookalong transformation to any previous existing transformation, use lookAlong()

      Parameters:
      dirX - the x-coordinate of the direction to look along
      dirY - the y-coordinate of the direction to look along
      dirZ - the z-coordinate of the direction to look along
      upX - the x-coordinate of the up vector
      upY - the y-coordinate of the up vector
      upZ - the z-coordinate of the up vector
      Returns:
      this
      See Also:
    • getRow

      public Vector3f getRow(int row, Vector3f dest) throws IndexOutOfBoundsException
      Description copied from interface: Matrix3fc
      Get the row at the given row index, starting with 0.
      Specified by:
      getRow in interface Matrix3fc
      Parameters:
      row - the row index in [0..2]
      dest - will hold the row components
      Returns:
      the passed in destination
      Throws:
      IndexOutOfBoundsException - if row is not in [0..2]
    • setRow

      public Matrix3f setRow(int row, Vector3fc src) throws IndexOutOfBoundsException
      Set the row at the given row index, starting with 0.
      Parameters:
      row - the row index in [0..2]
      src - the row components to set
      Returns:
      this
      Throws:
      IndexOutOfBoundsException - if row is not in [0..2]
    • setRow

      public Matrix3f setRow(int row, float x, float y, float z) throws IndexOutOfBoundsException
      Set the row at the given row index, starting with 0.
      Parameters:
      row - the row index in [0..2]
      x - the first element in the row
      y - the second element in the row
      z - the third element in the row
      Returns:
      this
      Throws:
      IndexOutOfBoundsException - if row is not in [0..2]
    • getColumn

      public Vector3f getColumn(int column, Vector3f dest) throws IndexOutOfBoundsException
      Description copied from interface: Matrix3fc
      Get the column at the given column index, starting with 0.
      Specified by:
      getColumn in interface Matrix3fc
      Parameters:
      column - the column index in [0..2]
      dest - will hold the column components
      Returns:
      the passed in destination
      Throws:
      IndexOutOfBoundsException - if column is not in [0..2]
    • setColumn

      public Matrix3f setColumn(int column, Vector3fc src) throws IndexOutOfBoundsException
      Set the column at the given column index, starting with 0.
      Parameters:
      column - the column index in [0..2]
      src - the column components to set
      Returns:
      this
      Throws:
      IndexOutOfBoundsException - if column is not in [0..2]
    • setColumn

      public Matrix3f setColumn(int column, float x, float y, float z) throws IndexOutOfBoundsException
      Set the column at the given column index, starting with 0.
      Parameters:
      column - the column index in [0..2]
      x - the first element in the column
      y - the second element in the column
      z - the third element in the column
      Returns:
      this
      Throws:
      IndexOutOfBoundsException - if column is not in [0..2]
    • get

      public float get(int column, int row)
      Description copied from interface: Matrix3fc
      Get the matrix element value at the given column and row.
      Specified by:
      get in interface Matrix3fc
      Parameters:
      column - the colum index in [0..2]
      row - the row index in [0..2]
      Returns:
      the element value
    • set

      public Matrix3f set(int column, int row, float value)
      Set the matrix element at the given column and row to the specified value.
      Parameters:
      column - the colum index in [0..2]
      row - the row index in [0..2]
      value - the value
      Returns:
      this
    • getRowColumn

      public float getRowColumn(int row, int column)
      Description copied from interface: Matrix3fc
      Get the matrix element value at the given row and column.
      Specified by:
      getRowColumn in interface Matrix3fc
      Parameters:
      row - the row index in [0..2]
      column - the colum index in [0..2]
      Returns:
      the element value
    • setRowColumn

      public Matrix3f setRowColumn(int row, int column, float value)
      Set the matrix element at the given row and column to the specified value.
      Parameters:
      row - the row index in [0..2]
      column - the colum index in [0..2]
      value - the value
      Returns:
      this
    • normal

      public Matrix3f normal()
      Set this matrix to its own normal matrix.

      The normal matrix of m is the transpose of the inverse of m.

      Please note that, if this is an orthogonal matrix or a matrix whose columns are orthogonal vectors, then this method need not be invoked, since in that case this itself is its normal matrix. In this case, use set(Matrix3fc) to set a given Matrix3f to this matrix.

      Returns:
      this
      See Also:
    • normal

      public Matrix3f normal(Matrix3f dest)
      Compute a normal matrix from this matrix and store it into dest.

      The normal matrix of m is the transpose of the inverse of m.

      Please note that, if this is an orthogonal matrix or a matrix whose columns are orthogonal vectors, then this method need not be invoked, since in that case this itself is its normal matrix. In this case, use set(Matrix3fc) to set a given Matrix3f to this matrix.

      Specified by:
      normal in interface Matrix3fc
      Parameters:
      dest - will hold the result
      Returns:
      dest
      See Also:
    • cofactor

      public Matrix3f cofactor()
      Compute the cofactor matrix of this.

      The cofactor matrix can be used instead of normal() to transform normals when the orientation of the normals with respect to the surface should be preserved.

      Returns:
      this
    • cofactor

      public Matrix3f cofactor(Matrix3f dest)
      Compute the cofactor matrix of this and store it into dest.

      The cofactor matrix can be used instead of normal(Matrix3f) to transform normals when the orientation of the normals with respect to the surface should be preserved.

      Specified by:
      cofactor in interface Matrix3fc
      Parameters:
      dest - will hold the result
      Returns:
      dest
    • getScale

      public Vector3f getScale(Vector3f dest)
      Description copied from interface: Matrix3fc
      Get the scaling factors of this matrix for the three base axes.
      Specified by:
      getScale in interface Matrix3fc
      Parameters:
      dest - will hold the scaling factors for x, y and z
      Returns:
      dest
    • positiveZ

      public Vector3f positiveZ(Vector3f dir)
      Description copied from interface: Matrix3fc
      Obtain the direction of +Z before the transformation represented by this matrix is applied.

      This method is equivalent to the following code:

       Matrix3f inv = new Matrix3f(this).invert();
       inv.transform(dir.set(0, 0, 1)).normalize();
       
      If this is already an orthogonal matrix, then consider using Matrix3fc.normalizedPositiveZ(Vector3f) instead.

      Reference: http://www.euclideanspace.com

      Specified by:
      positiveZ in interface Matrix3fc
      Parameters:
      dir - will hold the direction of +Z
      Returns:
      dir
    • normalizedPositiveZ

      public Vector3f normalizedPositiveZ(Vector3f dir)
      Description copied from interface: Matrix3fc
      Obtain the direction of +Z before the transformation represented by this orthogonal matrix is applied. This method only produces correct results if this is an orthogonal matrix.

      This method is equivalent to the following code:

       Matrix3f inv = new Matrix3f(this).transpose();
       inv.transform(dir.set(0, 0, 1));
       

      Reference: http://www.euclideanspace.com

      Specified by:
      normalizedPositiveZ in interface Matrix3fc
      Parameters:
      dir - will hold the direction of +Z
      Returns:
      dir
    • positiveX

      public Vector3f positiveX(Vector3f dir)
      Description copied from interface: Matrix3fc
      Obtain the direction of +X before the transformation represented by this matrix is applied.

      This method is equivalent to the following code:

       Matrix3f inv = new Matrix3f(this).invert();
       inv.transform(dir.set(1, 0, 0)).normalize();
       
      If this is already an orthogonal matrix, then consider using Matrix3fc.normalizedPositiveX(Vector3f) instead.

      Reference: http://www.euclideanspace.com

      Specified by:
      positiveX in interface Matrix3fc
      Parameters:
      dir - will hold the direction of +X
      Returns:
      dir
    • normalizedPositiveX

      public Vector3f normalizedPositiveX(Vector3f dir)
      Description copied from interface: Matrix3fc
      Obtain the direction of +X before the transformation represented by this orthogonal matrix is applied. This method only produces correct results if this is an orthogonal matrix.

      This method is equivalent to the following code:

       Matrix3f inv = new Matrix3f(this).transpose();
       inv.transform(dir.set(1, 0, 0));
       

      Reference: http://www.euclideanspace.com

      Specified by:
      normalizedPositiveX in interface Matrix3fc
      Parameters:
      dir - will hold the direction of +X
      Returns:
      dir
    • positiveY

      public Vector3f positiveY(Vector3f dir)
      Description copied from interface: Matrix3fc
      Obtain the direction of +Y before the transformation represented by this matrix is applied.

      This method is equivalent to the following code:

       Matrix3f inv = new Matrix3f(this).invert();
       inv.transform(dir.set(0, 1, 0)).normalize();
       
      If this is already an orthogonal matrix, then consider using Matrix3fc.normalizedPositiveY(Vector3f) instead.

      Reference: http://www.euclideanspace.com

      Specified by:
      positiveY in interface Matrix3fc
      Parameters:
      dir - will hold the direction of +Y
      Returns:
      dir
    • normalizedPositiveY

      public Vector3f normalizedPositiveY(Vector3f dir)
      Description copied from interface: Matrix3fc
      Obtain the direction of +Y before the transformation represented by this orthogonal matrix is applied. This method only produces correct results if this is an orthogonal matrix.

      This method is equivalent to the following code:

       Matrix3f inv = new Matrix3f(this).transpose();
       inv.transform(dir.set(0, 1, 0));
       

      Reference: http://www.euclideanspace.com

      Specified by:
      normalizedPositiveY in interface Matrix3fc
      Parameters:
      dir - will hold the direction of +Y
      Returns:
      dir
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(Matrix3fc m, float delta)
      Description copied from interface: Matrix3fc
      Compare the matrix elements of this matrix with the given matrix using the given delta and return whether all of them are equal within a maximum difference of delta.

      Please note that this method is not used by any data structure such as ArrayList HashSet or HashMap and their operations, such as ArrayList.contains(Object) or HashSet.remove(Object), since those data structures only use the Object.equals(Object) and Object.hashCode() methods.

      Specified by:
      equals in interface Matrix3fc
      Parameters:
      m - the other matrix
      delta - the allowed maximum difference
      Returns:
      true whether all of the matrix elements are equal; false otherwise
    • swap

      public Matrix3f swap(Matrix3f other)
      Exchange the values of this matrix with the given other matrix.
      Parameters:
      other - the other matrix to exchange the values with
      Returns:
      this
    • add

      public Matrix3f add(Matrix3fc other)
      Component-wise add this and other.
      Parameters:
      other - the other addend
      Returns:
      this
    • add

      public Matrix3f add(Matrix3fc other, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Component-wise add this and other and store the result in dest.
      Specified by:
      add in interface Matrix3fc
      Parameters:
      other - the other addend
      dest - will hold the result
      Returns:
      dest
    • sub

      public Matrix3f sub(Matrix3fc subtrahend)
      Component-wise subtract subtrahend from this.
      Parameters:
      subtrahend - the subtrahend
      Returns:
      this
    • sub

      public Matrix3f sub(Matrix3fc subtrahend, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Component-wise subtract subtrahend from this and store the result in dest.
      Specified by:
      sub in interface Matrix3fc
      Parameters:
      subtrahend - the subtrahend
      dest - will hold the result
      Returns:
      dest
    • mulComponentWise

      public Matrix3f mulComponentWise(Matrix3fc other)
      Component-wise multiply this by other.
      Parameters:
      other - the other matrix
      Returns:
      this
    • mulComponentWise

      public Matrix3f mulComponentWise(Matrix3fc other, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Component-wise multiply this by other and store the result in dest.
      Specified by:
      mulComponentWise in interface Matrix3fc
      Parameters:
      other - the other matrix
      dest - will hold the result
      Returns:
      dest
    • setSkewSymmetric

      public Matrix3f setSkewSymmetric(float a, float b, float c)
      Set this matrix to a skew-symmetric matrix using the following layout:
        0,  a, -b
       -a,  0,  c
        b, -c,  0
       
      Reference: https://en.wikipedia.org
      Parameters:
      a - the value used for the matrix elements m01 and m10
      b - the value used for the matrix elements m02 and m20
      c - the value used for the matrix elements m12 and m21
      Returns:
      this
    • lerp

      public Matrix3f lerp(Matrix3fc other, float t)
      Linearly interpolate this and other using the given interpolation factor t and store the result in this.

      If t is 0.0 then the result is this. If the interpolation factor is 1.0 then the result is other.

      Parameters:
      other - the other matrix
      t - the interpolation factor between 0.0 and 1.0
      Returns:
      this
    • lerp

      public Matrix3f lerp(Matrix3fc other, float t, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Linearly interpolate this and other using the given interpolation factor t and store the result in dest.

      If t is 0.0 then the result is this. If the interpolation factor is 1.0 then the result is other.

      Specified by:
      lerp in interface Matrix3fc
      Parameters:
      other - the other matrix
      t - the interpolation factor between 0.0 and 1.0
      dest - will hold the result
      Returns:
      dest
    • rotateTowards

      public Matrix3f rotateTowards(Vector3fc direction, Vector3fc up, Matrix3f dest)
      Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with direction and store the result in dest.

      If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying it, use rotationTowards().

      This method is equivalent to calling: mul(new Matrix3f().lookAlong(new Vector3f(dir).negate(), up).invert(), dest)

      Specified by:
      rotateTowards in interface Matrix3fc
      Parameters:
      direction - the direction to rotate towards
      up - the model's up vector
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotateTowards

      public Matrix3f rotateTowards(Vector3fc direction, Vector3fc up)
      Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with direction.

      If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying it, use rotationTowards().

      This method is equivalent to calling: mul(new Matrix3f().lookAlong(new Vector3f(dir).negate(), up).invert())

      Parameters:
      direction - the direction to orient towards
      up - the up vector
      Returns:
      this
      See Also:
    • rotateTowards

      public Matrix3f rotateTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
      Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with direction.

      If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying it, use rotationTowards().

      This method is equivalent to calling: mul(new Matrix3f().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert())

      Parameters:
      dirX - the x-coordinate of the direction to rotate towards
      dirY - the y-coordinate of the direction to rotate towards
      dirZ - the z-coordinate of the direction to rotate towards
      upX - the x-coordinate of the up vector
      upY - the y-coordinate of the up vector
      upZ - the z-coordinate of the up vector
      Returns:
      this
      See Also:
    • rotateTowards

      public Matrix3f rotateTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix3f dest)
      Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local +Z axis with dir and store the result in dest.

      If M is this matrix and L the lookat matrix, then the new matrix will be M * L. So when transforming a vector v with the new matrix by using M * L * v, the lookat transformation will be applied first!

      In order to set the matrix to a rotation transformation without post-multiplying it, use rotationTowards().

      This method is equivalent to calling: mul(new Matrix3f().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert(), dest)

      Specified by:
      rotateTowards in interface Matrix3fc
      Parameters:
      dirX - the x-coordinate of the direction to rotate towards
      dirY - the y-coordinate of the direction to rotate towards
      dirZ - the z-coordinate of the direction to rotate towards
      upX - the x-coordinate of the up vector
      upY - the y-coordinate of the up vector
      upZ - the z-coordinate of the up vector
      dest - will hold the result
      Returns:
      dest
      See Also:
    • rotationTowards

      public Matrix3f rotationTowards(Vector3fc dir, Vector3fc up)
      Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local -z axis with center - eye.

      In order to apply the rotation transformation to a previous existing transformation, use rotateTowards.

      This method is equivalent to calling: setLookAlong(new Vector3f(dir).negate(), up).invert()

      Parameters:
      dir - the direction to orient the local -z axis towards
      up - the up vector
      Returns:
      this
      See Also:
    • rotationTowards

      public Matrix3f rotationTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
      Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local -z axis with center - eye.

      In order to apply the rotation transformation to a previous existing transformation, use rotateTowards.

      This method is equivalent to calling: setLookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert()

      Parameters:
      dirX - the x-coordinate of the direction to rotate towards
      dirY - the y-coordinate of the direction to rotate towards
      dirZ - the z-coordinate of the direction to rotate towards
      upX - the x-coordinate of the up vector
      upY - the y-coordinate of the up vector
      upZ - the z-coordinate of the up vector
      Returns:
      this
      See Also:
    • getEulerAnglesZYX

      public Vector3f getEulerAnglesZYX(Vector3f dest)
      Extract the Euler angles from the rotation represented by this matrix and store the extracted Euler angles in dest.

      This method assumes that this matrix only represents a rotation without scaling.

      Note that the returned Euler angles must be applied in the order Z * Y * X to obtain the identical matrix. This means that calling rotateZYX(float, float, float) using the obtained Euler angles will yield the same rotation as the original matrix from which the Euler angles were obtained, so in the below code the matrix m2 should be identical to m (disregarding possible floating-point inaccuracies).

       Matrix3f m = ...; // <- matrix only representing rotation
       Matrix3f n = new Matrix3f();
       n.rotateZYX(m.getEulerAnglesZYX(new Vector3f()));
       

      Reference: http://nghiaho.com/

      Specified by:
      getEulerAnglesZYX in interface Matrix3fc
      Parameters:
      dest - will hold the extracted Euler angles
      Returns:
      dest
    • obliqueZ

      public Matrix3f obliqueZ(float a, float b)
      Apply an oblique projection transformation to this matrix with the given values for a and b.

      If M is this matrix and O the oblique transformation matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the oblique transformation will be applied first!

      The oblique transformation is defined as:

       x' = x + a*z
       y' = y + a*z
       z' = z
       
      or in matrix form:
       1 0 a
       0 1 b
       0 0 1
       
      Parameters:
      a - the value for the z factor that applies to x
      b - the value for the z factor that applies to y
      Returns:
      this
    • obliqueZ

      public Matrix3f obliqueZ(float a, float b, Matrix3f dest)
      Apply an oblique projection transformation to this matrix with the given values for a and b and store the result in dest.

      If M is this matrix and O the oblique transformation matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the oblique transformation will be applied first!

      The oblique transformation is defined as:

       x' = x + a*z
       y' = y + a*z
       z' = z
       
      or in matrix form:
       1 0 a
       0 1 b
       0 0 1
       
      Specified by:
      obliqueZ in interface Matrix3fc
      Parameters:
      a - the value for the z factor that applies to x
      b - the value for the z factor that applies to y
      dest - will hold the result
      Returns:
      dest
    • reflect

      public Matrix3f reflect(float nx, float ny, float nz, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal (nx, ny, nz), and store the result in dest.

      If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

      Specified by:
      reflect in interface Matrix3fc
      Parameters:
      nx - the x-coordinate of the plane normal
      ny - the y-coordinate of the plane normal
      nz - the z-coordinate of the plane normal
      dest - will hold the result
      Returns:
      this
    • reflect

      public Matrix3f reflect(float nx, float ny, float nz)
      Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal.

      If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

      Parameters:
      nx - the x-coordinate of the plane normal
      ny - the y-coordinate of the plane normal
      nz - the z-coordinate of the plane normal
      Returns:
      this
    • reflect

      public Matrix3f reflect(Vector3fc normal)
      Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal.

      If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

      Parameters:
      normal - the plane normal
      Returns:
      this
    • reflect

      public Matrix3f reflect(Quaternionfc orientation)
      Apply a mirror/reflection transformation to this matrix that reflects about a plane specified via the plane orientation.

      This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene. It is assumed that the default mirror plane's normal is (0, 0, 1). So, if the given Quaternionfc is the identity (does not apply any additional rotation), the reflection plane will be z=0.

      If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

      Parameters:
      orientation - the plane orientation
      Returns:
      this
    • reflect

      public Matrix3f reflect(Quaternionfc orientation, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply a mirror/reflection transformation to this matrix that reflects through a plane specified via the plane orientation, and store the result in dest.

      This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene. It is assumed that the default mirror plane's normal is (0, 0, 1). So, if the given Quaternionfc is the identity (does not apply any additional rotation), the reflection plane will be z=0.

      If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

      Specified by:
      reflect in interface Matrix3fc
      Parameters:
      orientation - the plane orientation
      dest - will hold the result
      Returns:
      this
    • reflect

      public Matrix3f reflect(Vector3fc normal, Matrix3f dest)
      Description copied from interface: Matrix3fc
      Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal, and store the result in dest.

      If M is this matrix and R the reflection matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the reflection will be applied first!

      Specified by:
      reflect in interface Matrix3fc
      Parameters:
      normal - the plane normal
      dest - will hold the result
      Returns:
      this
    • reflection

      public Matrix3f reflection(float nx, float ny, float nz)
      Set this matrix to a mirror/reflection transformation that reflects through the given plane specified via the plane normal.
      Parameters:
      nx - the x-coordinate of the plane normal
      ny - the y-coordinate of the plane normal
      nz - the z-coordinate of the plane normal
      Returns:
      this
    • reflection

      public Matrix3f reflection(Vector3fc normal)
      Set this matrix to a mirror/reflection transformation that reflects through the given plane specified via the plane normal.
      Parameters:
      normal - the plane normal
      Returns:
      this
    • reflection

      public Matrix3f reflection(Quaternionfc orientation)
      Set this matrix to a mirror/reflection transformation that reflects through a plane specified via the plane orientation.

      This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene. It is assumed that the default mirror plane's normal is (0, 0, 1). So, if the given Quaternionfc is the identity (does not apply any additional rotation), the reflection plane will be z=0, offset by the given point.

      Parameters:
      orientation - the plane orientation
      Returns:
      this
    • isFinite

      public boolean isFinite()
      Description copied from interface: Matrix3fc
      Determine whether all matrix elements are finite floating-point values, that is, they are not NaN and not infinity.
      Specified by:
      isFinite in interface Matrix3fc
      Returns:
      true if all components are finite floating-point values; false otherwise
    • quadraticFormProduct

      public float quadraticFormProduct(float x, float y, float z)
      Description copied from interface: Matrix3fc
      Compute (x, y, z)^T * this * (x, y, z).
      Specified by:
      quadraticFormProduct in interface Matrix3fc
      Parameters:
      x - the x coordinate of the vector to multiply
      y - the y coordinate of the vector to multiply
      z - the z coordinate of the vector to multiply
      Returns:
      the result
    • quadraticFormProduct

      public float quadraticFormProduct(Vector3fc v)
      Description copied from interface: Matrix3fc
      Compute v^T * this * v.
      Specified by:
      quadraticFormProduct in interface Matrix3fc
      Parameters:
      v - the vector to multiply
      Returns:
      the result
    • clone

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException