java.lang.Object
org.spongepowered.math.matrix.MatrixNd
- All Implemented Interfaces:
Serializable
,Cloneable
,Matrixd
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabs()
ceil()
clone()
column
(int col) static MatrixNd
createLookAt
(int size, Vector3d eye, Vector3d at, Vector3d up) Creates a "look at" matrix for the given eye point.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 valuesstatic 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 valuesstatic 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 planesstatic 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 planesstatic MatrixNd
createRotation
(int size, Complexd rot) static MatrixNd
createRotation
(int size, Quaterniond rot) static MatrixNd
createScaling
(double... vec) static MatrixNd
static MatrixNd
createTranslation
(double... vec) static MatrixNd
double
div
(double a) div
(float a) boolean
floor()
double
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
(Quaterniond rot) round()
row
(int row) scale
(double... v) void
set
(int row, int col, double val) void
set
(int row, int col, float val) final void
void
setZero()
int
size()
double[]
toArray()
double[]
toArray
(boolean columnMajor) toDouble()
toFloat()
toString()
double
trace()
transform
(double... vec) translate
(double... v)
-
Field Details
-
IDENTITY_2
-
IDENTITY_3
-
IDENTITY_4
-
-
Constructor Details
-
MatrixNd
public MatrixNd(int size) -
MatrixNd
-
MatrixNd
-
MatrixNd
-
MatrixNd
public MatrixNd(double... m) -
MatrixNd
-
-
Method Details
-
size
public int size() -
get
public double get(int row, int col) -
row
-
column
-
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
-
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 double trace() -
determinant
public double determinant()- Specified by:
determinant
in interfaceMatrixd
-
invert
-
toMatrix2
-
toMatrix3
-
toMatrix4
-
toArray
public double[] toArray() -
toFloat
-
toDouble
-
toArray
public double[] 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
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
-