- java.lang.Object
-
- org.spongepowered.math.matrix.MatrixNd
-
- All Implemented Interfaces:
Serializable,Cloneable,Matrixd
public class MatrixNd extends Object implements Matrixd, Serializable, Cloneable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static MatrixNdIDENTITY_2static MatrixNdIDENTITY_3static MatrixNdIDENTITY_4
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MatrixNdabs()MatrixNdadd(MatrixNd m)MatrixNdceil()MatrixNdclone()VectorNdcolumn(int col)static MatrixNdcreateLookAt(int size, Vector3d eye, Vector3d at, Vector3d up)Creates a "look at" matrix for the given eye point.static MatrixNdcreateOrthographic(int size, double right, double left, double top, double bottom, double near, double far)Creates an orthographic viewing frustum built from the provided valuesstatic MatrixNdcreateOrthographic(int size, float right, float left, float top, float bottom, float near, float far)Creates an orthographic viewing frustum built from the provided valuesstatic MatrixNdcreatePerspective(int size, double fov, double aspect, double near, double far)Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planesstatic MatrixNdcreatePerspective(int size, float fov, float aspect, float near, float far)Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planesstatic MatrixNdcreateRotation(int size, Complexd rot)static MatrixNdcreateRotation(int size, Quaterniond rot)static MatrixNdcreateScaling(double... vec)static MatrixNdcreateScaling(VectorNd v)static MatrixNdcreateTranslation(double... vec)static MatrixNdcreateTranslation(VectorNd v)doubledeterminant()MatrixNddiv(double a)MatrixNddiv(float a)MatrixNddiv(MatrixNd m)booleanequals(Object other)MatrixNdfloor()doubleget(int row, int col)inthashCode()MatrixNdinvert()MatrixNdmul(double a)MatrixNdmul(float a)MatrixNdmul(MatrixNd m)MatrixNdnegate()MatrixNdpow(double pow)MatrixNdpow(float pow)MatrixNdresize(int size)MatrixNdrotate(Complexd rot)MatrixNdrotate(Quaterniond rot)MatrixNdround()VectorNdrow(int row)MatrixNdscale(double... v)MatrixNdscale(VectorNd v)voidset(int row, int col, double val)voidset(int row, int col, float val)voidsetIdentity()voidsetZero()intsize()MatrixNdsub(MatrixNd m)double[]toArray()double[]toArray(boolean columnMajor)MatrixNdtoDouble()MatrixNftoFloat()Matrix2dtoMatrix2()Matrix3dtoMatrix3()Matrix4dtoMatrix4()StringtoString()doubletrace()VectorNdtransform(double... vec)VectorNdtransform(VectorNd v)MatrixNdtranslate(double... v)MatrixNdtranslate(VectorNd v)MatrixNdtranspose()
-
-
-
Method Detail
-
size
public int size()
-
set
public void set(int row, int col, float val)
-
set
public void set(int row, int col, double val)
-
setIdentity
public final void setIdentity()
-
setZero
public void setZero()
-
resize
public MatrixNd resize(int size)
-
mul
public MatrixNd mul(float a)
-
div
public MatrixNd div(float a)
-
pow
public MatrixNd pow(float pow)
-
translate
public MatrixNd translate(double... v)
-
scale
public MatrixNd scale(double... v)
-
rotate
public MatrixNd rotate(Quaterniond rot)
-
transform
public VectorNd transform(double... vec)
-
determinant
public double determinant()
- Specified by:
determinantin interfaceMatrixd
-
toMatrix2
public Matrix2d toMatrix2()
-
toMatrix3
public Matrix3d toMatrix3()
-
toMatrix4
public Matrix4d toMatrix4()
-
toArray
public double[] toArray()
-
createScaling
public static MatrixNd createScaling(double... vec)
-
createTranslation
public static MatrixNd createTranslation(double... vec)
-
createRotation
public static MatrixNd createRotation(int size, Quaterniond rot)
-
createLookAt
public static MatrixNd createLookAt(int size, Vector3d eye, Vector3d at, Vector3d up)
Creates a "look at" matrix for the given eye point.- Parameters:
size- The size of the matrix, minimum of 4eye- 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 MatrixNd createPerspective(int size, float fov, float aspect, float near, float far)
Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planes- Parameters:
size- The size of the matrix, minimum of 4fov- The field of view in the x directionaspect- The aspect ratio, usually width/heightnear- The near plane, cannot be 0far- the far plane, zFar cannot equal zNear- Returns:
- A perspective projection matrix built from the given values
-
createPerspective
public static MatrixNd createPerspective(int size, double fov, double aspect, double near, double far)
Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planes- Parameters:
size- The size of the matrix, minimum of 4fov- The field of view in the x directionaspect- The aspect ratio, usually width/heightnear- The near plane, cannot be 0far- the far plane, zFar cannot equal zNear- Returns:
- A perspective projection matrix built from the given values
-
createOrthographic
public static MatrixNd createOrthographic(int size, float right, float left, float top, float bottom, float near, float far)
Creates an orthographic viewing frustum built from the provided values- Parameters:
size- The size of the matrix, minimum of 4right- 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 MatrixNd createOrthographic(int size, double right, double left, double top, double bottom, double near, double far)
Creates an orthographic viewing frustum built from the provided values- Parameters:
size- The size of the matrix, minimum of 4right- 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
-
-