|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjme.math.Matrix
Matrix
defines and maintains a 4x4 matrix. This matrix is
intended for use in a translation and rotational capacity. It provides
convinience methods for creating the matrix from a multitude of sources.
Field Summary | |
float[][] |
matrix
|
Constructor Summary | |
Matrix()
Constructor instantiates a new Matrix that is set to the
identity matrix. |
|
Matrix(Matrix mat)
Constructor instantiates a new Matrix that is set to the
provided matrix. |
Method Summary | |
void |
add(Matrix matrix)
add adds the values of a parameter matrix to this matrix. |
void |
angleRotationDegrees(Vector angles)
|
void |
angleRotationRadians(Vector angles)
|
void |
copy(Matrix matrix)
|
float[][] |
getMatrix()
getMatrix returns the current matrix as an array of
floats. |
void |
inverseRotateVect(float[] vector)
inverseRotateVect rotates a given vector by the rotation
part of this matrix. |
void |
inverseTranslateVect(float[] vector)
inverseTranslateVect translates a given vector by the
translation part of this matrix. |
void |
loadIdentity()
loadIdentity sets this matrix to the identity matrix,
namely all zeros with ones along the diagonal. |
void |
multiply(float scalar)
multiply multiplies this matrix by a scalar. |
Matrix |
multiply(Matrix in2)
multiply multiplies this matrix with another matrix. |
void |
set(float[] matrix)
|
void |
set(float[][] matrix)
set sets the values of this matrix from an array of
values. |
void |
set(Quaternion quaternion)
|
void |
setInverseRotationDegrees(float[] angles)
setInverseRotationDegrees builds an inverted rotation
from Euler angles that are in degrees. |
void |
setInverseRotationRadians(float[] angles)
setInverseRotationRadians builds an inverted rotation
from Euler angles that are in radians. |
void |
setInverseTranslation(float[] translation)
setInverseTranslation will set the matrix's inverse
translation values. |
void |
setRotationQuaternion(Quaternion quat)
setRotationQuaternion builds a rotation from a
Quaternion . |
void |
setTranslation(float[] translation)
setTranslation will set the matrix's translation values. |
void |
tensorProduct(Vector u,
Vector v)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public float[][] matrix
Constructor Detail |
public Matrix()
Matrix
that is set to the
identity matrix.
public Matrix(Matrix mat)
Matrix
that is set to the
provided matrix. This constructor copies a given Matrix. If the
provided matrix is null, the constructor sets the matrix to the
identity.
mat
- the matrix to copy.Method Detail |
public void loadIdentity()
loadIdentity
sets this matrix to the identity matrix,
namely all zeros with ones along the diagonal.
public void set(float[][] matrix)
set
sets the values of this matrix from an array of
values.
matrix
- the matrix to set the value to.
MonkeyRuntimeException
- if the array is not of size 16.public void set(float[] matrix)
public void set(Quaternion quaternion)
public void copy(Matrix matrix)
public void add(Matrix matrix)
add
adds the values of a parameter matrix to this matrix.
matrix
- the matrix to add to this.public void multiply(float scalar)
multiply
multiplies this matrix by a scalar.
scalar
- the scalar to multiply this matrix by.public Matrix multiply(Matrix in2)
multiply
multiplies this matrix with another matrix. The
result matrix will then be returned.
This matrix will be on the left hand side, while the parameter matrix
will be on the right.
in2
- the matrix to multiply this matrix by.
MonkeyRuntimeException
- if matrix is null.public void setTranslation(float[] translation)
setTranslation
will set the matrix's translation values.
translation
- the new values for the translation.
MonkeyRuntimeException
- if translation is not size 3.public void setInverseTranslation(float[] translation)
setInverseTranslation
will set the matrix's inverse
translation values.
translation
- the new values for the inverse translation.
MonkeyRuntimeException
- if translation is not size 3.public void angleRotationRadians(Vector angles)
public void angleRotationDegrees(Vector angles)
public void setRotationQuaternion(Quaternion quat)
setRotationQuaternion
builds a rotation from a
Quaternion
.
quat
- the quaternion to build the rotation from.
MonkeyRuntimeException
- if quat is null.public void setInverseRotationRadians(float[] angles)
setInverseRotationRadians
builds an inverted rotation
from Euler angles that are in radians.
angles
- the Euler angles in radians.
MonkeyRuntimeException
- if angles is not size 3.public void setInverseRotationDegrees(float[] angles)
setInverseRotationDegrees
builds an inverted rotation
from Euler angles that are in degrees.
angles
- the Euler angles in degrees.
MonkeyRuntimeException
- if angles is not size 3.public float[][] getMatrix()
getMatrix
returns the current matrix as an array of
floats. Size 16.
public void inverseTranslateVect(float[] vector)
inverseTranslateVect
translates a given vector by the
translation part of this matrix.
vector
- the vector to be translated.
MonkeyRuntimeException
- if the size of the vector is not 3.public void inverseRotateVect(float[] vector)
inverseRotateVect
rotates a given vector by the rotation
part of this matrix.
vector
- the vector to be rotated.
MonkeyRuntimeException
- if the size of the vector is not 3.public void tensorProduct(Vector u, Vector v)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |