net.rim.device.api.math
Class Matrix3f

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

public class Matrix3f
extends Object

Defines a 3 x 3 floating point matrix representing a 2D transformation.

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

   1  0  x
   0  1  y
   0  0  1
 

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, matrices must be multiplied in the reverse order in which you want the transformations to take place (this also applies to the scale, rotate, and translate methods below; these methods are convenience methods for post-multiplying by a matrix representing a scale, rotation, or translation).

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

   // Create a matrix to translate by (10, -2)
   Matrix3f translation = new Matrix3f();
   translation.set(1, 0, 10,
                   0, 1, -2,
                   0, 0, 1 );
   
   // Pass our matrix to OpenVG
   vg.vgLoadMatrix(translation.getArray());

Note: In the case of repeated local transformations (i.e. rotate by 0.76 radians, then translate by 2.1 along the X-axis, then ...), it is better to use Transform2D (which is optimized for that kind of usage).

See Also:
Transform2D
Since:
BlackBerry API 6.0.0

Constructor Summary
Matrix3f()
          Constructs a matrix initialized to the identity matrix.
Matrix3f(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
          Constructs a matrix initialized to the specified values.
Matrix3f(float[] m)
          Constructs a matrix initialized to the specified column-major array.
Matrix3f(float[] m, int offset)
          Constructs a matrix initialized to the specified column-major array.
Matrix3f(Matrix3f 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, Matrix3f dst)
          Adds a scalar value to this matrix and stores the result in dst.
 void add(Matrix3f m)
          Adds the specified matrix to this matrix.
static void add(Matrix3f m1, Matrix3f m2, Matrix3f dst)
          Adds the specified matrices and stores the result in dst.
static void createRotation(float x, float y, float angle, Matrix3f dst)
          Creates a rotation matrix from the specified center of rotation and angle.
static void createRotation(float angle, Matrix3f dst)
          Creates a rotation matrix from the specified angle.
static void createScale(float xScale, float yScale, Matrix3f dst)
          Creates a scale matrix.
static void createShear(float xAngle, float yAngle, Matrix3f dst)
          Creates a shear matrix.
static void createTranslation(float xTrans, float yTrans, Matrix3f dst)
          Creates a translation matrix.
 boolean decompose(Vector2f scale, Vector2f shear, Matrix3f rotation, Vector2f translation)
          Decomposes the scale, shear, 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(Matrix3f 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)
          Gets the three elements of the specified column into v.
 void getColumn(int column, Vector2f v)
          Gets the first two elements of the specified column into v.
 boolean getRotation(Matrix3f rotation)
          Gets the rotational component of this matrix in the specified matrix.
 void getRow(int row, float[] v)
          Gets the three elements of the specified row into v.
 void getRow(int row, Vector2f v)
          Gets the first two elements of the specified row into v.
 void getScale(Vector2f scale)
          Gets the scale components of this matrix in a scale Matrix3f.
 void getShear(Vector2f shear)
          Gets the shear component of this matrix in a Vector2f.
 void getTranslation(Vector2f translation)
          Gets the translational component of this matrix in a Vector2f.
 int hashCode()
          Returns the hash code of the matrix, based on the values stored in it.
 boolean invert()
          Inverts this matrix.
 boolean invert(Matrix3f dst)
          Inverts this matrix and stores the result in dst.
 boolean isIdentity()
          Determines if this matrix is the identity matrix.
 void multiply(float scalar)
          Multiplies the components of this matrix by the specified scalar.
 void multiply(float scalar, Matrix3f dst)
          Multiplies the components of this matrix by a scalar and stores the result in dst.
 void multiply(Matrix3f m)
          Multiplies this matrix by the specified matrix.
static void multiply(Matrix3f m1, Matrix3f m2, Matrix3f dst)
          Multiplies matrix m1 by m2 and stores the result in dst.
 void negate()
          Negates this matrix.
 void negate(Matrix3f dst)
          Gets the negate of this matrix in matrix dst.
 void rotate(float angle)
          Post-multiplies this matrix by the matrix corresponding to the specified rotation about the origin.
 void rotate(float x, float y, float angle)
          Post-multiplies this matrix by the matrix corresponding to the specified rotation about the given point.
 void rotate(float x, float y, float angle, Matrix3f dst)
          Post-multiplies this matrix by the matrix corresponding to the specified rotation about the given point, and stores the result in matrix dst.
 void rotate(float angle, Matrix3f dst)
          Post-multiplies this matrix by the matrix corresponding to the specified rotation about the origin, and stores the result in matrix dst.
 void scale(float value)
          Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.
 void scale(float xScale, float yScale)
          Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.
 void scale(float xScale, float yScale, Matrix3f dst)
          Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in matrix dst.
 void scale(float value, Matrix3f dst)
          Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in matrix dst.
 void set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
          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(float[] m, int offset)
          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(Matrix3f 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 shear(float shear)
          Post-multiplies this matrix by the matrix corresponding to the specified shear transformation.
 void shear(float xShear, float yShear)
          Post-multiplies this matrix by the matrix corresponding to the specified shear transformation.
 void shear(float xShear, float yShear, Matrix3f dst)
          Post-multiplies this matrix by the matrix corresponding to the specified shear transformation and stores the result in matrix dst.
 void shear(float shear, Matrix3f dst)
          Post-multiplies this matrix by the matrix corresponding to the specified shear transformation and stores the result in matrix dst.
 void subtract(Matrix3f m)
          Subtracts the specified matrix from the current matrix.
static void subtract(Matrix3f m1, Matrix3f m2, Matrix3f dst)
          Subtracts the specified matrices, and stores the result in matrix dst.
 String toString()
          Returns a string representation of this matrix.
 void transformPoint(Vector2f point)
          Transforms the specified point by this matrix.
 void transformPoint(Vector2f point, Vector2f dst)
          Transforms the specified point by this matrix, and stores the result in matrix dst.
 void transformVector(Vector2f vector)
          Transforms the specified vector by this matrix.
 void transformVector(Vector2f vector, Vector2f dst)
          Transforms the specified vector by this matrix, and stores the result in dst.
 void translate(float x, float y)
          Post-multiplies this matrix by the matrix corresponding to the specified translation.
 void translate(float x, float y, Matrix3f dst)
          Post-multiplies this matrix by the matrix corresponding to the specified translation and stores the result in matrix dst.
 void transpose()
          Transposes this matrix.
 void transpose(Matrix3f dst)
          Gets the transpose of this matrix in dst.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 



Constructor Detail

Matrix3f

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

Since:
BlackBerry API 6.0.0

Matrix3f

public Matrix3f(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   3   6 
   1   4   7 
   2   5   8
 

Parameters:
m - a 9-element array, stored in column-major order.
Throws:
IllegalArgumentException - If m.length is less than 9.
NullPointerException - If m is null.
Since:
BlackBerry API 6.0.0

Matrix3f

public Matrix3f(float[] m,
                int offset)
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   3   6 
   1   4   7 
   2   5   8
 

Parameters:
m - An array containing 9 elements in column-major order.
offset - The offset into the array to begin reading at.
Throws:
IllegalArgumentException - If offset is less than zero or offset + 8 is greater than or equal to m.length.
NullPointerException - If m is null.
Since:
BlackBerry API 6.0.0

Matrix3f

public Matrix3f(float m00,
                float m01,
                float m02,
                float m10,
                float m11,
                float m12,
                float m20,
                float m21,
                float m22)
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.
m10 - the first element of the second row.
m11 - the second element of the second row.
m12 - the third 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.
Since:
BlackBerry API 6.0.0

Matrix3f

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

Parameters:
m - the source matrix.
Throws:
NullPointerException - If m is null.
Since:
BlackBerry API 6.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 6.0.0

add

public final void add(float scalar,
                      Matrix3f 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.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

add

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

Parameters:
m - the matrix to add.
Throws:
NullPointerException - If m is null.
Since:
BlackBerry API 6.0.0

add

public static void add(Matrix3f m1,
                       Matrix3f m2,
                       Matrix3f 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.
Throws:
NullPointerException - If m1, m2, or dst is null.
Since:
BlackBerry API 6.0.0

decompose

public final boolean decompose(Vector2f scale,
                               Vector2f shear,
                               Matrix3f rotation,
                               Vector2f translation)
Decomposes the scale, shear, rotation and translation components of this matrix.

Parameters:
scale - a vector to store the decomposed scale values in
shear - a vector to store the decomposed shear values in
rotation - a matrix 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
Throws:
NullPointerException - If scale, shear, rotation, or translation is null.
Since:
BlackBerry API 6.0.0

determinant

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

Returns:
the determinant.
Since:
BlackBerry API 6.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 9-element array to populate with the values from this matrix
Throws:
IllegalArgumentException - If m.length is less than 9.
NullPointerException - If m is null.
Since:
BlackBerry API 6.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.
Throws:
IllegalArgumentException - If index is less than zero or greater than 8.
Since:
BlackBerry API 6.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.
Throws:
IllegalArgumentException - If row or column is less than zero or greater than 2.
Since:
BlackBerry API 6.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 OpenVG that expect data in this order. The memory layout of the array is therefore as follows:

   0  3  6 
   1  4  7 
   2  5  8
 

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 6.0.0

getColumn

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

Parameters:
column - the index of the column to retrieve (zero-based).
v - a three-element array to store the column in.
Throws:
IllegalArgumentException - If column is less than zero or greater than 2.
IllegalArgumentException - If v.length is less than 3.
NullPointerException - If v is null.
Since:
BlackBerry API 6.0.0

getColumn

public final void getColumn(int column,
                            Vector2f v)
Gets the first two 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.
Throws:
IllegalArgumentException - If column is less than zero or greater than 2.
NullPointerException - If v is null.
Since:
BlackBerry API 6.0.0

getRow

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

Parameters:
row - the index of the row to retrieve (zero-based).
v - a three-element array to store the row in.
Throws:
IllegalArgumentException - If row is less than zero or greater than 2.
IllegalArgumentException - If v.length is less than 3.
NullPointerException - If v is null.
Since:
BlackBerry API 6.0.0

getRow

public final void getRow(int row,
                         Vector2f v)
Gets the first two 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.
Throws:
IllegalArgumentException - If row is less than zero or greater than 2.
NullPointerException - If v is null.
Since:
BlackBerry API 6.0.0

getScale

public final void getScale(Vector2f scale)
Gets the scale components of this matrix in a scale Matrix3f.

Note: If the scalar component of this matrix has negative parts, it is not possible to always extract the exact scalar component; instead, a scale vector that is mathematically equivalent to the original scale vector is extracted and returned.

Parameters:
scale - a Vector2f storing the scale transformation.
Throws:
NullPointerException - If scale is null.
Since:
BlackBerry API 6.0.0

getShear

public final void getShear(Vector2f shear)
Gets the shear component of this matrix in a Vector2f.

Parameters:
shear - a Vector2f storing the horizontal and vertical shear.
Throws:
NullPointerException - If scale is null.
Since:
BlackBerry API 6.0.0

getRotation

public final boolean getRotation(Matrix3f rotation)
Gets the rotational component of this matrix in the specified matrix.

Parameters:
rotation - a matrix to receive the rotation
Returns:
true if the rotation is successfully extracted, false otherwise
Throws:
NullPointerException - If rotation is null.
Since:
BlackBerry API 6.0.0

getTranslation

public final void getTranslation(Vector2f translation)
Gets the translational component of this matrix in a Vector2f.

Parameters:
translation - a Matrix3f storing the translation matrix.
Throws:
NullPointerException - If translation is null.
Since:
BlackBerry API 6.0.0

invert

public final boolean invert()
Inverts this matrix.

Returns:
true if the this Matrix3f is invertible, false otherwise.
Since:
BlackBerry API 6.0.0

invert

public final boolean invert(Matrix3f 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 this matrix is invertible; false otherwise.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

isIdentity

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

Returns:
true if this matrix is the identity matrix; false otherwise.
Since:
BlackBerry API 6.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 6.0.0

multiply

public final void multiply(float scalar,
                           Matrix3f 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.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

multiply

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

Parameters:
m - the matrix to multiply.
Throws:
NullPointerException - if m is null.
Since:
BlackBerry API 6.0.0

multiply

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

Parameters:
m1 - the first matrix.
m2 - the second matrix.
dst - a matrix to store the result of m1 * m2.
Throws:
NullPointerException - If m1, m2, or dst is null.
Since:
BlackBerry API 6.0.0

negate

public final void negate()
Negates this matrix.

Since:
BlackBerry API 6.0.0

negate

public final void negate(Matrix3f dst)
Gets the negate of this matrix in matrix dst.

Parameters:
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

rotate

public final void rotate(float angle)
Post-multiplies this matrix by the matrix corresponding to the specified rotation about the origin.

Parameters:
angle - the angle, in radians.
Since:
BlackBerry API 6.0.0

rotate

public final void rotate(float x,
                         float y,
                         float angle)
Post-multiplies this matrix by the matrix corresponding to the specified rotation about the given point.

Parameters:
x - the x-coordinate of the center of rotation.
y - the y-coordinate of the center of rotation.
angle - the angle, in radians.
Since:
BlackBerry API 6.0.0

rotate

public final void rotate(float angle,
                         Matrix3f dst)
Post-multiplies this matrix by the matrix corresponding to the specified rotation about the origin, and stores the result in matrix dst.

Parameters:
angle - the angle, in radians.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

rotate

public final void rotate(float x,
                         float y,
                         float angle,
                         Matrix3f dst)
Post-multiplies this matrix by the matrix corresponding to the specified rotation about the given point, and stores the result in matrix dst.

Parameters:
x - the x-coordinate of the center of rotation.
y - the y-coordinate of the center of rotation.
angle - the angle, in radians.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

scale

public final void scale(float value)
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.

Parameters:
value - the amount to scale along all axes.
Since:
BlackBerry API 6.0.0

scale

public final void scale(float value,
                        Matrix3f dst)
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in matrix dst.

Parameters:
value - the amount to scale along all axes.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

scale

public final void scale(float xScale,
                        float yScale)
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation.

Parameters:
xScale - the amount to scale along the x-axis.
yScale - the amount to scale along the y-axis.
Since:
BlackBerry API 6.0.0

scale

public final void scale(float xScale,
                        float yScale,
                        Matrix3f dst)
Post-multiplies this matrix by the matrix corresponding to the specified scale transformation and stores the result in matrix dst.

Parameters:
xScale - the amount to scale along the x-axis.
yScale - the amount to scale along the y-axis.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

shear

public final void shear(float shear)
Post-multiplies this matrix by the matrix corresponding to the specified shear transformation.

Parameters:
shear - The amount to shear by along both axes.
Since:
BlackBerry API 7.0.0

shear

public final void shear(float shear,
                        Matrix3f dst)
Post-multiplies this matrix by the matrix corresponding to the specified shear transformation and stores the result in matrix dst.

Parameters:
shear - The amount to shear by along both axes.
dst - The matrix to store the result in.
Throws:
NullPointerException - if dst is null.
Since:
BlackBerry API 7.0.0

shear

public final void shear(float xShear,
                        float yShear)
Post-multiplies this matrix by the matrix corresponding to the specified shear transformation.

Parameters:
xShear - The amount to shear along the x-axis.
yShear - The amount to shear along the y-axis.
Since:
BlackBerry API 7.0.0

shear

public final void shear(float xShear,
                        float yShear,
                        Matrix3f dst)
Post-multiplies this matrix by the matrix corresponding to the specified shear transformation and stores the result in matrix dst.

Parameters:
xShear - The amount to shear along the x-axis.
yShear - The amount to shear along the y-axis.
dst - The matrix to store the result in.
Throws:
NullPointerException - if dst is null.
Since:
BlackBerry API 7.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 9-element array, stored in column-major format.
Throws:
IllegalArgumentException - If m.length is less than 9.
NullPointerException - If m is null.
Since:
BlackBerry API 6.0.0

set

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

Parameters:
m - An array containing 9 elements in column-major format.
offset - The offset into the array to begin reading at.
Throws:
IllegalArgumentException - If offset is less than zero or offset + 8 is greater than or equal to m.length.
NullPointerException - If m is null.
Since:
BlackBerry API 6.0.0

set

public final void set(float m00,
                      float m01,
                      float m02,
                      float m10,
                      float m11,
                      float m12,
                      float m20,
                      float m21,
                      float m22)
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.
m10 - the first element of the second row.
m11 - the second element of the second row.
m12 - the third 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.
Since:
BlackBerry API 6.0.0

set

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

Parameters:
m - the source matrix.
Throws:
NullPointerException - If m is null.
Since:
BlackBerry API 6.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-8).
value - the value to set.
Throws:
IllegalArgumentException - If index is less than zero or greater than 8.
Since:
BlackBerry API 6.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-2).
column - the column of the element (0-2).
value - the value to set
Throws:
IllegalArgumentException - If row or column is less than zero or greater than 2.
Since:
BlackBerry API 6.0.0

setIdentity

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

Since:
BlackBerry API 6.0.0

setZero

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

Since:
BlackBerry API 6.0.0

subtract

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

Parameters:
m - the matrix to subtract.
Throws:
NullPointerException - If m is null.
Since:
BlackBerry API 6.0.0

subtract

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

Parameters:
m1 - the first matrix.
m2 - the second matrix.
dst - a matrix which stores m1 - m2.
Throws:
NullPointerException - If m1, m2, or dst is null.
Since:
BlackBerry API 6.0.0

transformPoint

public final void transformPoint(Vector2f point)
Transforms the specified point by this matrix.

The result of the transformation is stored directly into point.

Parameters:
point - the point to transform.
Throws:
NullPointerException - If point is null.
Since:
BlackBerry API 6.0.0

transformPoint

public final void transformPoint(Vector2f point,
                                 Vector2f dst)
Transforms the specified point by this matrix, and stores the result in matrix dst.

Parameters:
point - the point to transform.
dst - a point to store the transformed point in.
Throws:
NullPointerException - If point or dst is null.
Since:
BlackBerry API 6.0.0

transformVector

public final void transformVector(Vector2f vector)
Transforms the specified vector by this matrix.

The result of the transformation is stored directly into vector.

Parameters:
vector - the vector to transform.
Throws:
NullPointerException - If vector is null.
Since:
BlackBerry API 6.0.0

transformVector

public final void transformVector(Vector2f vector,
                                  Vector2f dst)
Transforms the specified vector by this matrix, and stores the result in dst.

Parameters:
vector - the vector to transform.
dst - a vector to store the transformed vector in.
Throws:
NullPointerException - If vector or dst is null.
Since:
BlackBerry API 6.0.0

translate

public final void translate(float x,
                            float y)
Post-multiplies this matrix by the matrix corresponding to the specified translation.

Parameters:
x - amount to translate along the x-axis.
y - amount to translate along the y-axis.
Since:
BlackBerry API 6.0.0

translate

public final void translate(float x,
                            float y,
                            Matrix3f dst)
Post-multiplies this matrix by the matrix corresponding to the specified translation and stores the result in matrix dst.

Parameters:
x - amount to translate along the x-axis.
y - amount to translate along the y-axis.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

transpose

public final void transpose()
Transposes this matrix.

Since:
BlackBerry API 6.0.0

transpose

public final void transpose(Matrix3f dst)
Gets the transpose of this matrix in dst.

Parameters:
dst - a matrix to store the transpose in
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

createScale

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

Parameters:
xScale - the scale on the x-axis.
yScale - the scale on the y-axis.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

createShear

public static void createShear(float xAngle,
                               float yAngle,
                               Matrix3f dst)
Creates a shear matrix.

Parameters:
xAngle - the angle of shear in the x direction, in radians.
yAngle - the angle of shear in the y direction, in radians.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

createTranslation

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

Parameters:
xTrans - the translation on the x-axis.
yTrans - the translation on the y-axis.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

createRotation

public static void createRotation(float angle,
                                  Matrix3f dst)
Creates a rotation matrix from the specified angle.

Parameters:
angle - the angle, in radians.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.0.0

createRotation

public static void createRotation(float x,
                                  float y,
                                  float angle,
                                  Matrix3f dst)
Creates a rotation matrix from the specified center of rotation and angle.

Parameters:
x - the x-coordinate of the center of rotation.
y - the y-coordinate of the center of rotation.
angle - the angle, in radians.
dst - a matrix to store the result in.
Throws:
NullPointerException - If dst is null.
Since:
BlackBerry API 6.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 Matrix3f and if the elements are pairwise equal.
Throws:
NullPointerException - If obj is null.
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 6.0.0

equals

public boolean equals(Matrix3f 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.
Throws:
NullPointerException - If m is null.
Since:
BlackBerry API 6.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 6.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 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal