|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmr3d.debug.ErrorHandling
mr3d.lang.Matrix
The class Matrix is able to represent an mathematical 4x4 matrix object.
The following example assumes that the class mr3d.lang.Matrix
has been imported with import mr3d.lang.Matrix
in the head of the java-file.
// create a unit matrix
Matrix myMatrix = new Matrix(Matrix.TYPE_UNIT);
| Field Summary | |
private int[] |
matrixData
Elements or data of the matrix. |
private int |
matType
Internal type variable. |
static int |
TYPE_GENERIC
Type constant generic matrix. |
static int |
TYPE_ROTA
Type constant for rotation matrix. |
static int |
TYPE_SCAL
Type constant for scalation matrix. |
static int |
TYPE_TRAN
Type constant for translation matrix. |
static int |
TYPE_UNIT
Type constant for unit matrix. |
static int |
TYPE_ZERO
Type constant zero matrix. |
| Fields inherited from class mr3d.debug.ErrorHandling |
|
| Fields inherited from interface mr3d.debug.Debugable |
ERROR_INT, ERROR_STRING |
| Constructor Summary | |
Matrix()
Creates a new Matrix. |
|
| Method Summary | |
int |
get(int index)
Returns the matrix element at the specified linear index. |
int |
get(int line,
int column)
Returns the matrix element at the specified index. |
Matrix |
mul(Matrix matrix)
Multplies two matrices. |
Vector3D |
mul(Vector3D mulVec)
Multiplies a vector with a Matrix. |
private void |
selfMul(Matrix matrix)
Multiplies this matrix with the given matrix. |
void |
set(int[] args)
Overwrites the complete matrix data with the specified array. |
void |
set(int index,
int value)
Sets the matrix element at the specified index to be the specified value. |
void |
set(int line,
int column,
int value)
Sets the matrix element at the specified index to be the specified value. |
void |
setType(int newType)
Sets the matType of the Matrix. |
void |
toConsole()
Prints the contents of the matrix object to the Java console. |
void |
toConsole(java.lang.String msgString)
Prints the contents of the object to the Java console together with an information string. |
int |
type()
Returns the Matrix matType contant of the current Matrix. |
| Methods inherited from class mr3d.debug.ErrorHandling |
getErrMsg, notifyError |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private int[] matrixData
int-Array consisting of 16 elements.
This array is only accessible with the given set and get
functions.
private int matType
public static final int TYPE_GENERIC
public static final int TYPE_ROTA
public static final int TYPE_SCAL
public static final int TYPE_TRAN
public static final int TYPE_UNIT
public static final int TYPE_ZERO
| Constructor Detail |
public Matrix()
| Method Detail |
public int get(int index)
index - index of the matrix element in linear
coordinates (0 to 15)
matrixData
public int get(int line,
int column)
line - line index of matrix elementcolumn - column index of matrix element
matrixDatapublic Matrix mul(Matrix matrix)
Example
A matrix multiplication in the form ofMatrix3 = Matrix1 * Matrix2
can be realized this way:
Matrix Matrix3 = Matrix1.mul(Matrix2);
- Parameters:
matrix- matrix, which will be mutiplied to this matrix- Returns:
- resulting matrix
public Vector3D mul(Vector3D mulVec)
Example
The mathematical expressionVektor2 = Matrix1 * Vektor1
can be realized as
Vektor2 = Matrix1.mul(Vektor1);
private void selfMul(Matrix matrix)
Example
To demonstrate the way of working of this method look at the following example:When result of the multiplication
Matrix1 * Matrix2
should be saved into Matrix1, you can use the following expressions:
Matrix1.selfMul(Matrix2);or
Matrix1 = Matrix1.mul(Matrix2);
matrix - matrix, which will be mutiplied to this matrixpublic void set(int[] args)
args - the int-array of with 16 elements that replaces
matrixDatamatrixData
public void set(int index,
int value)
index - linear index of matrix elementvalue - what the element is to be set tomatrixData
public void set(int line,
int column,
int value)
line - line index of matrix elementcolumn - column index of matrix elememtvalue - what the element is to be set tomatrixDatapublic void setType(int newType)
newType - new Matrix matType constant.public void toConsole()
toConsole in interface Debugablepublic void toConsole(java.lang.String msgString)
Debugable
toConsole in interface Debugablepublic int type()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||