public class MathUtils
extends java.lang.Object
null.| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
createFormattedMatrixString(float[] array)
Create a string representation of the given array, as a matrix,
interpreting it as a matrix that is stored in column-major order.
|
static float[] |
createIdentity4x4()
Creates a 4x4 identity matrix
|
static java.lang.String |
createMatrixString(float[] array)
Create a string representation of the given array, as a matrix,
interpreting it as a matrix that is stored in column-major order.
|
static void |
getRotationScale(float[] sourceMatrix4x4,
float[] targetMatrix3x3)
Obtains the upper 3x3 matrix (which describes the rotation- and
scaling part of the transformation) of the given 4x4 source matrix,
and writes it into the given target 3x3 matrix.
|
static void |
infinitePerspective4x4(float fovyDeg,
float aspect,
float zNear,
float[] m)
Fill the given matrix to describe an infinite perspective projection
with the given parameters.
|
static void |
invert3x3(float[] m,
float[] inv)
Inverts the given matrix and writes the result into the given target
matrix.
|
static void |
invert4x4(float[] m,
float[] inv)
Inverts the given matrix and writes the result into the given target
matrix.
|
static void |
mul4x4(float[] a,
float[] b,
float[] m)
Fills the given result matrix with the product of the given matrices.
|
static void |
perspective4x4(float fovyDeg,
float aspect,
float zNear,
float zFar,
float[] m)
Fill the given matrix to describe a perspective projection with the
given parameters.
|
static void |
quaternionToMatrix4x4(float[] q,
float[] m)
Fills the given matrix, with the values for the rotation that is
described by the given quaternion.
|
static void |
setIdentity4x4(float[] m)
Set the given matrix to be the identity matrix.
|
static void |
transformPoint3D(float[] matrix4x4,
float[] point3D,
float[] result3D)
Transform the given 3D point with the given 4x4 matrix (thus,
treating the non-present fourth component of the point as
being 1.0), and write the result into the given result array.
|
static void |
translate(float[] m,
float x,
float y,
float z,
float[] result)
Writes the given matrix into the given result matrix, with the
given values added to the translation component
|
static void |
transpose4x4(float[] m,
float[] t)
Transpose the given matrix, and write the result into the given
target matrix.
|
public static float[] createIdentity4x4()
public static void setIdentity4x4(float[] m)
m - The matrixpublic static void getRotationScale(float[] sourceMatrix4x4,
float[] targetMatrix3x3)
sourceMatrix4x4 - The source matrixtargetMatrix3x3 - The target matrixpublic static void transpose4x4(float[] m,
float[] t)
m - The input matrixt - The target matrixpublic static void mul4x4(float[] a,
float[] b,
float[] m)
a - The first matrixb - The second matrixm - The result matrixpublic static void quaternionToMatrix4x4(float[] q,
float[] m)
null. The quaternion must have at least length 4.q - The quaternionm - The matrixpublic static void invert4x4(float[] m,
float[] inv)
m - The input matrixinv - The inverse matrixpublic static void invert3x3(float[] m,
float[] inv)
m - The input matrixinv - The inverse matrixpublic static void translate(float[] m,
float x,
float y,
float z,
float[] result)
m - The input matrixx - The x-translationy - The y-translationz - The z-translationresult - The result matrixpublic static void infinitePerspective4x4(float fovyDeg,
float aspect,
float zNear,
float[] m)
fovyDeg - The Field-Of-View, in y-direction, in degreesaspect - The aspect ratiozNear - The z-value of the near clipping planem - The matrix to fillpublic static void perspective4x4(float fovyDeg,
float aspect,
float zNear,
float zFar,
float[] m)
fovyDeg - The Field-Of-View, in y-direction, in degreesaspect - The aspect ratiozNear - The z-value of the near clipping planezFar - The z-value of the far clipping planem - The matrix to fillpublic static void transformPoint3D(float[] matrix4x4,
float[] point3D,
float[] result3D)
matrix4x4 - The matrixpoint3D - The input pointresult3D - The result pointpublic static java.lang.String createMatrixString(float[] array)
null. If it is not null,
then it must either have 3x3 elements or 4x4 elements.array - The arraypublic static java.lang.String createFormattedMatrixString(float[] array)
null. If it is not null,
then it must either have 3x3 elements or 4x4 elements. array - The arrayCopyright © 2022. All Rights Reserved.