public class Matrix extends Object
| Constructor and Description |
|---|
Matrix() |
| Modifier and Type | Method and Description |
|---|---|
static double[] |
changeOrientation(double[] input) |
static float[] |
changeOrientation(float[] input) |
static void |
copy(float[] mModelMatrix,
float[] mModelMatrix2) |
static void |
dump(double[] matrix) |
static void |
dump(float[] result) |
static void |
dump(String message,
double[] matrix) |
static void |
dumpIfNotId(double[] matrix) |
static void |
frustumM(float[] m,
int offset,
float left,
float right,
float bottom,
float top,
float near,
float far)
Define a projection matrix in terms of six clip planes
|
static double[] |
identity() |
static float[] |
identityF() |
static boolean |
invertM(double[] mInv,
int mInvOffset,
double[] m,
int mOffset) |
static boolean |
invertM(float[] mInv,
int mInvOffset,
float[] m,
int mOffset)
Inverts a 4 x 4 matrix.
|
static boolean |
isIdentity(double[] other) |
static double |
length(double x,
double y,
double z) |
static float |
length(float x,
float y,
float z)
Computes the length of a vector
|
static void |
main(String[] args) |
static void |
multiplyMM(double[] result,
int resultOffset,
double[] lhs,
int lhsOffset,
double[] rhs,
int rhsOffset) |
static void |
multiplyMM(float[] result,
int resultOffset,
float[] lhs,
int lhsOffset,
float[] rhs,
int rhsOffset)
Multiply two 4x4 matrices together and store the result in a third 4x4
matrix.
|
static void |
multiplyMV(double[] resultVec,
int resultVecOffset,
double[] lhsMat,
int lhsMatOffset,
double[] rhsVec,
int rhsVecOffset) |
static void |
multiplyMV(float[] resultVec,
int resultVecOffset,
double[] lhsMat,
int lhsMatOffset,
float[] rhsVec,
int rhsVecOffset) |
static void |
multiplyMV(float[] resultVec,
int resultVecOffset,
float[] lhsMat,
int lhsMatOffset,
float[] rhsVec,
int rhsVecOffset)
Multiply a 4 element vector by a 4x4 matrix and store the result in a 4
element column vector.
|
static double[] |
multiplyV(double[] transformationMatrix,
double[] coordinates) |
static float[] |
multiplyV(float[] transformationMatrix,
float[] coordinates) |
static void |
orthoM(float[] m,
int mOffset,
float left,
float right,
float bottom,
float top,
float near,
float far)
Computes an orthographic projection matrix.
|
static void |
perspectiveM(float[] m,
int offset,
float fovy,
float aspect,
float zNear,
float zFar)
Define a projection matrix in terms of a field of view angle, an
aspect ratio, and z clip planes
|
static void |
rotateM(double[] rm,
int rmOffset,
double[] m,
int mOffset,
double a,
double x,
double y,
double z) |
static void |
rotateM(double[] m,
int mOffset,
double a,
double x,
double y,
double z) |
static void |
rotateM(float[] rm,
int rmOffset,
float[] m,
int mOffset,
float a,
float x,
float y,
float z)
Rotates matrix m by angle a (in degrees) around the axis (x, y, z)
|
static void |
rotateM(float[] m,
int mOffset,
float a,
float x,
float y,
float z)
Rotates matrix m in place by angle a (in degrees)
around the axis (x, y, z)
|
static void |
scaleM(double[] m,
int mOffset,
float x,
float y,
float z) |
static void |
scaleM(float[] sm,
int smOffset,
float[] m,
int mOffset,
float x,
float y,
float z)
Scales matrix m by x, y, and z, putting the result in sm
|
static void |
scaleM(float[] m,
int mOffset,
float x,
float y,
float z)
Scales matrix m in place by sx, sy, and sz
|
static void |
setIdentityM(double[] sm,
int smOffset)
Sets matrix m to the identity matrix.
|
static void |
setIdentityM(float[] sm,
int smOffset)
Sets matrix m to the identity matrix.
|
static void |
setLookAtM(float[] rm,
int rmOffset,
float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ)
Define a viewing transformation in terms of an eye point, a center of
view, and an up vector.
|
static void |
setRotateEulerM(float[] rm,
int rmOffset,
float x,
float y,
float z)
Converts Euler angles to a rotation matrix
|
static void |
setRotateM(double[] rm,
int rmOffset,
double a,
double x,
double y,
double z) |
static void |
setRotateM(float[] rm,
int rmOffset,
float a,
float x,
float y,
float z)
Rotates matrix m by angle a (in degrees) around the axis (x, y, z)
|
static void |
translateM(double[] m,
int mOffset,
double x,
double y,
double z)
Translates matrix m by x, y, and z in place.
|
static void |
translateM(float[] tm,
int tmOffset,
float[] m,
int mOffset,
float x,
float y,
float z)
Translates matrix m by x, y, and z, putting the result in tm
|
static void |
translateM(float[] m,
int mOffset,
float x,
float y,
float z)
Translates matrix m by x, y, and z in place.
|
static void |
transposeM(float[] mTrans,
int mTransOffset,
float[] m,
int mOffset)
Transposes a 4 x 4 matrix.
|
public static void main(String[] args)
public static void multiplyMM(float[] result,
int resultOffset,
float[] lhs,
int lhsOffset,
float[] rhs,
int rhsOffset)
result - The float array that holds the result.resultOffset - The offset into the result array where the result is
stored.lhs - The float array that holds the left-hand-side matrix.lhsOffset - The offset into the lhs array where the lhs is storedrhs - The float array that holds the right-hand-side matrix.rhsOffset - The offset into the rhs array where the rhs is stored.IllegalArgumentException - if result, lhs, or rhs are null, or if
resultOffset + 16 > result.length or lhsOffset + 16 > lhs.length or
rhsOffset + 16 > rhs.length.public static void multiplyMM(double[] result,
int resultOffset,
double[] lhs,
int lhsOffset,
double[] rhs,
int rhsOffset)
public static float[] multiplyV(float[] transformationMatrix,
float[] coordinates)
public static double[] multiplyV(double[] transformationMatrix,
double[] coordinates)
public static void multiplyMV(float[] resultVec,
int resultVecOffset,
float[] lhsMat,
int lhsMatOffset,
float[] rhsVec,
int rhsVecOffset)
resultVec - The float array that holds the result vector.resultVecOffset - The offset into the result array where the result
vector is stored.lhsMat - The float array that holds the left-hand-side matrix.lhsMatOffset - The offset into the lhs array where the lhs is storedrhsVec - The float array that holds the right-hand-side vector.rhsVecOffset - The offset into the rhs vector where the rhs vector
is stored.IllegalArgumentException - if resultVec, lhsMat,
or rhsVec are null, or if resultVecOffset + 4 > resultVec.length
or lhsMatOffset + 16 > lhsMat.length or
rhsVecOffset + 4 > rhsVec.length.public static void multiplyMV(float[] resultVec,
int resultVecOffset,
double[] lhsMat,
int lhsMatOffset,
float[] rhsVec,
int rhsVecOffset)
public static void multiplyMV(double[] resultVec,
int resultVecOffset,
double[] lhsMat,
int lhsMatOffset,
double[] rhsVec,
int rhsVecOffset)
public static void transposeM(float[] mTrans,
int mTransOffset,
float[] m,
int mOffset)
mTrans - the array that holds the output inverted matrixmTransOffset - an offset into mInv where the inverted matrix is
stored.m - the input arraymOffset - an offset into m where the matrix is stored.public static boolean invertM(float[] mInv,
int mInvOffset,
float[] m,
int mOffset)
mInv - the array that holds the output inverted matrixmInvOffset - an offset into mInv where the inverted matrix is
stored.m - the input arraymOffset - an offset into m where the matrix is stored.public static boolean invertM(double[] mInv,
int mInvOffset,
double[] m,
int mOffset)
public static void orthoM(float[] m,
int mOffset,
float left,
float right,
float bottom,
float top,
float near,
float far)
m - returns the resultmOffset - left - right - bottom - top - near - far - public static void frustumM(float[] m,
int offset,
float left,
float right,
float bottom,
float top,
float near,
float far)
m - the float array that holds the perspective matrixoffset - the offset into float array m where the perspective
matrix data is writtenleft - right - bottom - top - near - far - public static void perspectiveM(float[] m,
int offset,
float fovy,
float aspect,
float zNear,
float zFar)
m - the float array that holds the perspective matrixoffset - the offset into float array m where the perspective
matrix data is writtenfovy - field of view in y direction, in degreesaspect - width to height aspect ratio of the viewportzNear - zFar - public static float length(float x,
float y,
float z)
x - x coordinate of a vectory - y coordinate of a vectorz - z coordinate of a vectorpublic static double length(double x,
double y,
double z)
public static void setIdentityM(float[] sm,
int smOffset)
sm - returns the resultsmOffset - index into sm where the result matrix startspublic static void setIdentityM(double[] sm,
int smOffset)
sm - returns the resultsmOffset - index into sm where the result matrix startspublic static void scaleM(float[] sm,
int smOffset,
float[] m,
int mOffset,
float x,
float y,
float z)
sm - returns the resultsmOffset - index into sm where the result matrix startsm - source matrixmOffset - index into m where the source matrix startsx - scale factor xy - scale factor yz - scale factor zpublic static void scaleM(float[] m,
int mOffset,
float x,
float y,
float z)
m - matrix to scalemOffset - index into m where the matrix startsx - scale factor xy - scale factor yz - scale factor zpublic static void scaleM(double[] m,
int mOffset,
float x,
float y,
float z)
public static void translateM(float[] tm,
int tmOffset,
float[] m,
int mOffset,
float x,
float y,
float z)
tm - returns the resulttmOffset - index into sm where the result matrix startsm - source matrixmOffset - index into m where the source matrix startsx - translation factor xy - translation factor yz - translation factor zpublic static void translateM(float[] m,
int mOffset,
float x,
float y,
float z)
m - matrixmOffset - index into m where the matrix startsx - translation factor xy - translation factor yz - translation factor zpublic static void translateM(double[] m,
int mOffset,
double x,
double y,
double z)
m - matrixmOffset - index into m where the matrix startsx - translation factor xy - translation factor yz - translation factor zpublic static void rotateM(float[] rm,
int rmOffset,
float[] m,
int mOffset,
float a,
float x,
float y,
float z)
rm - returns the resultrmOffset - index into rm where the result matrix startsm - source matrixmOffset - index into m where the source matrix startsa - angle to rotate in degreesx - scale factor xy - scale factor yz - scale factor zpublic static void rotateM(double[] rm,
int rmOffset,
double[] m,
int mOffset,
double a,
double x,
double y,
double z)
public static void rotateM(float[] m,
int mOffset,
float a,
float x,
float y,
float z)
m - source matrixmOffset - index into m where the matrix startsa - angle to rotate in degreesx - scale factor xy - scale factor yz - scale factor zpublic static void rotateM(double[] m,
int mOffset,
double a,
double x,
double y,
double z)
public static void setRotateM(float[] rm,
int rmOffset,
float a,
float x,
float y,
float z)
rm - returns the resultrmOffset - index into rm where the result matrix startsa - angle to rotate in degreesx - scale factor xy - scale factor yz - scale factor zpublic static void setRotateM(double[] rm,
int rmOffset,
double a,
double x,
double y,
double z)
public static void setRotateEulerM(float[] rm,
int rmOffset,
float x,
float y,
float z)
rm - returns the resultrmOffset - index into rm where the result matrix startsx - angle of rotation, in degreesy - angle of rotation, in degreesz - angle of rotation, in degreespublic static void setLookAtM(float[] rm,
int rmOffset,
float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ)
rm - returns the resultrmOffset - index into rm where the result matrix startseyeX - eye point XeyeY - eye point YeyeZ - eye point ZcenterX - center of view XcenterY - center of view YcenterZ - center of view ZupX - up vector XupY - up vector YupZ - up vector Zpublic static void dump(float[] result)
public static void copy(float[] mModelMatrix,
float[] mModelMatrix2)
public static float[] changeOrientation(float[] input)
public static double[] changeOrientation(double[] input)
public static void dump(String message, double[] matrix)
public static void dump(double[] matrix)
public static void dumpIfNotId(double[] matrix)
public static double[] identity()
public static float[] identityF()
public static boolean isIdentity(double[] other)
Copyright © 2018 OpenSource BIM. All rights reserved.