|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthmi.math.Mat4f
public final class Mat4f
A collection of static methods for 4 X 4 matrices, represented by float arrays of length 16. Matrices are stored in row-major order, i.e., the first four elements represent the first row, the next four represent the second row etcetera. Note that this deviates from the OpenGL order.
| Field Summary | |
|---|---|
private static int |
BUFSIZE
|
static int |
COL_SIZE
|
static float |
DEGTORADF
|
static float[] |
ID
The 4X4 identity matrix. |
static int |
M00
|
static int |
M01
|
static int |
M02
|
static int |
M03
|
static int |
M10
|
static int |
M11
|
static int |
M12
|
static int |
M13
|
static int |
M20
|
static int |
M21
|
static int |
M22
|
static int |
M23
|
static int |
M30
|
static int |
M31
|
static int |
M32
|
static int |
M33
|
static int |
MAT4F_SIZE
|
static int |
ROW_SIZE
Length of Mat4f arrays is 16 |
| Constructor Summary | |
|---|---|
private |
Mat4f()
|
| Method Summary | |
|---|---|
static void |
clearRotationScale(float[] m)
Sets the rotation/scaling part of a 4X4 (or 3X4) matrix m, i.e. the upper left 3X3 part, to the 3X3 identity matrix The remaining parts are not modified. |
static void |
convertTo4x4(float[] m)
Converts a 3 X 3 matrix m into a 4 X 4 matrix, by adding a right colum and a bottom row, consisting of zero enties. |
static double |
decomposeToTRSMat3f(float[] matrix,
float[] translation,
float[] rotation,
float[] scaleMatrix)
Decomposes a 4 x 4 (or 3 X 4) matrix into a translation vector (a Vec3f array), a rotation quaternion (a Vec4f array), and a 3 X 3 scaling matrix (a Mat3f array), using a polar decompose operation for the upper left 3 x 3 matrix. |
static Mat3f.ScalingType |
decomposeToTRSMat3f(float[] matrix,
float[] translation,
float[] rotation,
float[] scaleMatrix,
float epsilon)
Deprecated. |
static double |
det(float[] m)
Determines the determinant of m. |
static float |
dInf(float[] a,
float[] b)
|
static boolean |
epsilonEquals(float[] a,
float[] b,
float epsilon)
Tests for equality of matrix components within epsilon. |
static boolean |
equals(float[] a,
float[] b)
Tests for (strict) equality of matrix components. |
static String |
explainMat4f(float[] mat4f,
int fieldwidth,
int precision,
float epsilon)
converts a Mat4f matrix to a String, for printing on a console, that decomposes the matrix into rotation, translation, and scale. |
static float[] |
from3x3(float[] m3x3)
Creates a new 4X4 matrix from a 3 X 3 matrix, by adding a right colum and a bottom row, consisting of zero enties. |
static void |
getColumn(float[] m,
int j,
float[] col)
Copies a matrix column with index j from a 4X4 matrix m. |
static float |
getElement(float[] m,
int i,
int j)
Gets the float value of matrix element m(i,j), form a row-major order 4X4 matrix m. |
static float[] |
getIdentity()
Allocates a new 4X4 matrix, initialized to the identity matrix. |
static float[] |
getLookAtMatrix(float[] eyePos,
float[] centerPos,
float[] upVec)
Allocates a new LookAt matrix, in OpenGL style: from eyePos, look at center, where upVec is used to infer the direction of the Y-axis (needs not be orthogonal to viewing direction) The viewing direction is considered to be the negative Z-axis, |
static float[] |
getMat4f()
Returns a new float[16] array with zero components |
static void |
getRow(float[] m,
int i,
float[] row)
Copies a matrix row with index i from a 4X4 matrix m. |
static float[] |
getScalingMatrix(float[] s)
Allocates a new 4X4 scaling matrix, with scaling factors specified in a length 3 float array. |
static float[] |
getSkewMatrix(float[] matrix,
float angle,
float[] rvec,
float[] tvec)
Allocates a new skew matrix, specified in Renderman style, by means of a tranlation vector tvec, a rotation vector rvec, and a rotation angle. |
static float[] |
getSkewMatrix(float angle,
float[] rvec,
float[] tvec)
See getSkewMatrix, with null matrix argument |
static void |
getTranslation(float[] t,
float[] m)
Retrieves the translation vector column for a 4X4 or 3X4 matrix m, i.e. the last 3X1 column, to a translation Vec3f vector t. |
static float[] |
getTranslationMatrix(float[] t)
Allocates a new 4X4 translation matrix, with translation vector specified in a length 3 float array. |
static float |
invertAffine(float[] dest,
float[] m)
Calculates the inverse of 4X4 matrix m, assuming that it consists of a 3X3 rotation/scaling part, a translation part in the last column, and a fourth row of the form (0, 0, 0, 1) This reprents an affine transform within 3D; it does not allow general 4X4 matrices, in particular projection matrices are not allowed here. |
static void |
invertRigid(float[] m)
|
static void |
invertRigid(float[] dest,
float[] m)
Efficient method for calculating the inverse of a rigid transform. |
static boolean |
isAffine(float[] matrix)
Checks the bottom row of a 4X4 matrix. |
static boolean |
isIdentity(float[] m)
Checks whether some matrix is actually the identity matrix. |
static boolean |
isProjective(float[] matrix)
Deprecated. |
static boolean |
isRigid(float[] m,
float epsilon)
Checks for orthogonality of the 3X3 upper-left submatrix, and checks that the last row is (0, 0, 0, 1). |
static boolean |
isZero(float[] m)
Checks whether some matrix is actually the zero matrix. |
static void |
mul(float[] dest,
float[] m)
Multiplies Mat4f matrix dest with Mat4f matrix A and stores the result back in dest. |
static void |
mul(float[] dest,
float[] a,
float[] b)
Multiplies Mat4f matrix a with Mat4f matrix b and stores the result in Mat4f matrix dest. |
static void |
mul3x4(float[] dest,
float[] a)
Equivalent to mul(dest, dest, a). |
static void |
mul3x4(float[] dest,
float[] a,
float[] b)
Multiplies two Mat4f matrices, assuming that the fourth row is of the form (0, 0, 0, 1). |
static void |
nonUniformScale(float[] m,
float[] scale)
Scales the upper left 3X3 part by means of non-uniform scaling factors, specified in a Vec3f array. |
static float |
norm1(float[] m)
Return the norm_1 of matrix m: the sum of the absolute values of all matrix elements. |
static float |
norm2(float[] m)
Return the norm-2 of matrix m: the square root of the sum of the squares of all elements. |
static float |
normInf(float[] m)
Return the max norm of matrix m: the max absolute value of the matrix elements. |
static void |
scale(float[] m,
float s)
Scales the upper left 3X3 part by means of common factor s. |
static void |
set(float[] dst,
float[] src)
Copies a 4X4 matrix src into matrix dst |
static void |
set(float[] dst,
float src00,
float src01,
float src02,
float src03,
float src10,
float src11,
float src12,
float src13,
float src20,
float src21,
float src22,
float src23,
float src30,
float src31,
float src32,
float src33)
Sets the 4x4 matrix in dst |
static void |
set(float[] dst,
int dstIndex,
float[] src,
int srcIndex)
Copies a 4X4 matrix src into matrix dst |
static void |
setElement(float[] m,
int i,
int j,
float value)
Sets the element m(i,j) from a (row-major) 4X4 matrix m to a specified float value. |
static void |
setFromTR(float[] m,
float[] t,
float[] q)
Sets all matrix component, from a translation Vec3f t and a rotation Quat4f q. |
static void |
setFromTRCS(float[] m,
float[] t,
float[] q,
float[] c,
float uscale)
Sets all matrix component, from a rotation Quat4f q, a rotation center Vec3f c, and a uniform scale. |
static void |
setFromTRCSVec3f(float[] m,
float[] t,
float[] q,
float[] c,
float[] s)
Sets all matrix component, from a rotation Quat4f q, a rotation center Vec3f c, scaling factors in the form of a Vec3f, and a Vec3f translation. |
static void |
setFromTRS(float[] m,
float[] t,
float[] q,
float uscale)
Sets all matrix component, from a translation Vec3f t, a rotation Quat4f q, and a uniform scaling float factor uscale. |
static void |
setFromTRSMat3f(float[] m,
float[] t,
float[] q,
float[] smatrix)
Sets all matrix component, from a rotation Quat4f q, scaling matrix in the form of a Mat3f, and a Vec3f translation. |
static void |
setFromTRSVec3f(float[] m,
float[] t,
float[] q,
float[] s)
Sets all matrix component, from a translation Vec3f t, rotation Quat4f q, and (non uniform) scaling factors in the form of a Vec3f. |
static void |
setIdentity(float[] m)
Resets the 4X4 matrix to the identity matrix. |
static void |
setRotation(float[] m,
float[] q)
Sets the rotation part of a 4X4 (or 3X4) matrix m, i.e. the upper left 3X3 part, from a Quat4f quaternion q. |
static void |
setRotation(float[] m,
int mIndex,
float[] q,
int qIndex)
Sets the rotation part of a 4X4 (or 3X4) matrix m, i.e. the upper left 3X3 part, from a Quat4f quaternion q. |
static void |
setRotationFromAxisAngle(float[] m,
float[] axis,
float angle)
Sets the rotation part of a 4X4 or 3X4 matrix m, i.e. the upper left 3X3 part, from an axis aray, of length 3, and an float angle. |
static void |
setRotationFromAxisAngle4f(float[] m,
float[] axisangle)
Sets the rotation part of a 4X4 or 3X4 matrix m, i.e. the upper left 3X3 part, from a axis-and-angle array, of length 4. |
static void |
setRotationFromAxisAngleDegrees(float[] m,
float[] axis,
float degrees)
Sets the rotation part of a 4X4 or 3X4 matrix m, i.e. the upper left 3X3 part, from an rotation axis and an angle, specified in degrees, not radians. |
static void |
setRotationScaleVec3f(float[] m,
float[] q,
float[] s)
Sets the rotation part of a 4X4 (or 3X4) matrix m, i.e. the upper left 3X3 part, from a Quat4f quaternion q and a Vec3f scaling array in the form of a Vec3f array. |
static void |
setTranslation(float[] m,
float[] t)
Sets the translation vector column for a 4X4 (or 3X4) matrix m, i.e. the last 3X1 column, from a translation Vec3f vector t. |
static void |
setZero(float[] m)
Resets the 4X4 matrix to zero. |
static String |
toString(float[] m)
Produces a String representation of a 4 X 4 matrix, suitable for printing, debugging etcetera |
static String |
toString(float[] m,
int tab)
Produces a String representation of Mat4f matrix m, taking into account tab spaces at the beginning of every newline. |
static String |
toString(float[] m,
int tab,
int fieldwidth,
int precision)
Produces a String representation of Mat4f matrix m, taking into account tab spaces at the beginning of every newline. |
static String |
toString(float[] m,
int tab,
String fmt)
Produces a String representation of Mat4f matrix m, taking into account tab spaces at the beginning of every newline. |
static void |
transformAffineMatrix(float[] m,
float[] destMat)
calculates a coordinate transform of matrix destMat in place. |
static void |
transformAffineMatrix(float[] m,
float[] destMat,
float[] srcMat)
calculates a coordinate transform of matrix srcMat and stores the result in destMat. |
static void |
transformAffineMatrix(float[] m,
float[] minv,
float[] destMat,
float[] srcMat)
calculates a coordinate transform of matrix srcMat and stores the result in destMat. |
static void |
transformPoint(float[] m,
float[] dest)
Equivalent to transformPoint(m, dest, dest) |
static void |
transformPoint(float[] m,
float[] dest,
float[] src)
Transforms a Vec3 (Nb!) |
static void |
transformPoint(float[] m,
float[] dest,
int destIndex)
Transforms a Vec3 (NB!) |
static void |
transformVec3f(float[] m,
float[] dest)
Deprecated. |
static void |
transformVec3f(float[] m,
float[] dest,
float[] src)
Deprecated. |
static void |
transformVec3f(float[] m,
float[] dest,
int dstIndex)
Deprecated. |
static void |
transformVec4f(float[] m,
float[] dest)
Transforms a Vec4 vector dest in place |
static void |
transformVec4f(float[] m,
float[] dest,
float[] src)
Transforms a Vec4 vector src, and puts the result in vector dest. |
static void |
transformVec4f(float[] m,
int mIndex,
float[] dest,
int destIndex,
float[] src,
int srcIndex)
Transforms a Vec4 vector src, and puts the result in vector dest. |
static void |
transformVector(float[] m,
float[] dest)
Equivalent to transformVector(m, dest, dest). |
static void |
transformVector(float[] m,
float[] dest,
float[] src)
Transforms a Vec3f array that represents a translation vector (as opposed to a geometric point). |
static void |
transformVector(float[] m,
float[] dest,
int destIndex)
Transforms a Vec3 (NB!) |
static void |
transpose(float[] m)
Transposes matrix m. |
static void |
transpose(float[] dest,
float[] m)
Sets matrix dest to the transpose of matrix m. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ROW_SIZE
public static final int COL_SIZE
public static final int MAT4F_SIZE
public static final int M00
public static final int M01
public static final int M02
public static final int M03
public static final int M10
public static final int M11
public static final int M12
public static final int M13
public static final int M20
public static final int M21
public static final int M22
public static final int M23
public static final int M30
public static final int M31
public static final int M32
public static final int M33
public static final float DEGTORADF
public static final float[] ID
private static final int BUFSIZE
| Constructor Detail |
|---|
private Mat4f()
| Method Detail |
|---|
public static float[] getMat4f()
public static void scale(float[] m,
float s)
public static void nonUniformScale(float[] m,
float[] scale)
public static float[] getScalingMatrix(float[] s)
public static float[] getTranslationMatrix(float[] t)
public static float[] getSkewMatrix(float angle,
float[] rvec,
float[] tvec)
public static float[] getSkewMatrix(float[] matrix,
float angle,
float[] rvec,
float[] tvec)
public static float[] getLookAtMatrix(float[] eyePos,
float[] centerPos,
float[] upVec)
public static float[] from3x3(float[] m3x3)
public static void convertTo4x4(float[] m)
public static void set(float[] dst,
int dstIndex,
float[] src,
int srcIndex)
public static void set(float[] dst,
float[] src)
public static void set(float[] dst,
float src00,
float src01,
float src02,
float src03,
float src10,
float src11,
float src12,
float src13,
float src20,
float src21,
float src22,
float src23,
float src30,
float src31,
float src32,
float src33)
public static void setFromTRCS(float[] m,
float[] t,
float[] q,
float[] c,
float uscale)
public static void setFromTRCSVec3f(float[] m,
float[] t,
float[] q,
float[] c,
float[] s)
public static void setFromTRSMat3f(float[] m,
float[] t,
float[] q,
float[] smatrix)
public static void setFromTRSVec3f(float[] m,
float[] t,
float[] q,
float[] s)
public static void setFromTRS(float[] m,
float[] t,
float[] q,
float uscale)
public static void setFromTR(float[] m,
float[] t,
float[] q)
public static void setRotationScaleVec3f(float[] m,
float[] q,
float[] s)
public static void setRotation(float[] m,
int mIndex,
float[] q,
int qIndex)
public static void setRotation(float[] m,
float[] q)
public static void clearRotationScale(float[] m)
public static void setRotationFromAxisAngleDegrees(float[] m,
float[] axis,
float degrees)
public static void setRotationFromAxisAngle4f(float[] m,
float[] axisangle)
public static void setRotationFromAxisAngle(float[] m,
float[] axis,
float angle)
public static void setTranslation(float[] m,
float[] t)
public static void getTranslation(float[] t,
float[] m)
public static void setZero(float[] m)
public static void setIdentity(float[] m)
public static float[] getIdentity()
public static boolean isIdentity(float[] m)
public static boolean isZero(float[] m)
public static void setElement(float[] m,
int i,
int j,
float value)
public static float getElement(float[] m,
int i,
int j)
public static void getRow(float[] m,
int i,
float[] row)
public static void getColumn(float[] m,
int j,
float[] col)
public static void mul(float[] dest,
float[] m)
public static void mul(float[] dest,
float[] a,
float[] b)
public static void mul3x4(float[] dest,
float[] a,
float[] b)
public static void mul3x4(float[] dest,
float[] a)
public static void transformVec4f(float[] m,
int mIndex,
float[] dest,
int destIndex,
float[] src,
int srcIndex)
public static void transformVec4f(float[] m,
float[] dest,
float[] src)
public static void transformVec4f(float[] m,
float[] dest)
@Deprecated
public static void transformVec3f(float[] m,
float[] dest)
@Deprecated
public static void transformVec3f(float[] m,
float[] dest,
int dstIndex)
@Deprecated
public static void transformVec3f(float[] m,
float[] dest,
float[] src)
public static void transformPoint(float[] m,
float[] dest,
float[] src)
public static void transformPoint(float[] m,
float[] dest)
public static void transformPoint(float[] m,
float[] dest,
int destIndex)
public static void transformVector(float[] m,
float[] dest,
float[] src)
public static void transformVector(float[] m,
float[] dest)
public static void transformVector(float[] m,
float[] dest,
int destIndex)
public static void transformAffineMatrix(float[] m,
float[] destMat)
public static void transformAffineMatrix(float[] m,
float[] minv,
float[] destMat,
float[] srcMat)
public static void transformAffineMatrix(float[] m,
float[] destMat,
float[] srcMat)
public static void transpose(float[] dest,
float[] m)
public static void transpose(float[] m)
public static void invertRigid(float[] dest,
float[] m)
public static void invertRigid(float[] m)
public static float invertAffine(float[] dest,
float[] m)
public static boolean equals(float[] a,
float[] b)
public static boolean epsilonEquals(float[] a,
float[] b,
float epsilon)
public static float dInf(float[] a,
float[] b)
public static float norm1(float[] m)
public static float norm2(float[] m)
public static float normInf(float[] m)
public static double det(float[] m)
public static boolean isAffine(float[] matrix)
public static boolean isRigid(float[] m,
float epsilon)
public static String toString(float[] m)
public static String toString(float[] m,
int tab,
int fieldwidth,
int precision)
public static String toString(float[] m,
int tab,
String fmt)
public static String toString(float[] m,
int tab)
public static double decomposeToTRSMat3f(float[] matrix,
float[] translation,
float[] rotation,
float[] scaleMatrix)
public static String explainMat4f(float[] mat4f,
int fieldwidth,
int precision,
float epsilon)
@Deprecated
public static Mat3f.ScalingType decomposeToTRSMat3f(float[] matrix,
float[] translation,
float[] rotation,
float[] scaleMatrix,
float epsilon)
@Deprecated public static boolean isProjective(float[] matrix)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||