net.rim.device.api.math
Class Matrix4f

java.lang.Object
  extended by net.rim.device.api.math.Matrix4f

public class Matrix4f
extends Object

A 4 by 4 floating point matrix representing a 3D transformation.

Vectors are treated as columns, resulting in a matrix that is represented as follows, where x, y and z are the translation components of the matrix:

   1  0  0  x
   0  1  0  y
   0  0  1  z
   0  0  0  1
 

This matrix class is directly compatible with OpenGL since its elements are laid out in memory exactly as they are expected by OpenGL. The matrix uses column-major format such that array indices increase down column first.

Since matrix multiplication is not commutative, multiplication must be done in the correct order when combining transformations. Suppose we have a translation matrix T and a rotation matrix R. To first rotate an object around the origin and then translate it, you would multiply the two matrices as TR. Likewise, to first translate the object and then rotate it you would do RT. So generally, martices must be multiplied in the reverse order in which you want the transformations to take place.

Passing a matrix to OpenGL is a simple and efficient operation since the underlying array for the matrix is stored in a format that is directly compatible with OpenGL.

   // Create a matrix to translate by (10, 2, -20)
   Matrix translation = new Matrix();
   translation.set(1, 0, 0, 10,
                   0, 1, 0, 2,
                   0, 0, 1, -20,
                   0, 0, 0, 1 );
   
   // Pass our matrix to OpenGL
   gl.glLoadMatrixf(translation.getArray());

Since:
BlackBerry API 5.0.0

Constructor Summary
Matrix4f()
          Constructs a matrix initialized to the identity matrix.
Matrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
          Constructs a matrix initialized to the specified values.
Matrix4f(float[] m)
          Constructs a matrix initialized to the specified column-major array.
Matrix4f(Matrix4f m)
          Constructs a new matrix by copying the values from the specified matrix.
 
Method Summary
 void add(float scalar)
          Adds a scalar value to each component of this matrix.
 void add(float scalar, Matrix4f dst)
          Adds a scalar value to this matrix and stores the result in dst.
 void add(Matrix4f m)
          Adds the specified matrix to this matrix.
static void add(Matrix4f m1, Matrix4f m2, Matrix4f dst)
          Adds the specified matrices and stores the result in dst.
static void createLookAt(Vector3f cameraPos, Vector3f cameraTarget, Vector3f cameraUpVector, Matrix4f dst)
          Creates a view matrix based on the specified input parameters.
static void createRotation(Quaternion4f quat, Matrix4f dst)
          Creates a rotation matrix from the specified quaternion.
static void createRotation(Vector3f axis, float angle, Matrix4f dst)
          Creates a rotation matrix from the specified axis and angle.
static void createRotationX(float angle, Matrix4f dst)
          Creates a matrix describing a rotation around the x-axis.
static void createRotationY(float angle, Matrix4f dst)
          Creates a matrix describing a rotation around the y-axis.
static void createRotationZ(float angle, Matrix4f dst)
          Creates a matrix describing a rotation around the z-axis.
static void createScale(float xScale, float yScale, float zScale, Matrix4f dst)
          Creates a scale matrix.
static void createTranslation(float xTrans, float yTrans, float zTrans, Matrix4f dst)
          Creates a translation matrix.
 boolean decompose(Vector3f scale, Quaternion4f rotation, Vector3f translation)
          Decomposes the scale, rotation and translation components of this matrix.
 float determinant()
          Computes the determinant of this matrix.
 boolean equals(Object obj)
          Determines if this matrix is equal to the specified object.
 boolean equals(Matrix4f m)
          Determines if this matrix is equal to the specified one.
 void get(float[] m)
          Copies the values of this matrix into the given array in column-major order.
 float get(int index)
          Gets the matrix element at the specified position.
 float get(int row, int column)
          Gets the matrix element at the specified row and column.
 float[] getArray()
          Returns the underlying array for this matrix in column-major order.
 void getColumn(int column, float[] v)
          Stores the four elements of the specified column into v.
 void getColumn(int column, Vector3f v)
          Stores the first three elements of the specified column into v.
 boolean getRotation(Quaternion4f rotation)
          Stores the rotational component of this matrix in the specified quaternion.
 void getRow(int row, float[] v)
          Stores the four elements of the specified row into v.
 void getRow(int row, Vector3f v)
          Stores the first three elements of the specified row into v.
 void getScale(Vector3f scale)
          Stores the scalar component of this matrix in the specified vector.
 void getTranslation(Vector3f translation)
          Stores the translational component of this matrix in the specified vector.
 int hashCode()
          Returns the hash code of the matrix, based on the values stored in it.
 boolean invert()
          Inverts this matrix.
 boolean invert(Matrix4f dst)
          Inverts this matrix and stores the result in dst.
 boolean isIdentity()
          Determines if this matrix is equal to the identity matrix.
 void multiply(float scalar)
          Multiplies the components of this matrix by the specified scalar.
 void multiply(float scalar, Matrix4f dst)
          Multiplies the components of this matrix by a scalar and stores the result in dst.
 void multiply(Matrix4f m)
          Multiplies this matrix by the specified one.
