- java.lang.Object
-
- org.spongepowered.math.matrix.MatrixNf
-
- All Implemented Interfaces:
Serializable,Cloneable,Matrixf
public class MatrixNf extends Object implements Matrixf, Serializable, Cloneable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static MatrixNfIDENTITY_2static MatrixNfIDENTITY_3static MatrixNfIDENTITY_4
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MatrixNfabs()MatrixNfadd(MatrixNf m)MatrixNfceil()MatrixNfclone()VectorNfcolumn(int col)static MatrixNfcreateLookAt(int size, Vector3f eye, Vector3f at, Vector3f up)Creates a "look at" matrix for the given eye point.static MatrixNfcreateOrthographic(int size, double right, double left, double top, double bottom, double near, double far)Creates an orthographic viewing frustum built from the provided valuesstatic MatrixNfcreateOrthographic(int size, float right, float left, float top, float bottom, float near, float far)Creates an orthographic viewing frustum built from the provided valuesstatic MatrixNfcreatePerspective(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 MatrixNfcreatePerspective(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 MatrixNfcreateRotation(int size, Complexf rot)static MatrixNfcreateRotation(int size, Quaternionf rot)static MatrixNfcreateScaling(float... vec)static MatrixNfcreateScaling(VectorNf v)static MatrixNfcreateTranslation(float... vec)static MatrixNfcreateTranslation(VectorNf v)floatdeterminant()MatrixNfdiv(double a)MatrixNfdiv(float a)MatrixNfdiv(MatrixNf m)booleanequals(Object other)MatrixNffloor()floatget(int row, int col)inthashCode()MatrixNfinvert()MatrixNfmul(double a)MatrixNfmul(float a)MatrixNfmul(MatrixNf m)MatrixNfnegate()MatrixNfpow(double pow)MatrixNfpow(float pow)MatrixNfresize(int size)MatrixNfrotate(Complexf rot)MatrixNfrotate(Quaternionf rot)MatrixNfround()VectorNfrow(int row)MatrixNfscale(float... v)MatrixNfscale(VectorNf v)voidset(int row, int col, double val)voidset(int row, int col, float val)voidsetIdentity()voidsetZero()intsize()MatrixNfsub(MatrixNf m)float[]toArray()float[]toArray(boolean columnMajor)MatrixNdtoDouble()MatrixNftoFloat()Matrix2ftoMatrix2()Matrix3ftoMatrix3()Matrix4ftoMatrix4()StringtoString()floattrace()VectorNftransform(float... vec)VectorNftransform(VectorNf v)MatrixNftranslate(float... v)MatrixNftranslate(VectorNf v)MatrixNftranspose()
-
-
-
Method Detail
-
size
public int size()
-
set
public void set(int row, int col, double val)
-
set
public void set(int row, int col, float val)
-
setIdentity
public final void setIdentity()
-
setZero
public void setZero()
-
resize
public MatrixNf resize(int size)
-
mul
public MatrixNf mul(double a)
-
div
public MatrixNf div(double a)
-
pow
public MatrixNf pow(double pow)
-
translate
public MatrixNf translate(float... v)
-
scale
public MatrixNf scale(float... v)
-
rotate
public MatrixNf rotate(Quaternionf rot)
-
transform
public VectorNf transform(float... vec)
-
determinant
public float determinant()
- Specified by:
determinantin interfaceMatrixf
-
toMatrix2
public Matrix2f toMatrix2()
-
toMatrix3
public Matrix3f toMatrix3()
-
toMatrix4
public Matrix4f toMatrix4()
-
toArray
public float[] toArray()
-
createScaling
public static MatrixNf createScaling(float... vec)
-
createTranslation
public static MatrixNf createTranslation(float... vec)
-
createRotation
public static MatrixNf createRotation(int size, Quaternionf rot)
-
createLookAt
public static MatrixNf createLookAt(int size, Vector3f eye, Vector3f at, Vector3f 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 MatrixNf 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
-
createPerspective
public static MatrixNf 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
-
createOrthographic
public static MatrixNf 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
-
createOrthographic
public static MatrixNf 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
-
-