Class Matrix4f

java.lang.Object
org.spongepowered.math.matrix.Matrix4f
All Implemented Interfaces:
Serializable, Matrixf

@Immutable public final class Matrix4f extends Object implements Matrixf, Serializable
See Also:
  • Field Details

    • ZERO

      public static final Matrix4f ZERO
    • IDENTITY

      public static final Matrix4f IDENTITY
  • Constructor Details

    • Matrix4f

      public Matrix4f(Matrix2f m)
    • Matrix4f

      public Matrix4f(Matrix3f m)
    • Matrix4f

      public Matrix4f(MatrixNf m)
    • Matrix4f

      public Matrix4f(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
    • Matrix4f

      public Matrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
  • Method Details

    • get

      public float get(int row, int col)
      Specified by:
      get in interface Matrixf
    • row

      public Vector4f row(int row)
      Specified by:
      row in interface Matrixf
    • column

      public Vector4f column(int col)
      Specified by:
      column in interface Matrixf
    • add

      public Matrix4f add(Matrix4f m)
    • sub

      public Matrix4f sub(Matrix4f m)
    • mul

      public Matrix4f mul(double a)
    • mul

      public Matrix4f mul(float a)
      Specified by:
      mul in interface Matrixf
    • mul

      public Matrix4f mul(Matrix4f m)
    • div

      public Matrix4f div(double a)
    • div

      public Matrix4f div(float a)
      Specified by:
      div in interface Matrixf
    • div

      public Matrix4f div(Matrix4f m)
    • pow

      public Matrix4f pow(double pow)
    • pow

      public Matrix4f pow(float pow)
      Specified by:
      pow in interface Matrixf
    • translate

      public Matrix4f translate(Vector3f v)
    • translate

      public Matrix4f translate(double x, double y, double z)
    • translate

      public Matrix4f translate(float x, float y, float z)
    • scale

      public Matrix4f scale(double scale)
    • scale

      public Matrix4f scale(float scale)
    • scale

      public Matrix4f scale(Vector4f v)
    • scale

      public Matrix4f scale(double x, double y, double z, double w)
    • scale

      public Matrix4f scale(float x, float y, float z, float w)
    • rotate

      public Matrix4f rotate(Complexf rot)
    • rotate

      public Matrix4f rotate(Quaternionf rot)
    • transform

      public Vector4f transform(Vector4f v)
    • transform

      public Vector4f transform(double x, double y, double z, double w)
    • transform

      public Vector4f transform(float x, float y, float z, float w)
    • floor

      public Matrix4f floor()
      Specified by:
      floor in interface Matrixf
    • ceil

      public Matrix4f ceil()
      Specified by:
      ceil in interface Matrixf
    • round

      public Matrix4f round()
      Specified by:
      round in interface Matrixf
    • abs

      public Matrix4f abs()
      Specified by:
      abs in interface Matrixf
    • negate

      public Matrix4f negate()
      Specified by:
      negate in interface Matrixf
    • transpose

      public Matrix4f transpose()
      Specified by:
      transpose in interface Matrixf
    • trace

      public float trace()
      Specified by:
      trace in interface Matrixf
    • determinant

      public float determinant()
      Specified by:
      determinant in interface Matrixf
    • invert

      public Matrix4f invert()
      Specified by:
      invert in interface Matrixf
    • toMatrix2

      public Matrix2f toMatrix2()
    • toMatrix3

      public Matrix3f toMatrix3()
    • toMatrixN

      public MatrixNf toMatrixN()
    • toArray

      public float[] toArray()
    • toArray

      public float[] toArray(boolean columnMajor)
      Specified by:
      toArray in interface Matrixf
    • toFloat

      public Matrix4f toFloat()
      Specified by:
      toFloat in interface Matrixf
    • toDouble

      public Matrix4d toDouble()
      Specified by:
      toDouble in interface Matrixf
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

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

      public static Matrix4f from(float n)
    • from

      public static Matrix4f from(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
    • fromDiagonal

      public static Matrix4f fromDiagonal(float m00, float m11, float m22, float m33)
    • createScaling

      public static Matrix4f createScaling(double scale)
    • createScaling

      public static Matrix4f createScaling(float scale)
    • createScaling

      public static Matrix4f createScaling(Vector4f v)
    • createScaling

      public static Matrix4f createScaling(double x, double y, double z, double w)
    • createScaling

      public static Matrix4f createScaling(float x, float y, float z, float w)
    • createTranslation

      public static Matrix4f createTranslation(Vector3f v)
    • createTranslation

      public static Matrix4f createTranslation(double x, double y, double z)
    • createTranslation

      public static Matrix4f createTranslation(float x, float y, float z)
    • createRotation

      public static Matrix4f createRotation(Complexf rot)
    • createRotation

      public static Matrix4f createRotation(Quaternionf rot)
    • createLookAt

      public static Matrix4f createLookAt(Vector3f eye, Vector3f at, Vector3f up)
      Creates a "look at" matrix for the given eye point.
      Parameters:
      eye - The position of the camera
      at - The point that the camera is looking at
      up - The "up" vector
      Returns:
      A rotational transform that corresponds to a camera looking at the given point
    • createPerspective

      public static Matrix4f createPerspective(double fov, double aspect, double near, double far)
      Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planes
      Parameters:
      fov - The field of view in the x direction
      aspect - The aspect ratio, usually width/height
      near - The near plane, cannot be 0
      far - the far plane, far cannot equal near
      Returns:
      A perspective projection matrix built from the given values
    • createPerspective

      public static Matrix4f createPerspective(float fov, float aspect, float near, float far)
      Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planes
      Parameters:
      fov - The field of view in the x direction
      aspect - The aspect ratio, usually width/height
      near - The near plane, cannot be 0
      far - the far plane, far cannot equal near
      Returns:
      A perspective projection matrix built from the given values
    • createOrthographic

      public static Matrix4f createOrthographic(double right, double left, double top, double bottom, double near, double far)
      Creates an orthographic viewing frustum built from the provided values
      Parameters:
      right - the right most plane of the viewing frustum
      left - the left most plane of the viewing frustum
      top - the top plane of the viewing frustum
      bottom - the bottom plane of the viewing frustum
      near - the near plane of the viewing frustum
      far - the far plane of the viewing frustum
      Returns:
      A viewing frustum built from the provided values
    • createOrthographic

      public static Matrix4f createOrthographic(float right, float left, float top, float bottom, float near, float far)
      Creates an orthographic viewing frustum built from the provided values
      Parameters:
      right - the right most plane of the viewing frustum
      left - the left most plane of the viewing frustum
      top - the top plane of the viewing frustum
      bottom - the bottom plane of the viewing frustum
      near - the near plane of the viewing frustum
      far - the far plane of the viewing frustum
      Returns:
      A viewing frustum built from the provided values