|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threed.jpct.Matrix
This is jPCT's basic class for working with 4x4 matrices. All matrices in jPCT are row major.
| Constructor Summary | |
Matrix()
Creates a new matrix and sets it to the identity matrix. |
|
Matrix(Matrix m)
Creates a matrix from a given one. |
|
| Method Summary | |
Matrix |
cloneMatrix()
Creates a copy of this matrix. |
boolean |
equals(java.lang.Object obj)
|
float[] |
getDump()
Dumps a matrix row-wise into a float[16]-array. |
SimpleVector |
getTranslation()
Returns the translation this matrix would represent when viewed as a translation matrix. |
SimpleVector |
getXAxis()
Returns the x-axis this matrix would represent when viewed as a rotation matrix. |
SimpleVector |
getYAxis()
Returns the y-axis this matrix would represent when viewed as a rotation matrix. |
SimpleVector |
getZAxis()
Returns the z-axis this matrix would represent when viewed as a rotation matrix. |
void |
interpolate(Matrix source,
Matrix dest,
float weight)
Fills the matrix with data interpolated between the source and the destination matrix. |
Matrix |
invert()
Calculates the inverse of this matrix. |
Matrix |
invert3x3()
Calculates the inverse of this matrix as if this matrix would be a 3x3 one (instead of the 4x4 it actually is). |
boolean |
isIdentity()
Returns true, if this matrix is the identity matrix. |
void |
matMul(Matrix mat2)
Multiplies this matrix with another one. |
void |
orthonormalize()
Orthonormalizes a matrix using the Gramm-Schmidt orthonormalization algorithm. |
void |
orthonormalizeDouble()
Orthonormalizes a matrix using the Gramm-Schmidt orthonormalization algorithm. |
void |
rotateAxis(SimpleVector axis,
float angle)
Rotates the matrix around an arbitrary axis. |
void |
rotateX(float w)
Rotates the matrix around the X-axis (counter clockwise for positive w). |
void |
rotateY(float w)
Rotates the matrix around the Y-axis (clockwise for positive w). |
void |
rotateZ(float w)
Rotates the matrix around the Z-axis (counter clockwise for positive w). |
void |
scalarMul(float scalar)
Multiplies this matrix with a scalar (the left upper 3x3 part only). |
void |
set(int row,
int col,
float value)
Injects a value directly into the matrix at a position. |
void |
setDump(float[] dump)
Reimports a dumped matrix (or every data from a float[16]-array) into a Matrix. |
void |
setIdentity()
(Re-)sets this matrix to the identity matrix. |
void |
setTo(Matrix source)
Sets this matrix' values to the ones of the source matrix. |
java.lang.String |
toString()
|
void |
translate(float x,
float y,
float z)
Applies a translation to this matrix. |
void |
translate(SimpleVector trans)
Applies a translation to this matrix. |
| Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Matrix()
public Matrix(Matrix m)
m - the source matrix| Method Detail |
public final boolean isIdentity()
public final void setIdentity()
public final void scalarMul(float scalar)
scalar - the scalar to multiply withpublic final void matMul(Matrix mat2)
mat2 - the matrix to multiply withpublic final void rotateX(float w)
w - the rotation anglepublic final void rotateY(float w)
w - the rotation anglepublic final void rotateZ(float w)
w - the rotation angle
public final void rotateAxis(SimpleVector axis,
float angle)
axis - a direction-vector pointing into the axis directionangle - the angle of the rotation
public final void interpolate(Matrix source,
Matrix dest,
float weight)
source - the source matrixdest - the destination matrixweight - the weight of the destination matrix (0-1)public final SimpleVector getTranslation()
public final SimpleVector getXAxis()
public final SimpleVector getYAxis()
public final SimpleVector getZAxis()
public final void translate(SimpleVector trans)
trans - the translation
public final void translate(float x,
float y,
float z)
x - the x component of the translationy - the y component of the translationz - the z component of the translationpublic final Matrix cloneMatrix()
public final Matrix invert()
public final Matrix invert3x3()
invert()public final void orthonormalizeDouble()
orthonormalize()public final void orthonormalize()
public final float[] getDump()
public final void setDump(float[] dump)
dump - the "dump"public final void setTo(Matrix source)
source - the source matrix
public final void set(int row,
int col,
float value)
row - the rowcol - the columnvalue - the value to setpublic java.lang.String toString()
public boolean equals(java.lang.Object obj)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||