|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.math.VecMath
public final class VecMath
Implementations of a stack for use in matrix multiplication. Does matrix multiplication on 3x3 matrices.
NOTE: All matrix elements must be Fixed32
integers, that is, 32-bit ints that use the 16.16
convention to fix the decimal point. Use Fixed32.toFP(int)
and Fixed32.toInt(int)
to convert between normal integers and Fixed32 integers.
Field Summary | ||
---|---|---|
static int[] |
IDENTITY_3X3
3 x 3 identity matrix. |
Method Summary | ||
---|---|---|
static boolean |
intersects(int ax0,
int ay0,
int ax1,
int ay1,
int bx0,
int by0,
int bx1,
int by1)
Does line segment A intersection line segment B? |
|
static boolean |
isIdentity(int[] source,
int index)
Determines if this matrix is the indentity matrix. |
|
static boolean |
isTranslation(int[] source,
int index)
Determine if the matrix represented by the integer array is a translation. |
|
static void |
multiply3x3(int[] a,
int aStartIndex,
int[] b,
int bStartIndex)
Deprecated. use multiply3x3(int[],int,int[],int,int[],int) and pass B as the destination matrix. |
|
static void |
multiply3x3(int[] a,
int aStartIndex,
int[] b,
int bStartIndex,
int[] dest,
int destStartIndex)
Multiplies 2 3x3 matrices (A x B). |
|
static void |
multiply3x3Affine(int[] a,
int aStartIndex,
int[] b,
int bStartIndex,
int[] dest,
int destStartIndex)
Multiplies 2 affine 3x3 matrices (A x B). |
|
static long |
multiplyPoint(int[] matrix,
int pos,
int x,
int y)
Multiplies a given (x, y) point by a given matrix, and returns the result as a long number: the first 32 bits represent the resulting x-coordinate, and the second 32 bits represent the resulting y-coordinate So, resultX = (int) result resultY = (int) (result >>> 32) This method does the same as VecMath.pointMultiply3x3(int[], int, int, int, int[], int) , but it
does not require an array to store the return values. |
|
static void |
pointMultiply3x3(int[] a,
int aStartIndex,
int x,
int y,
int[] dest,
int destStartIndex)
Multiplies a given x,y point by a given 3x3 matrix. |
|
static void |
transformPoints(int[] matrix,
int matrixOffset,
int[] coordsX,
int[] coordsY,
int[] destX,
int[] destY)
Transforms an array of x,y coordinates represented by normal integers. |
|
static void |
transformPoints32(int[] matrix,
int matrixOffset,
int[] coordsX,
int[] coordsY,
int[] destX,
int[] destY)
Transforms an array of x,y coordinates represented by Fixed32 integers. |
|
static void |
transformPoints32(int[] matrix,
int matrixOffset,
int[] coordsX,
int[] coordsY,
int[] destX,
int[] destY,
int length)
Transforms an array of x,y coordinates represented by Fixed32 integers. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int[] IDENTITY_3X3
Method Detail |
---|
public static long multiplyPoint(int[] matrix, int pos, int x, int y)
This method does the same as
VecMath.pointMultiply3x3(int[], int, int, int, int[], int)
, but it
does not require an array to store the return values.
matrix
- the array containing the matrix to multiply.pos
- the index in a where the matrix begins.x
- the x coordinate (in Fixed 32 notation).y
- the y coordinate (in Fixed 32 notation).
public static void transformPoints(int[] matrix, int matrixOffset, int[] coordsX, int[] coordsY, int[] destX, int[] destY)
matrix
- The transformation matrix used to transform the input coordinates. The matrix elements
are in fixed-32 (15.16) format.matrixoffset
- The offset to the first point to be transformed in the matrix array.coordsX
- An array containing normal integers that represent the x coordinates to be transformed.coordsY
- An array containing normal integers that represent the Y coordinates to be transformed.destX
- The array into which the transformed x coordinates are returned as normal integers.destY
- The array into which the transformed y coordinates are returned as normal integers.public static void transformPoints32(int[] matrix, int matrixOffset, int[] coordsX, int[] coordsY, int[] destX, int[] destY)
matrix
- The transformation matrix used to transform the input coordinates. The matrix elements
are in fixed-32 (15.16) format.matrixoffset
- The offset to the first point to be transformed in the matrix array.coordsX
- An array containing normal integers that represent the x coordinates to be transformed.coordsY
- An array containing normal integers that represent the Y coordinates to be transformed.destX
- The array into which the transformed x coordinates are returned as normal integers.destY
- The array into which the transformed y coordinates are returned as normal integers.public static void transformPoints32(int[] matrix, int matrixOffset, int[] coordsX, int[] coordsY, int[] destX, int[] destY, int length)
matrix
- The transformation matrix used to transform the input coordinates. The matrix elements
are in fixed-32 (15.16) format.matrixoffset
- The offset to the first point to be transformed in the matrix array.coordsX
- An array containing normal integers that represent the x coordinates to be transformed.coordsY
- An array containing normal integers that represent the Y coordinates to be transformed.destX
- The array into which the transformed x coordinates are returned as normal integers.destY
- The array into which the transformed y coordinates are returned as normal integers.length
- If length
is -1, then all the values in the input arrays
are processed; otherwise, the first length
values in the input arrays are processed.public static final boolean isIdentity(int[] source, int index)
source
- Integer array containing the matrix.index
- Offset inside the matrix
public static final boolean isTranslation(int[] source, int index)
source
- Integer array containing the matrix.index
- Offset inside the matrix
public static boolean intersects(int ax0, int ay0, int ax1, int ay1, int bx0, int by0, int bx1, int by1)
public static void multiply3x3(int[] a, int aStartIndex, int[] b, int bStartIndex)
a
- the array containing matrix AaStartIndex
- the index of the start of matrix Ab
- the array containing matrix BbStartIndex
- the index of the start of matrix Bpublic static void multiply3x3(int[] a, int aStartIndex, int[] b, int bStartIndex, int[] dest, int destStartIndex)
a
- the array containing matrix AaStartIndex
- the index of the start of matrix Ab
- the array containing matrix BbStartIndex
- the index of the start of matrix Bdest
- the array to store the result of the multiplicationdestStartIndex
- the index at which to store the first value in
the matrix.public static void multiply3x3Affine(int[] a, int aStartIndex, int[] b, int bStartIndex, int[] dest, int destStartIndex)
The result is stored in the specified destination array. Please note, no bounds checks are made by this method. It assumes that the arrays are non-null and contain enough values/space for a 3x3 matrix. Also this method is optimized for affine matrices. Using it with non-affine matrices give incorrect and undefined behavior.
a
- the array containing matrix AaStartIndex
- the index of the start of matrix Ab
- the array containing matrix BbStartIndex
- the index of the start of matrix Bdest
- the array to store the result of the multiplicationdestStartIndex
- the index at which to store the first value in
the matrix.public static void pointMultiply3x3(int[] a, int aStartIndex, int x, int y, int[] dest, int destStartIndex)
a
- the array containing the matrix to multiply.aStartIndex
- the index in a where the matrix begins.x
- the x coordinate (in Fixed 32 notation).y
- the y coordinate (in Fixed 32 notation).dest
- the array in which to store the results.destStartOffset
- the index in dest where the results should be
stored.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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