

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object com.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[] 
fillDump(float[] dump)
Dumps a matrix rowwise into a given float[16]array and returns it. 
float 
get(int row,
int col)
Returns the value at a position in the matrix. 
float[] 
getDump()
Dumps a matrix rowwise into a float[16]array. 
SimpleVector 
getTranslation()
Returns the translation this matrix would represent when viewed as a translation matrix. 
SimpleVector 
getTranslation(SimpleVector toFill)
Returns the translation this matrix would represent when viewed as a translation matrix. 
SimpleVector 
getXAxis()
Returns the xaxis this matrix would represent when viewed as a rotation matrix. 
SimpleVector 
getXAxis(SimpleVector toFill)
Returns the xaxis this matrix would represent when viewed as a rotation matrix. 
SimpleVector 
getYAxis()
Returns the yaxis this matrix would represent when viewed as a rotation matrix. 
SimpleVector 
getYAxis(SimpleVector toFill)
Returns the yaxis this matrix would represent when viewed as a rotation matrix. 
SimpleVector 
getZAxis()
Returns the zaxis this matrix would represent when viewed as a rotation matrix. 
SimpleVector 
getZAxis(SimpleVector toFill)
Returns the zaxis this matrix would represent when viewed as a rotation matrix. 
int 
hashCode()

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 
invert(Matrix dst)
Calculates the inverse of this matrix and fills the result into the given matrix (which will be returned in addition). 
Matrix 
invert3x3()
Calculates the inverse of this matrix as if this matrix would be a 3x3 one (instead of the 4x4 it actually is). 
Matrix 
invert3x3(Matrix toFill)
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 maty)
Multiplies this matrix with another one. 
void 
orthonormalize()
Orthonormalizes a matrix using the GrammSchmidt orthonormalization algorithm. 
void 
orthonormalizeDouble()
Orthonormalizes a matrix using the GrammSchmidt orthonormalization algorithm. 
void 
rotateAxis(SimpleVector axis,
float angle)
Rotates the matrix around an arbitrary axis. 
void 
rotateX(float w)
Rotates the matrix around the Xaxis (counter clockwise for positive w). 
void 
rotateY(float w)
Rotates the matrix around the Yaxis (clockwise for positive w). 
void 
rotateZ(float w)
Rotates the matrix around the Zaxis (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 
setColumn(int col,
float v1,
float v2,
float v3,
float v4)
Inject values directly into a matrix' column. 
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 
setOrientation(SimpleVector dir,
SimpleVector up)
Sets the orientation of a rotation matrix by giving a direction and an upvector. 
void 
setRow(int row,
float v1,
float v2,
float v3,
float v4)
Inject values directly into a matrix' row. 
void 
setTo(Matrix source)
Sets this matrix' values to the ones of the source matrix. 
java.lang.String 
toString()

void 
transformToGL()
Transforms a matrix from jPCT's format into OpenGL's. 
void 
translate(float x,
float y,
float z)
Applies a translation to this matrix. 
void 
translate(SimpleVector trans)
Applies a translation to this matrix. 
Matrix 
transpose()
Calculates the transposed matrix of this matrix. 
Methods inherited from class java.lang.Object 
getClass, notify, notifyAll, wait, wait, wait 
Constructor Detail 
public Matrix()
public Matrix(Matrix m)
m
 the source matrixMethod 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 maty)
maty
 the matrix to multiply withpublic final void rotateX(float w)
w
 the rotation angle in radianspublic final void rotateY(float w)
w
 the rotation angle in radianspublic final void rotateZ(float w)
w
 the rotation angle in radianspublic final void rotateAxis(SimpleVector axis, float angle)
axis
 a directionvector pointing into the axis directionangle
 the angle of the rotation in radianspublic final void interpolate(Matrix source, Matrix dest, float weight)
source
 the source matrixdest
 the destination matrixweight
 the weight of the destination matrix (01)public final SimpleVector getTranslation()
public final SimpleVector getTranslation(SimpleVector toFill)
toFill
 the SimpleVector to fill with the result. This will also be returned.
public final SimpleVector getXAxis()
public final SimpleVector getYAxis()
public final SimpleVector getZAxis()
public final SimpleVector getXAxis(SimpleVector toFill)
toFill
 the vector to fill
public final SimpleVector getYAxis(SimpleVector toFill)
toFill
 the vector to fill
public final SimpleVector getZAxis(SimpleVector toFill)
toFill
 the vector to fill
public final void setOrientation(SimpleVector dir, SimpleVector up)
dir
 the directionup
 the upvectorpublic final void translate(SimpleVector trans)
trans
 the translationpublic 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 invert(Matrix dst)
dst
 the matrix to fill with the result.
public final Matrix invert3x3()
invert()
public final Matrix invert3x3(Matrix toFill)
toFill
 the matrix to fill. Can't be the same instance as the matrix to invert.
invert()
public final Matrix transpose()
public final void orthonormalizeDouble()
orthonormalize()
public final void orthonormalize()
public final float[] getDump()
public final float[] fillDump(float[] dump)
public final void setDump(float[] dump)
dump
 the "dump"public final void setTo(Matrix source)
source
 the source matrixpublic final void set(int row, int col, float value)
row
 the rowcol
 the columnvalue
 the value to setpublic final void setRow(int row, float v1, float v2, float v3, float v4)
row
 thw rowv1
 the first valuev2
 the second valuev3
 the third valuev4
 the fourth valuepublic final void setColumn(int col, float v1, float v2, float v3, float v4)
col
 thw columnv1
 the first valuev2
 the second valuev3
 the third valuev4
 the fourth valuepublic final float get(int row, int col)
row
 the rowcol
 the column
public java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object obj)
public void transformToGL()


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 