|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.instantreality.InstantIO.Matrix4f
public class Matrix4f
Helper class for exchanging 4x4 matrices of float values.
Matrix4f is a basic helper class for exchanging matrices of 4x4 float
values between different software components. It does
not contain any means for matrix arithmetics, only methods for
setting and getting the matrix elements. It is not meant to be used
directly by software components for matrix representation. Instead,
software components should use their own, appropriate classes for
handling matrices. Only when sending matrices to an OutSlot
,
or when receiving matrices from an InSlot
, the internal
representation of matrices should be converted to Matrix4f's. This
ensures the interoperability between different software components
that use different internal representations for matrixes.
Field Summary | |
---|---|
static Matrix4f |
IDENTITY
The identity matrix. |
Constructor Summary | |
---|---|
Matrix4f(float[] matrix)
Creates a new Matrix4f object that gets initialized by a given 16 element float array representing a 4x4 matrix. |
|
Matrix4f(float m11,
float m12,
float m13,
float m14,
float m21,
float m22,
float m23,
float m24,
float m31,
float m32,
float m33,
float m34,
float m41,
float m42,
float m43,
float m44)
Creates a new Matrix4f object that gets initialized by given 16 float values representing a 4x4 matrix. |
|
Matrix4f(Matrix4f matrix)
Constructor that initializes the components of the Matrix4f object with the elements taken from another Matrix4f object. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Compares the matrix to another object. |
void |
get(float[] matrix)
Returns the matrix elements. |
float |
get(int index)
Returns one element of the matrix. |
java.lang.String |
toString()
Converts the matrix to a string. |
static Matrix4f |
valueOf(java.lang.String str)
Converts a string to a Matrix4f object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Matrix4f IDENTITY
Constructor Detail |
---|
public Matrix4f(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
m11
- The value at row 1, column 1 of the matrixm12
- The value at row 1, column 2 of the matrixm13
- The value at row 1, column 3 of the matrixm14
- The value at row 1, column 4 of the matrixm21
- The value at row 2, column 1 of the matrixm22
- The value at row 2, column 2 of the matrixm23
- The value at row 2, column 3 of the matrixm24
- The value at row 2, column 4 of the matrixm31
- The value at row 3, column 1 of the matrixm32
- The value at row 3, column 2 of the matrixm33
- The value at row 3, column 3 of the matrixm34
- The value at row 3, column 4 of the matrixm41
- The value at row 4, column 1 of the matrixm42
- The value at row 4, column 2 of the matrixm43
- The value at row 4, column 3 of the matrixm44
- The value at row 4, column 4 of the matrixpublic Matrix4f(float[] matrix)
matrix
- The sixteen components of the matrixpublic Matrix4f(Matrix4f matrix)
The following example demonstrates how to create a Matrix4f object that is an exact copy of another Matrix4f object:
Matrix4f given_mat = ...; Matrix4f mat = new Matrix4f(given_mat);
matrix
- The other matrix used to initialize the new matrix.Method Detail |
---|
public final void get(float[] matrix)
The following example extracts the translation vector from the matrix and prints it to the console:
Matrix4f mat = ...; float[] m = new float[16]; mat.get(m); float x = m[12]; float y = m[13]; float z = m[14]; System.out.println("Translation = " + x + " " + y + " " + z);
matrix
- A float array that gets filled with the elements of the
matrix. This array must have at least 16 elements.public final float get(int index)
The following example extracts the translation vector from the matrix and prints it to the console:
Matrix4f mat = ...; float x = mat.get(12); float y = mat.get(13); float z = mat.get(14); System.out.println("Translation = " + x + " " + y + " " + z);
index
- The index of the element. This must be between
0 and 15, inclusively.
public final boolean equals(java.lang.Object obj)
The following example compares two matrices and prints the result to the console:
Matrix4f mat1 = ...; Matrix4f mat2 = ...; System.out.println("Matrices are the same: " + mat1.equals(mat2));
equals
in class java.lang.Object
obj
- the object to compare the matrix to
public final java.lang.String toString()
The following example prints the string representation of a Matrix4f object to the console:
Matrix4f mat = ...; System.out.println("Matrix = " + mat.toString());
toString
in class java.lang.Object
public static final Matrix4f valueOf(java.lang.String str)
The following example creates a new Matrix4f object that represents a translation of 1 unit along the x axis, 2 units along the y axis, and 3 units along the z axis:
Matrix4f mat = Matrix4f.valueOf("1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 1.0 2.0 3.0 1.0");
str
- The string representation of the matrix.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |