MaxstARSDK
com.maxst.ar.MatrixF4x4 Class Reference
Collaboration diagram for com.maxst.ar.MatrixF4x4:
Collaboration graph

Public Member Functions

 MatrixF4x4 ()
 
float[] getMatrix ()
 
int size ()
 
void setMatrix (float[] matrix)
 
void set (MatrixF4x4 source)
 
void setColumnMajor (boolean colMajor)
 
boolean isColumnMajor ()
 
void multiplyVector4fByMatrix (Vector4f vector)
 
void multiplyVector3fByMatrix (Vector3f vector)
 
void multiplyMatrix4x4ByMatrix (MatrixF4x4 matrixf)
 
void multiplyMatrix (float[] input, int inputOffset, float[] output, int outputOffset)
 
void transpose ()
 
void setX0 (float value)
 
void setX1 (float value)
 
void setX2 (float value)
 
void setY0 (float value)
 
void setY1 (float value)
 
void setY2 (float value)
 
void setZ0 (float value)
 
void setZ1 (float value)
 
void setZ2 (float value)
 
void setX3 (float value)
 
void setY3 (float value)
 
void setZ3 (float value)
 
void setW0 (float value)
 
void setW1 (float value)
 
void setW2 (float value)
 
void setW3 (float value)
 

Public Attributes

float[] matrix
 

Static Public Attributes

static final int[] matIndCol9_3x3 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }
 
static final int[] matIndCol16_3x3 = { 0, 1, 2, 4, 5, 6, 8, 9, 10 }
 
static final int[] matIndRow9_3x3 = { 0, 3, 6, 1, 4, 7, 3, 5, 8 }
 
static final int[] matIndRow16_3x3 = { 0, 4, 8, 1, 5, 9, 2, 6, 10 }
 
static final int[] matIndCol16_4x4 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
 
static final int[] matIndRow16_4x4 = { 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15 }
 

Detailed Description

The Class MatrixF4x4.

Internal the matrix is structured as

[ x0 , y0 , z0 , w0 ] [ x1 , y1 , z1 , w1 ] [ x2 , y2 , z2 , w2 ] [ x3 , y3 , z3 , w3 ]