static void multiply(Matrix4f m1, Matrix4f m2, Matrix4f dst)
          Multiplies m1 by m2 and stores the result in dst.
 void negate()
          Negates this matrix.
 void negate(Matrix4f dst)
          Stores the negate of this matrix in dst.
 void rotate(Quaternion4f q)
          Rotates this matrix by the specified quaternon.
 void rotate(Quaternion4f q, Matrix4f dst)
          Rotates this matrix by the specified quaternion and stores the result in dst.
 void rotate(Vector3f axis, float angle)
          Rotates this matrix about the specified axis.
 void rotate(Vector3f axis, float angle, Matrix4f dst)
          Rotates this matrix about the specified axis and stores the result in dst.
 void rotateX(float angle)
          Rotates this matrix by the specified amount around the x-axis.
 void rotateX(float angle, Matrix4f dst)
          Rotates this matrix by the specified amount around the x-axis and stores the result in dst.
 void rotateY(float angle)
          Rotates this matrix by the specified amount around the y-axis.
 void rotateY(float angle, Matrix4f dst)
          Rotates this matrix by the specified amount around the y-axis and stores the result in dst.
 void rotateZ(float angle)
          Rotates this matrix by the specified amount around the z-axis.
 void rotateZ(float angle, Matrix4f dst)
          Rotates this matrix by the specified amount around the z-axis and stores the result in dst.
 void scale(float value)
          Scales this matrix by the specified amount along all axes.
 void scale(float xScale, float yScale, float zScale)
          Scales this matrix by the specified amounts along each axis.
 void scale(float xScale, float yScale, float zScale, Matrix4f dst)
          Scales this matrix by the specified amounts along each axis and stores the result in dst.
 void scale(float value, Matrix4f dst)
          Scales this matrix by the specified amount along all axes and stores the result in dst.
 void set(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
          Sets the values of this matrix.
 void set(float[] m)
          Sets the values of this matrix to those in the specified column-major array.
 void set(int index, float value)
          Sets the specified element of this matrix to the specified value.
 void set(int row, int column, float value)
          Sets the specified element of this matrix to the specified value.
 void set(Matrix4f m)
          Sets the values of this matrix to those of the specified matrix.
 void setIdentity()
          Sets this matrix to the identity matrix.
 void setZero()
          Sets all elements of the current matrix to zero.
 void subtract(Matrix4f m)
          Subtracts the specified matrix from the current matrix.
static void subtract(Matrix4f m1, Matrix4f m2, Matrix4f dst)
          Subtracts the specified matrices and stores the result in dst.
 String toString()
          Returns a string representation of this matrix.
 void transformNormal(Vector3f normal)
          Transforms the specified normal vector by this matrix by treating the fourth (w) coordinate as zero.
 void transformNormal(Vector3f normal, Vector3f dst)
          Transforms the specified normal vector by this matrix by treating the fourth (w) coordinate as zero, and stores the result in dst.
 void transformPoint(Vector3f point)
          Transforms the specified vector that represents a point by this matrix by treating the fourth (w) coordinate as one.
 void transformPoint(Vector3f point, Vector3f dst)
          Transforms the specified vector that represents a point by this matrix by treating the fourth (w) coordinate as one, and stores the result in dst.
 void translate(float x, float y, float z)
          Translates this matrix by the specified values.
 void translate(float x, float y, float z, Matrix4f dst)
          Translates this matrix by the specified values and stores the result in dst.
 void transpose()
          Transposes this matrix.
 void transpose(Matrix4f dst)
          Stores the transpose of this matrix in dst.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 



Constructor Detail

Matrix4f

public Matrix4f()
Constructs a matrix initialized to the identity matrix.

Since:
BlackBerry API 5.0.0

Matrix4f

public Matrix4f(float[] m)
Constructs a matrix initialized to the specified column-major array.

The passed in array is in column-major order, so the memory layout of the array is as follows:

   0   4   8   12
   1   5   9   13
   2   6   10  14
   3   7   11  15
 

Parameters:
m - a 16-element array, stored in column-major order
Since:
BlackBerry API 5.0.0

Matrix4f

public Matrix4f(float m00,
                float m01,
                float m02,
                float m03,
                float m10,
                float m11,
                float m12,
                float m13,
                float m20,
                float m21,
                float m22,
                float m23,
                float m30,
                float m31,
                float m32,
                float m33)
Constructs a matrix initialized to the specified values.

Parameters:
m00 - the first element of the first row
m01 - the second element of the first row
m02 - the third element of the first row
m03 - the fourth element of the first row
m10 - the first element of the second row
m11 - the second element of the second row
m12 - the third element of the second row
m13 - the fourth element of the second row
m20 - the first element of the third row
m21 - the second element of the third row
m22 - the third element of the third row
m23 - the fourth element of the third row
m30 - the first element of the fourth row
m31 - the second element of the fourth row
m32 - the third element of the fourth row
m33 - the fourth element of the fourth row
Since:
BlackBerry API 5.0.0

Matrix4f

public Matrix4f(Matrix4f m)
Constructs a new matrix by copying the values from the specified matrix.

Parameters:
m - the source matrix
Since:
BlackBerry API 5.0.0


Method Detail

add

public final void add(float scalar)
Adds a scalar value to each component of this matrix.

Parameters:
scalar - the scalar to add
Since:
BlackBerry API 5.0.0

add

public final void add(float scalar,
                      Matrix4f dst)
Adds a scalar value to this matrix and stores the result in dst.

Parameters:
scalar - the scalar value to add
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

add

public final void add(Matrix4f m)
Adds the specified matrix to this matrix.

Parameters:
m - the matrix to add
Since:
BlackBerry API 5.0.0

add

public static void add(Matrix4f m1,
                       Matrix4f m2,
                       Matrix4f dst)
Adds the specified matrices and stores the result in dst.

Parameters:
m1 - the first matrix
m2 - the second matrix
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

decompose

public final boolean decompose(Vector3f scale,
                               Quaternion4f rotation,
                               Vector3f translation)
Decomposes the scale, rotation and translation components of this matrix.

Parameters:
scale - a vector to store the decomposed scale values in
rotation - a quaternion to store the decomposed rotation in
translation - a vector to store the decomposed translation in
Returns:
true if the the matrix can be decomposed, false otherwise
Since:
BlackBerry API 5.0.0

determinant

public final float determinant()
Computes the determinant of this matrix.

Returns:
the determinant
Since:
BlackBerry API 5.0.0

equals

public boolean equals(Object obj)
Determines if this matrix is equal to the specified object.

Overrides:
equals in class Object
Parameters:
obj - the matrix to compare
Returns:
true if the specified object is of type Matrix4f and if all members of it are equal those of this matrix
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 5.0.0

equals

public boolean equals(Matrix4f m)
Determines if this matrix is equal to the specified one.

Parameters:
m - the matrix to compare
Returns:
true if all components of the specified matrix are equal to those of this matrix
Since:
BlackBerry API 5.0.0

get

public final void get(float[] m)
Copies the values of this matrix into the given array in column-major order.

Parameters:
m - a 16-element array to populate with the values from this matrix
Since:
BlackBerry API 5.0.0

get

public final float get(int index)
Gets the matrix element at the specified position.

This method indexes the internal array in column-major order. See the description of this class for more information on this topic.

Parameters:
index - the zero-based index of the element to retrieve
Returns:
the value of the specified element.
Since:
BlackBerry API 5.0.0

get

public final float get(int row,
                       int column)
Gets the matrix element at the specified row and column.

Parameters:
row - the zero-based row of the element to retrieve
column - the zero-based column of the element to retrieve
Returns:
the value of the specified element.
Since:
BlackBerry API 5.0.0

getArray

public final float[] getArray()
Returns the underlying array for this matrix in column-major order.

The returned array is in column-major order and therefore compatible with systems such as OpenGL that expect data in this order. The memory layout of the array is therefore as follows:

   0  4  8   12
   1  5  9   13
   2  6  10  14
   3  7  11  15
 

Note that modifying the elements of the returned array will modify the matrix itself.

Returns:
the internal array in column-major order
Since:
BlackBerry API 5.0.0

getColumn

public final void getColumn(int column,
                            float[] v)
Stores the four elements of the specified column into v.

Parameters:
column - the index of the column to retrieve (zero-based)
v - a four-element array to store the column in
Since:
BlackBerry API 5.0.0

getColumn

public final void getColumn(int column,
                            Vector3f v)
Stores the first three elements of the specified column into v.

Parameters:
column - the index of the column to retrieve (zero-based)
v - a vector to store the column in
Since:
BlackBerry API 5.0.0

getRotation

public final boolean getRotation(Quaternion4f rotation)
Stores the rotational component of this matrix in the specified quaternion.

Parameters:
rotation - a quaternion to receive the rotation
Returns:
true if the rotation is successfully extracted, false otherwise
Since:
BlackBerry API 5.0.0

getRow

public final void getRow(int row,
                         float[] v)
Stores the four elements of the specified row into v.

Parameters:
row - the index of the row to retrieve (zero-based)
v - a four-element array to store the row in
Since:
BlackBerry API 5.0.0

getRow

public final void getRow(int row,
                         Vector3f v)
Stores the first three elements of the specified row into v.

Parameters:
row - the index of the row to retrieve (zero-based)
v - a vector to store the row in
Since:
BlackBerry API 5.0.0

getScale

public final void getScale(Vector3f scale)
Stores the scalar component of this matrix in the specified vector.

Parameters:
scale - a vector to receive the scale
Since:
BlackBerry API 5.0.0

getTranslation

public final void getTranslation(Vector3f translation)
Stores the translational component of this matrix in the specified vector.

Parameters:
translation - a vector to receive the translation
Since:
BlackBerry API 5.0.0

hashCode

public int hashCode()
Returns the hash code of the matrix, based on the values stored in it.

Overrides:
hashCode in class Object
Returns:
the hash code
See Also:
Object.equals(java.lang.Object), Hashtable
Since:
BlackBerry API 5.0.0

invert

public final boolean invert()
Inverts this matrix.

Returns:
true if the the matrix can be inverted, false otherwise
Since:
BlackBerry API 5.0.0

invert

public final boolean invert(Matrix4f dst)
Inverts this matrix and stores the result in dst.

Parameters:
dst - a matrix to store the invert of this matrix in
Returns:
true if the the matrix can be inverted, false otherwise
Since:
BlackBerry API 5.0.0

isIdentity

public final boolean isIdentity()
Determines if this matrix is equal to the identity matrix.

Returns:
true or false
Since:
BlackBerry API 5.0.0

multiply

public final void multiply(float scalar)
Multiplies the components of this matrix by the specified scalar.

Parameters:
scalar - the scalar value
Since:
BlackBerry API 5.0.0

multiply

public final void multiply(float scalar,
                           Matrix4f dst)
Multiplies the components of this matrix by a scalar and stores the result in dst.

Parameters:
scalar - the scalar value
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

multiply

public final void multiply(Matrix4f m)
Multiplies this matrix by the specified one.

Parameters:
m - the matrix to multiply
Since:
BlackBerry API 5.0.0

multiply

public static void multiply(Matrix4f m1,
                            Matrix4f m2,
                            Matrix4f dst)
Multiplies m1 by m2 and stores the result in dst.

Parameters:
m1 - the first matrix to multiply
m2 - the second matrix to multiply
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

negate

public final void negate()
Negates this matrix.

Since:
BlackBerry API 5.0.0

negate

public final void negate(Matrix4f dst)
Stores the negate of this matrix in dst.

Parameters:
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

rotate

public final void rotate(Quaternion4f q)
Rotates this matrix by the specified quaternon.

Parameters:
q - the quaternion to rotate by
Since:
BlackBerry API 5.0.0

rotate

public final void rotate(Quaternion4f q,
                         Matrix4f dst)
Rotates this matrix by the specified quaternion and stores the result in dst.

Parameters:
q - the quaternion to rotate by
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

rotate

public final void rotate(Vector3f axis,
                         float angle)
Rotates this matrix about the specified axis.

Parameters:
axis - the axis to rotate about
angle - the angle, in radians
Since:
BlackBerry API 5.0.0

rotate

public final void rotate(Vector3f axis,
                         float angle,
                         Matrix4f dst)
Rotates this matrix about the specified axis and stores the result in dst.

Parameters:
axis - the axis to rotate about
angle - the angle, in radians
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

rotateX

public final void rotateX(float angle)
Rotates this matrix by the specified amount around the x-axis.

Parameters:
angle - the angle to rotate by, in radians
Since:
BlackBerry API 5.0.0

rotateX

public final void rotateX(float angle,
                          Matrix4f dst)
Rotates this matrix by the specified amount around the x-axis and stores the result in dst.

Parameters:
angle - the angle to rotate by, in radians
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

rotateY

public final void rotateY(float angle)
Rotates this matrix by the specified amount around the y-axis.

Parameters:
angle - the angle to rotate by, in radians
Since:
BlackBerry API 5.0.0

rotateY

public final void rotateY(float angle,
                          Matrix4f dst)
Rotates this matrix by the specified amount around the y-axis and stores the result in dst.

Parameters:
angle - the angle to rotate by, in radians
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

rotateZ

public final void rotateZ(float angle)
Rotates this matrix by the specified amount around the z-axis.

Parameters:
angle - the angle to rotate by, in radians
Since:
BlackBerry API 5.0.0

rotateZ

public final void rotateZ(float angle,
                          Matrix4f dst)
Rotates this matrix by the specified amount around the z-axis and stores the result in dst.

Parameters:
angle - the angle to rotate by, in radians
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

scale

public final void scale(float value)
Scales this matrix by the specified amount along all axes.

Parameters:
value - the amount to scale this matrix by
Since:
BlackBerry API 5.0.0

scale

public final void scale(float value,
                        Matrix4f dst)
Scales this matrix by the specified amount along all axes and stores the result in dst.

Parameters:
value - the amount to scale the matrix by
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

scale

public final void scale(float xScale,
                        float yScale,
                        float zScale)
Scales this matrix by the specified amounts along each axis.

Parameters:
xScale - the amount to scale along the x-axis
yScale - the amount to scale along the y-axis
zScale - the amount to scale along the z-axis
Since:
BlackBerry API 5.0.0

scale

public final void scale(float xScale,
                        float yScale,
                        float zScale,
                        Matrix4f dst)
Scales this matrix by the specified amounts along each axis and stores the result in dst.

Parameters:
xScale - the amount to scale along the x-axis
yScale - the amount to scale along the y-axis
zScale - the amount to scale along the z-axis
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

set

public final void set(float[] m)
Sets the values of this matrix to those in the specified column-major array.

Parameters:
m - a 16-element array, stored in column-major format
Since:
BlackBerry API 5.0.0

set

public final void set(float m00,
                      float m01,
                      float m02,
                      float m03,
                      float m10,
                      float m11,
                      float m12,
                      float m13,
                      float m20,
                      float m21,
                      float m22,
                      float m23,
                      float m30,
                      float m31,
                      float m32,
                      float m33)
Sets the values of this matrix.

Parameters:
m00 - the first element of the first row
m01 - the second element of the first row
m02 - the third element of the first row
m03 - the fourth element of the first row
m10 - the first element of the second row
m11 - the second element of the second row
m12 - the third element of the second row
m13 - the fourth element of the second row
m20 - the first element of the third row
m21 - the second element of the third row
m22 - the third element of the third row
m23 - the fourth element of the third row
m30 - the first element of the fourth row
m31 - the second element of the fourth row
m32 - the third element of the fourth row
m33 - the fourth element of the fourth row
Since:
BlackBerry API 5.0.0

set

public final void set(Matrix4f m)
Sets the values of this matrix to those of the specified matrix.

Parameters:
m - the source matrix
Since:
BlackBerry API 5.0.0

set

public final void set(int index,
                      float value)
Sets the specified element of this matrix to the specified value.

Parameters:
index - the index of the element to set (0-15)
value - the value to set
Since:
BlackBerry API 5.0.0

set

public final void set(int row,
                      int column,
                      float value)
Sets the specified element of this matrix to the specified value.

Parameters:
row - the row of the element (0-3)
column - the column of the element (0-3)
value - the value to set
Since:
BlackBerry API 5.0.0

setIdentity

public final void setIdentity()
Sets this matrix to the identity matrix.

Since:
BlackBerry API 5.0.0

setZero

public final void setZero()
Sets all elements of the current matrix to zero.

Since:
BlackBerry API 5.0.0

subtract

public final void subtract(Matrix4f m)
Subtracts the specified matrix from the current matrix.

Parameters:
m - the matrix to subtract
Since:
BlackBerry API 5.0.0

subtract

public static void subtract(Matrix4f m1,
                            Matrix4f m2,
                            Matrix4f dst)
Subtracts the specified matrices and stores the result in dst.

Parameters:
m1 - the first matrix
m2 - the second matrix
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

transformNormal

public final void transformNormal(Vector3f normal)
Transforms the specified normal vector by this matrix by treating the fourth (w) coordinate as zero.

The result of the transformation is stored directly into normal.

Parameters:
normal - the normal vector to transform
Since:
BlackBerry API 5.0.0

transformNormal

public final void transformNormal(Vector3f normal,
                                  Vector3f dst)
Transforms the specified normal vector by this matrix by treating the fourth (w) coordinate as zero, and stores the result in dst.

Parameters:
normal - the normal vector to transform
dst - a vector to store the transformed normal in
Since:
BlackBerry API 5.0.0

transformPoint

public final void transformPoint(Vector3f point)
Transforms the specified vector that represents a point by this matrix by treating the fourth (w) coordinate as one.

The result of the transformation is stored directly into point.

Parameters:
point - the point to transform
Since:
BlackBerry API 5.0.0

transformPoint

public final void transformPoint(Vector3f point,
                                 Vector3f dst)
Transforms the specified vector that represents a point by this matrix by treating the fourth (w) coordinate as one, and stores the result in dst.

Parameters:
point - the point to transform
dst - a vector to store the transformed point in
Since:
BlackBerry API 5.0.0

translate

public final void translate(float x,
                            float y,
                            float z)
Translates this matrix by the specified values.

Parameters:
x - amount to translate along the x-axis
y - amount to translate along the y-axis
z - amount to translate along the z-axis
Since:
BlackBerry API 5.0.0

translate

public final void translate(float x,
                            float y,
                            float z,
                            Matrix4f dst)
Translates this matrix by the specified values and stores the result in dst.

Parameters:
x - amount to translate along the x-axis
y - amount to translate along the y-axis
z - amount to translate along the z-axis
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

transpose

public final void transpose()
Transposes this matrix.

Since:
BlackBerry API 5.0.0

transpose

public final void transpose(Matrix4f dst)
Stores the transpose of this matrix in dst.

Parameters:
dst - a matrix to store the transpose in
Since:
BlackBerry API 5.0.0

toString

public String toString()
Returns a string representation of this matrix.

Overrides:
toString in class Object
Returns:
a string containing the elements of the matrix
Since:
BlackBerry API 5.0.0

createScale

public static void createScale(float xScale,
                               float yScale,
                               float zScale,
                               Matrix4f dst)
Creates a scale matrix.

Parameters:
xScale - the scale on the x-axis
yScale - the scale on the y-axis
zScale - the scale on the z-axis
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

createTranslation

public static void createTranslation(float xTrans,
                                     float yTrans,
                                     float zTrans,
                                     Matrix4f dst)
Creates a translation matrix.

Parameters:
xTrans - the translation on the x-axis
yTrans - the translation on the y-axis
zTrans - the translation on the z-axis
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

createRotation

public static void createRotation(Quaternion4f quat,
                                  Matrix4f dst)
Creates a rotation matrix from the specified quaternion.

Parameters:
quat - a quaternion describing a 3D orientation
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

createRotation

public static void createRotation(Vector3f axis,
                                  float angle,
                                  Matrix4f dst)
Creates a rotation matrix from the specified axis and angle.

Parameters:
axis - a vector describing the axis to rotate about
angle - the angle, in radians
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

createRotationX

public static void createRotationX(float angle,
                                   Matrix4f dst)
Creates a matrix describing a rotation around the x-axis.

Parameters:
angle - the angle of rotation, in radians
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

createRotationY

public static void createRotationY(float angle,
                                   Matrix4f dst)
Creates a matrix describing a rotation around the y-axis.

Parameters:
angle - the angle of rotation, in radians
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

createRotationZ

public static void createRotationZ(float angle,
                                   Matrix4f dst)
Creates a matrix describing a rotation around the z-axis.

Parameters:
angle - the angle of rotation, in radians
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0

createLookAt

public static void createLookAt(Vector3f cameraPos,
                                Vector3f cameraTarget,
                                Vector3f cameraUpVector,
                                Matrix4f dst)
Creates a view matrix based on the specified input parameters.

Parameters:
cameraPos - the position of the camera
cameraTarget - the position of the target that the camera is pointing at
cameraUpVector - a vector describing the "up" direction of the camera
dst - a matrix to store the result in
Since:
BlackBerry API 5.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.