java.lang.Object
org.spongepowered.math.matrix.MatrixNf
- All Implemented Interfaces:
Serializable
,Cloneable
,Matrixf
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabs()
ceil()
clone()
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
static MatrixNf
createTranslation
(float... vec) static MatrixNf
float
div
(double a) div
(float a) boolean
floor()
float
get
(int row, int col) int
hashCode()
invert()
mul
(double a) mul
(float a) negate()
pow
(double pow) pow
(float pow) resize
(int size) rotate
(Quaternionf rot) round()
row
(int row) scale
(float... v) void
set
(int row, int col, double val) void
set
(int row, int col, float val) final void
void
setZero()
int
size()
float[]
toArray()
float[]
toArray
(boolean columnMajor) toDouble()
toFloat()
toString()
float
trace()
transform
(float... vec) translate
(float... v)
-
Field Details
-
IDENTITY_2
-
IDENTITY_3
-
IDENTITY_4
-
-
Constructor Details
-
MatrixNf
public MatrixNf(int size) -
MatrixNf
-
MatrixNf
-
MatrixNf
-
MatrixNf
public MatrixNf(float... m) -
MatrixNf
-
-
Method Details
-
size
public int size() -
get
public float get(int row, int col) -
row
-
column
-
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
-
add
-
sub
-
mul
-
mul
-
mul
-
div
-
div
-
div
-
pow
-
pow
-
translate
-
translate
-
scale
-
scale
-
rotate
-
rotate
-
transform
-
transform
-
floor
-
ceil
-
round
-
abs
-
negate
-
transpose
-
trace
public float trace() -
determinant
public float determinant()- Specified by:
determinant
in interfaceMatrixf
-
invert
-
toMatrix2
-
toMatrix3
-
toMatrix4
-
toArray
public float[] toArray() -
toFloat
-
toDouble
-
toArray
public float[] toArray(boolean columnMajor) -
toString
-
equals
-
hashCode
public int hashCode() -
clone
-
createScaling
-
createScaling
-
createTranslation
-
createTranslation
-
createRotation
-
createRotation
-
createLookAt
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
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
-