Class Matrix4d

java.lang.Object
org.spongepowered.math.matrix.Matrix4d
All Implemented Interfaces:
Serializable, Matrixd

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

    • ZERO

      public static final Matrix4d ZERO
    • IDENTITY

      public static final Matrix4d IDENTITY
  • Constructor Details

    • Matrix4d

      public Matrix4d(Matrix2d m)
    • Matrix4d

      public Matrix4d(Matrix3d m)
    • Matrix4d

      public Matrix4d(MatrixNd m)
    • Matrix4d

      public Matrix4d(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)
    • Matrix4d

      public Matrix4d(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)
  • Method Details

    • get

      public double get(int row, int col)
      Specified by:
      get in interface Matrixd
    • row

      public Vector4d row(int row)
      Specified by:
      row in interface Matrixd
    • column

      public Vector4d column(int col)
      Specified by:
      column in interface Matrixd
    • add

      public Matrix4d add(Matrix4d m)
    • sub

      public Matrix4d sub(Matrix4d m)
    • mul

      public Matrix4d mul(float a)
    • mul

      public Matrix4d mul(double a)
      Specified by:
      mul in interface Matrixd
    • mul

      public Matrix4d mul(Matrix4d m)
    • div

      public Matrix4d div(float a)
    • div

      public Matrix4d div(double a)
      Specified by:
      div in interface Matrixd
    • div

      public Matrix4d div(Matrix4d m)
    • pow

      public Matrix4d pow(float pow)
    • pow

      public Matrix4d pow(double pow)
      Specified by:
      pow in interface Matrixd
    • translate

      public Matrix4d translate(Vector3d v)
    • translate

      public Matrix4d translate(float x, float y, float z)
    • translate

      public Matrix4d translate(double x, double y, double z)
    • scale

      public Matrix4d scale(float scale)
    • scale

      public Matrix4d scale(double scale)
    • scale

      public Matrix4d scale(Vector4d v)
    • scale

      public Matrix4d scale(float x, float y, float z, float w)
    • scale

      public Matrix4d scale(double x, double y, double z, double w)
    • rotate

      public Matrix4d rotate(Complexd rot)
    • rotate

      public Matrix4d rotate(Quaterniond rot)
    • transform

      public Vector4d transform(Vector4d v)
    • transform

      public Vector4d transform(float x, float y, float z, float w)
    • transform

      public Vector4d transform(double x, double y, double z, double w)
    • floor

      public Matrix4d floor()
      Specified by:
      floor in interface Matrixd
    • ceil

      public Matrix4d ceil()
      Specified by:
      ceil in interface Matrixd
    • round

      public Matrix4d round()
      Specified by:
      round in interface Matrixd
    • abs

      public Matrix4d abs()
      Specified by:
      abs in interface Matrixd
    • negate

      public Matrix4d negate()
      Specified by:
      negate in interface Matrixd
    • transpose

      public Matrix4d transpose()
      Specified by:
      transpose in interface Matrixd
    • trace

      public double trace()
      Specified by:
      trace in interface Matrixd
    • determinant

      public double determinant()
      Specified by:
      determinant in interface Matrixd
    • invert

      public Matrix4d invert()
      Specified by:
      invert in interface Matrixd
    • toMatrix2

      public Matrix2d toMatrix2()
    • toMatrix3

      public Matrix3d toMatrix3()
    • toMatrixN

      public MatrixNd toMatrixN()
    • toArray

      public double[] toArray()
    • toArray

      public double[] toArray(boolean columnMajor)
      Specified by:
      toArray in interface Matrixd
    • toFloat

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

      public Matrix4d toDouble()
      Specified by:
      toDouble in interface Matrixd
    • 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 Matrix4d from(double n)
    • from

      public static Matrix4d from(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)
    • fromDiagonal

      public static Matrix4d fromDiagonal(double m00, double m11, double m22, double m33)
    • createScaling

      public static Matrix4d createScaling(float scale)
    • createScaling

      public static Matrix4d createScaling(double scale)
    • createScaling

      public static Matrix4d createScaling(Vector4d v)
    • createScaling

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

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

      public static Matrix4d createTranslation(Vector3d v)
    • createTranslation

      public static Matrix4d createTranslation(float x, float y, float z)
    • createTranslation

      public static Matrix4d createTranslation(double x, double y, double z)
    • createRotation

      public static Matrix4d createRotation(Complexd rot)
    • createRotation

      public static Matrix4d createRotation(Quaterniond rot)
    • createLookAt

      public static Matrix4d createLookAt(Vector3d eye, Vector3d at, Vector3d 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 Matrix4d 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
    • createPerspective

      public static Matrix4d 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
    • createOrthographic

      public static Matrix4d 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
    • createOrthographic

      public static Matrix4d 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