it is recommend that when setting the matrix values individually that you use the set{x,#} methods, where 'x' is either x, y, z or w and # is either 0, 1, 2 or 3, setY1 for example. The reason you should use these functions is because it will map directly to that part of the matrix regardless of whether or not the internal matrix is column major or not. If the matrix is either or length 9 or 16 it will be able to determine if it can set the value or not. If the matrix is of size 9 but you set say w2, the value will not be set and the set method will return without any error.

Constructor & Destructor Documentation

◆ MatrixF4x4()

com.maxst.ar.MatrixF4x4.MatrixF4x4 ( )

Instantiates a new matrixf4x4. The Matrix is assumed to be Column major, however you can change this by using the setColumnMajor function to false and it will operate like a row major matrix.

Here is the call graph for this function:

Member Function Documentation

◆ getMatrix()

float [] com.maxst.ar.MatrixF4x4.getMatrix ( )

Gets the matrix.

Returns
the matrix, can be null if the matrix is invalid
Here is the caller graph for this function:

◆ isColumnMajor()

boolean com.maxst.ar.MatrixF4x4.isColumnMajor ( )

Find out if the stored matrix is column major

Returns

◆ multiplyMatrix()

void com.maxst.ar.MatrixF4x4.multiplyMatrix ( float[]  input,
int  inputOffset,
float[]  output,
int  outputOffset 
)
Here is the caller graph for this function:

◆ multiplyMatrix4x4ByMatrix()

void com.maxst.ar.MatrixF4x4.multiplyMatrix4x4ByMatrix ( MatrixF4x4  matrixf)

Multiply matrix4x4 by matrix.

Parameters
matrixfthe matrixf

for(int i = 0; i < 4; i++){ for(int j = 0; j < 4; j++){

int k = i * 4; bufferMatrix[0 + j] += this.matrix[k + j] * matrix[0 * 4 + i]; bufferMatrix[1 * 4 + j] += this.matrix[k + j] * matrix[1 * 4 + i]; bufferMatrix[2 * 4 + j] += this.matrix[k + j] * matrix[2 * 4 + i]; bufferMatrix[3 * 4 + j] += this.matrix[k + j] * matrix[3 * 4 + i]; } }

Here is the call graph for this function:

◆ multiplyVector3fByMatrix()

void com.maxst.ar.MatrixF4x4.multiplyVector3fByMatrix ( Vector3f  vector)

Multiply the given vector by this matrix. This should only be used if the matrix is of size 9 (use the matrix.size() method).

Parameters
vectorA vector of length 3.
Here is the call graph for this function:

◆ multiplyVector4fByMatrix()

void com.maxst.ar.MatrixF4x4.multiplyVector4fByMatrix ( Vector4f  vector)

Multiply the given vector by this matrix. This should only be used if the matrix is of size 16 (use the matrix.size() method).

Parameters
vectorA vector of length 4.
Here is the call graph for this function:

◆ set()

void com.maxst.ar.MatrixF4x4.set ( MatrixF4x4  source)

◆ setColumnMajor()

void com.maxst.ar.MatrixF4x4.setColumnMajor ( boolean  colMajor)

Set whether the internal data is col major by passing true, or false for a row major matrix. The matrix is column major by default.

Parameters
colMajor

◆ setMatrix()

void com.maxst.ar.MatrixF4x4.setMatrix ( float[]  matrix)

Sets the matrix from a float[16] array. If the matrix you set isn't 16 long then the matrix will be set as invalid.

Parameters
matrixthe new matrix
Here is the caller graph for this function:

◆ setW0()

void com.maxst.ar.MatrixF4x4.setW0 ( float  value)

◆ setW1()

void com.maxst.ar.MatrixF4x4.setW1 ( float  value)

◆ setW2()

void com.maxst.ar.MatrixF4x4.setW2 ( float  value)

◆ setW3()

void com.maxst.ar.MatrixF4x4.setW3 ( float  value)

◆ setX0()

void com.maxst.ar.MatrixF4x4.setX0 ( float  value)

◆ setX1()

void com.maxst.ar.MatrixF4x4.setX1 ( float  value)

◆ setX2()

void com.maxst.ar.MatrixF4x4.setX2 ( float  value)

◆ setX3()

void com.maxst.ar.MatrixF4x4.setX3 ( float  value)

◆ setY0()

void com.maxst.ar.MatrixF4x4.setY0 ( float  value)

◆ setY1()

void com.maxst.ar.MatrixF4x4.setY1 ( float  value)

◆ setY2()

void com.maxst.ar.MatrixF4x4.setY2 ( float  value)

◆ setY3()

void com.maxst.ar.MatrixF4x4.setY3 ( float  value)

◆ setZ0()

void com.maxst.ar.MatrixF4x4.setZ0 ( float  value)

◆ setZ1()

void com.maxst.ar.MatrixF4x4.setZ1 ( float  value)

◆ setZ2()

void com.maxst.ar.MatrixF4x4.setZ2 ( float  value)

◆ setZ3()

void com.maxst.ar.MatrixF4x4.setZ3 ( float  value)

◆ size()

int com.maxst.ar.MatrixF4x4.size ( )

◆ transpose()

void com.maxst.ar.MatrixF4x4.transpose ( )

This will rearrange the internal structure of the matrix. Be careful though as this is an expensive operation.

Member Data Documentation

◆ matIndCol16_3x3

final int [] com.maxst.ar.MatrixF4x4.matIndCol16_3x3 = { 0, 1, 2, 4, 5, 6, 8, 9, 10 }
static

◆ matIndCol16_4x4

final int [] com.maxst.ar.MatrixF4x4.matIndCol16_4x4 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
static

◆ matIndCol9_3x3

final int [] com.maxst.ar.MatrixF4x4.matIndCol9_3x3 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }
static

◆ matIndRow16_3x3

final int [] com.maxst.ar.MatrixF4x4.matIndRow16_3x3 = { 0, 4, 8, 1, 5, 9, 2, 6, 10 }
static

◆ matIndRow16_4x4

final int [] com.maxst.ar.MatrixF4x4.matIndRow16_4x4 = { 0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15 }
static

◆ matIndRow9_3x3

final int [] com.maxst.ar.MatrixF4x4.matIndRow9_3x3 = { 0, 3, 6, 1, 4, 7, 3, 5, 8 }
static

◆ matrix

float [] com.maxst.ar.MatrixF4x4.matrix

The matrix.


The documentation for this class was generated from the following file: