- 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 MatrixNf
IDENTITY_2
static MatrixNf
IDENTITY_3
static MatrixNf
IDENTITY_4
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MatrixNf
abs()
MatrixNf
add(MatrixNf m)
MatrixNf
ceil()
MatrixNf
clone()
VectorNf
column(int col)
static MatrixNf
createLookAt(int size, Vector3f eye, Vector3f at, Vector3f up)
Creates a "look at" matrix for the given eye point.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 valuesstatic 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 valuesstatic 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 planesstatic 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 planesstatic MatrixNf
createRotation(int size, Complexf rot)
static MatrixNf
createRotation(int size, Quaternionf rot)
static MatrixNf
createScaling(float... vec)
static MatrixNf
createScaling(VectorNf v)
static MatrixNf
createTranslation(float... vec)
static MatrixNf
createTranslation(VectorNf v)
float
determinant()
MatrixNf
div(double a)
MatrixNf
div(float a)
MatrixNf
div(MatrixNf m)
boolean
equals(Object other)
MatrixNf
floor()
float
get(int row, int col)
int
hashCode()
MatrixNf
invert()
MatrixNf
mul(double a)
MatrixNf
mul(float a)
MatrixNf
mul(MatrixNf m)
MatrixNf
negate()
MatrixNf
pow(double pow)
MatrixNf
pow(float pow)
MatrixNf
resize(int size)
MatrixNf
rotate(Complexf rot)
MatrixNf
rotate(Quaternionf rot)
MatrixNf
round()
VectorNf
row(int row)
MatrixNf
scale(float... v)
MatrixNf
scale(VectorNf v)
void
set(int row, int col, double val)
void
set(int row, int col, float val)
void
setIdentity()
void
setZero()
int
size()
MatrixNf
sub(MatrixNf m)
float[]
toArray()
float[]
toArray(boolean columnMajor)
MatrixNd
toDouble()
MatrixNf
toFloat()
Matrix2f
toMatrix2()
Matrix3f
toMatrix3()
Matrix4f
toMatrix4()
String
toString()
float
trace()
VectorNf
transform(float... vec)
VectorNf
transform(VectorNf v)
MatrixNf
translate(float... v)
MatrixNf
translate(VectorNf v)
MatrixNf
transpose()
-
-
-
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:
determinant
in 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
-
-