- 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description 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)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(Matrix2d m)Matrix4d(Matrix3d m)Matrix4d(MatrixNd m)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix4dabs()Matrix4dadd(Matrix4d m)Matrix4dceil()Vector4dcolumn(int col)static Matrix4dcreateLookAt(Vector3d eye, Vector3d at, Vector3d up)Creates a "look at" matrix for the given eye point.static Matrix4dcreateOrthographic(double right, double left, double top, double bottom, double near, double far)Creates an orthographic viewing frustum built from the provided valuesstatic Matrix4dcreateOrthographic(float right, float left, float top, float bottom, float near, float far)Creates an orthographic viewing frustum built from the provided valuesstatic Matrix4dcreatePerspective(double fov, double aspect, double near, double far)Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planesstatic Matrix4dcreatePerspective(float fov, float aspect, float near, float far)Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planesstatic Matrix4dcreateRotation(Complexd rot)static Matrix4dcreateRotation(Quaterniond rot)static Matrix4dcreateScaling(double scale)static Matrix4dcreateScaling(double x, double y, double z, double w)static Matrix4dcreateScaling(float scale)static Matrix4dcreateScaling(float x, float y, float z, float w)static Matrix4dcreateScaling(Vector4d v)static Matrix4dcreateTranslation(double x, double y, double z)static Matrix4dcreateTranslation(float x, float y, float z)static Matrix4dcreateTranslation(Vector3d v)doubledeterminant()Matrix4ddiv(double a)Matrix4ddiv(float a)Matrix4ddiv(Matrix4d m)booleanequals(Object other)Matrix4dfloor()static Matrix4dfrom(double n)static Matrix4dfrom(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)static Matrix4dfromDiagonal(double m00, double m11, double m22, double m33)doubleget(int row, int col)inthashCode()Matrix4dinvert()Matrix4dmul(double a)Matrix4dmul(float a)Matrix4dmul(Matrix4d m)Matrix4dnegate()Matrix4dpow(double pow)Matrix4dpow(float pow)Matrix4drotate(Complexd rot)Matrix4drotate(Quaterniond rot)Matrix4dround()Vector4drow(int row)Matrix4dscale(double scale)Matrix4dscale(double x, double y, double z, double w)Matrix4dscale(float scale)Matrix4dscale(float x, float y, float z, float w)Matrix4dscale(Vector4d v)Matrix4dsub(Matrix4d m)double[]toArray()double[]toArray(boolean columnMajor)Matrix4dtoDouble()Matrix4ftoFloat()Matrix2dtoMatrix2()Matrix3dtoMatrix3()MatrixNdtoMatrixN()StringtoString()doubletrace()Vector4dtransform(double x, double y, double z, double w)Vector4dtransform(float x, float y, float z, float w)Vector4dtransform(Vector4d v)Matrix4dtranslate(double x, double y, double z)Matrix4dtranslate(float x, float y, float z)Matrix4dtranslate(Vector3d v)Matrix4dtranspose()
-
-
-
Constructor Detail
-
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 Detail
-
mul
public Matrix4d mul(float a)
-
div
public Matrix4d div(float a)
-
pow
public Matrix4d pow(float pow)
-
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(float x, float y, float z, float w)
-
scale
public Matrix4d scale(double x, double y, double z, double w)
-
rotate
public Matrix4d rotate(Quaterniond rot)
-
transform
public Vector4d transform(float x, float y, float z, float w)
-
transform
public Vector4d transform(double x, double y, double z, double w)
-
determinant
public double determinant()
- Specified by:
determinantin interfaceMatrixd
-
toMatrix2
public Matrix2d toMatrix2()
-
toMatrix3
public Matrix3d toMatrix3()
-
toMatrixN
public MatrixNd toMatrixN()
-
toArray
public double[] toArray()
-
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(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(float x, float y, float z)
-
createTranslation
public static Matrix4d createTranslation(double x, double y, double z)
-
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 cameraat- The point that the camera is looking atup- 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 directionaspect- The aspect ratio, usually width/heightnear- The near plane, cannot be 0far- 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 directionaspect- The aspect ratio, usually width/heightnear- The near plane, cannot be 0far- 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 frustumleft- the left most plane of the viewing frustumtop- the top plane of the viewing frustumbottom- the bottom plane of the viewing frustumnear- the near plane of the viewing frustumfar- 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 frustumleft- the left most plane of the viewing frustumtop- the top plane of the viewing frustumbottom- the bottom plane of the viewing frustumnear- the near plane of the viewing frustumfar- the far plane of the viewing frustum- Returns:
- A viewing frustum built from the provided values
-
-