Matrix with 4x4 elements. More...
Classes | |
class | FieldOfViewType |
Field of view type of a camera. More... | |
Public Member Functions | |
Matrix4x4 (long cPtr, boolean cMemoryOwn) | |
Matrix4x4 () | |
Default constructor, initializes the matrix to identity matrix. | |
Matrix4x4 (float x0, float x1, float x2, float x3, float x4, float x5, float x6, float x7, float x8, float x9, float x10, float x11, float x12, float x13, float x14, float x15) | |
Constructs the matrix from elements in column-major order. | |
Matrix4x4 (Vector3 x, Vector3 y, Vector3 z, Vector3 translation) | |
Constructs the matrix from four column vectors. | |
Matrix4x4 (Vector4 x, Vector4 y, Vector4 z, Vector4 translation) | |
Constructs the matrix from four column vectors. | |
Matrix4x4 | add (Matrix4x4 v) |
Modifies this matrix by adding another matrix. More... | |
synchronized void | delete () |
boolean | equals (Object obj) |
float | get (long index) |
Returns individual matrix element value at index. More... | |
Vector4 | getColumn (long index) |
Gets the column of a matrix. More... | |
Vector3 | getRotationAngle () |
Calculates Euler rotation angles of the matrix. More... | |
Vector4 | getRow (long index) |
Gets the row of a matrix. More... | |
Vector3 | getScale () |
Get scale as a vector. | |
Vector3 | getTranslation () |
Get translation. More... | |
float | getTranslationX () |
Get translation on X axis. More... | |
float | getTranslationY () |
Get translation on Y axis. More... | |
float | getTranslationZ () |
Get translation on Z axis. More... | |
Vector3 | getXAxis () |
Get X axis. | |
Vector3 | getYAxis () |
Get Y axis. | |
Vector3 | getZAxis () |
Get Z axis. | |
int | hashCode () |
Matrix4x4 | inverse () |
Applies an inversion to a matrix. More... | |
Matrix4x4 | inverseAffine () |
Applies an inversion to an affine matrix. More... | |
Matrix4x4 | inverseOrthogonal () |
Applies an inversion to an orthogonal affine matrix. More... | |
Vector3 | multiply (Vector3 vector) |
Multiply a 3-component vector with this matrix. More... | |
Vector4 | multiply (Vector4 vector) |
Multiply a 4-component vector with this matrix. More... | |
Matrix4x4 | multiply (Matrix4x4 m) |
Modifies this matrix by multiplying it with another matrix. More... | |
void | scale (Vector3 scale) |
Scales this matrix. More... | |
void | scaleUniform (float scale) |
Scales this matrix. More... | |
void | set (long index, float v) |
Sets the individual matrix element at index to value. More... | |
void | setColumn (long index, Vector4 column) |
Sets the column of a matrix. More... | |
void | setRow (long index, Vector4 row) |
Sets the row of a matrix. More... | |
void | setTranslation (Vector3 translation) |
Set translation. More... | |
void | setTranslationX (float translationX) |
Set translation on X axis. More... | |
void | setTranslationY (float translationY) |
Set translation on Y axis. More... | |
void | setTranslationZ (float translationZ) |
Set translation on Z axis. More... | |
void | setXAxis (Vector3 v) |
Set X axis. More... | |
void | setYAxis (Vector3 v) |
Set Y axis. More... | |
void | setZAxis (Vector3 v) |
Set Z axis. More... | |
Matrix4x4 | subtract (Matrix4x4 v) |
Modifies this matrix by subtracting another matrix from this matrix. More... | |
void | translate (Vector3 translate) |
Translates this matrix. More... | |
Matrix4x4 | transposed () |
Applies a transpose to a matrix. More... | |
Static Public Member Functions | |
static Matrix4x4 | add (Matrix4x4 lhs, Matrix4x4 rhs) |
Creates a new matrix by adding an existing matrix to another one. More... | |
static Vector4 | calculateCameraViewPosition (Matrix4x4 projectionCameraMatrix) |
Calculates a homogeneous camera view position that you can use to calculate the view direction in a shader. More... | |
static Matrix4x4 | createFromHomogenousMatrix (Matrix3x3 matrix, float zTranslation) |
Creates a matrix from an existing homogeneous matrix and Z translation. More... | |
static Matrix4x4 | createFromHomogenousMatrix (Matrix3x3 matrix) |
Creates a matrix from an existing homogeneous matrix. More... | |
static Matrix4x4 | createIdentity () |
Creates identity matrix. More... | |
static Matrix4x4 | createLookAtMatrix (Vector3 position, Vector3 lookAtPoint, Vector3 upVector) |
Creates a lookup transformation matrix, so that it is in a given position looking at the given point. More... | |
static Matrix4x4 | createOrthogonalProjection (float left, float right, float bottom, float top, float near, float far) |
Creates projection matrix for orthogonal projection. More... | |
static Matrix4x4 | createPerspectiveProjection (float near, float far, Matrix4x4.FieldOfViewType fovType, float fovInDegrees, float aspectRatio) |
Creates a perspective projection matrix for a symmetrical viewing volume. More... | |
static Matrix4x4 | createPerspectiveProjection (float near, float far, Vector4 fovInDegrees) |
Creates a perspective projection matrix for a viewing volume. More... | |
static Matrix4x4 | createRelativeOrthogonalProjection (float near, float far, Matrix4x4.FieldOfViewType fovType, float orthoSize, float aspectRatio) |
Creates an orthogonal projection matrix for a symmetrical viewing volume. More... | |
static Matrix4x4 | createRotation (float angleInRadians, Vector3 rotationAxis) |
Creates a rotation matrix over an arbitrary axis. More... | |
static Matrix4x4 | createRotationInDegrees (float angleInDegrees, Vector3 rotationAxis) |
Creates a rotation matrix over an arbitrary axis. More... | |
static Matrix4x4 | createScale (Vector3 scale) |
Creates a scaling matrix. More... | |
static Matrix4x4 | createSRT (Vector3 scale, Vector3 rotationInRadians, Vector3 translation) |
Create an SRT matrix. More... | |
static Matrix4x4 | createSubProjection (Matrix4x4 projection, float relativeOffsetX, float relativeOffsetY, float relativeSizeX, float relativeSizeY) |
Calculate sub-quad projection of an existing projection matrix. More... | |
static Matrix4x4 | createTranslation (Vector3 translation) |
Creates translation matrix. More... | |
static Matrix4x4 | createTranslation (float x, float y, float z) |
Creates translation matrix. More... | |
static Matrix4x4 | createXRotationInDegrees (float angleInDegrees) |
Creates a X rotation matrix. More... | |
static Matrix4x4 | createXRotationInRadians (float angleInRadians) |
Creates a X rotation matrix. More... | |
static Matrix4x4 | createYRotationInDegrees (float angleInDegrees) |
Creates a Y rotation matrix. More... | |
static Matrix4x4 | createYRotationInRadians (float angleInRadians) |
Creates a Y rotation matrix. More... | |
static Matrix4x4 | createZRotationInDegrees (float angleInDegrees) |
Creates a Z rotation matrix. More... | |
static Matrix4x4 | createZRotationInRadians (float angleInRadians) |
Creates a Z rotation matrix. More... | |
static Matrix3x3 | extract3x3 (Matrix4x4 matrix) |
Extracts the 3x3 rotation and scaling part of a matrix. | |
static boolean | extractSRT (Matrix4x4 matrix, Vector3 scale, Vector3 rotationInRadians, Vector3 translation) |
Extracts from a matrix the scale, rotation, and translation information. More... | |
static long | getCPtr (Matrix4x4 obj) |
static float | getDeterminant (Matrix4x4 matrix) |
Calculates the determinant of a matrix. More... | |
static float | getDeterminant3x3 (Matrix4x4 matrix) |
Calculates the determinant of the 3x3 part of a matrix. More... | |
static float | getTrace (Matrix4x4 matrix) |
Calculates the trace of a matrix. More... | |
static boolean | isTranslationOnly (Matrix4x4 matrix) |
Returns whether a matrix is translation-only. More... | |
static Vector3 | matrixMultiplyVectorBy3x3 (Matrix4x4 matrix, Vector3 vector) |
Multiplies a 3D vector with the top 3x3 part of a given matrix. More... | |
static Matrix4x4 | multiply (Matrix4x4 lhs, Matrix4x4 rhs) |
Multiplies two matrices and returns the product. More... | |
static Matrix4x4 | multiplyAffine (Matrix4x4 left, Matrix4x4 right) |
Multiplies two affine matrices and returns the product. More... | |
static Matrix4x4 | normalizeBase (Matrix4x4 matrix) |
Orthonormalizes base vectors of the given matrix. More... | |
static Matrix4x4 | orthonormalizeBase (Matrix4x4 matrix) |
Orthonormalizes base vectors of the given matrix. More... | |
static Matrix4x4 | subtract (Matrix4x4 lhs, Matrix4x4 rhs) |
Creates a new matrix by subtracting an existing matrix from another one. More... | |
static long | swigRelease (Matrix4x4 obj) |
Protected Member Functions | |
void | finalize () |
Protected Attributes | |
transient boolean | swigCMemOwn |
Matrix with 4x4 elements.
Modifies this matrix by adding another matrix.
v | Another matrix. |
Creates a new matrix by adding an existing matrix to another one.
lhs | First matrix, left hand side. |
rhs | Second matrix, right hand side. |
Calculates a homogeneous camera view position that you can use to calculate the view direction in a shader.
For orthogonal projections the w-component of the viewpoint is 0 to indicate that the viewpoint is at infinity.
projectionCameraMatrix | The matrix to use for calculating the viewpoint. |
Creates a matrix from an existing homogeneous matrix and Z translation.
matrix | Homogeneous matrix. |
zTranslation | X translation. |
Creates a matrix from an existing homogeneous matrix.
0.0f is used for the Z translation.
matrix | Homogeneous matrix. |
|
static |
Creates identity matrix.
|
static |
Creates a lookup transformation matrix, so that it is in a given position looking at the given point.
position | The new translation of the node. |
lookAtPoint | A point where the node is looking at. |
upVector | The new up vector of the node. |
|
static |
|
static |
Creates a perspective projection matrix for a symmetrical viewing volume.
near | Camera near value. |
far | Camera far value. |
fovType | Tells whether the fovInDegrees parameter is xfov or yfov. |
fovInDegrees | Field of view in degrees. |
aspectRatio | The aspect ratio of the viewport. |
Creates a perspective projection matrix for a viewing volume.
near | Camera near value. |
far | Camera far value. |
fovInDegrees | Field of view in degrees, specified in order left, right, up, down. Angles to the right of center and upwards of center are positive. |
|
static |
Creates an orthogonal projection matrix for a symmetrical viewing volume.
near | Camera near value. |
far | Camera far value. |
fovType | Tells whether the orthoSize parameter is the width or height of the viewing box. |
orthoSize | Specifies the size of the viewing box (either width of height). |
aspectRatio | Specifies the aspect ratio of the viewing box. |
Creates a rotation matrix over an arbitrary axis.
Similar to the matrix used by glRotatef.
The rotation axis needs not be normalized.
angleInRadians | Rotation angle in radians. |
rotationAxis | Arbitrary rotation axis. |
Creates a rotation matrix over an arbitrary axis.
Similar to the matrix used by glRotatef.
The rotation axis needs not be normalized.
angleInDegrees | Rotation angle in degrees. |
rotationAxis | Arbitrary rotation axis. |
Creates a scaling matrix.
scale | Scaling vector. |
Create an SRT matrix.
scale | Scales by axises. |
rotationInRadians | Rotation component in radians. |
translation | Translation component. |
|
static |
Calculate sub-quad projection of an existing projection matrix.
This is a specific solution for an axis-aligned case.
Old projection matrix =
[P00 0 P02 P03]
[ 0 P11 P12 P13]
[ 0 0 P22 P23]
[ 0 0 -1 0]
Traslated and scaled: (x, y) |–> (Ox, Oy) + (Sx * x, Sy * y)
[Sx P00, 0, Ox P22 + Sx P02, Ox P23]
[ 0, Sy P11, Oy P22 + Sy P12, Oy P23]
[ 0, 0, P22, P23]
[ 0, 0, -1, 0]
projection | Projection matrix. |
relativeOffsetX | X offset of sub-quad as portion of the size of the projection area. |
relativeOffsetY | Y offset of sub-quad as portion of the size of the projection area. |
relativeSizeX | Projection area X size in regard to sub-quad area size. |
relativeSizeY | Projection area Y size in regard to sub-quad area size. |
Creates translation matrix.
translation | Translation vector. |
|
static |
Creates translation matrix.
x | X component of the Translation vector. |
y | Y component of the Translation vector. |
z | Z component of the Translation vector. |
|
static |
Creates a X rotation matrix.
angleInDegrees | Rotation angle in degrees. |
|
static |
Creates a X rotation matrix.
angleInRadians | Rotation angle in radians. |
|
static |
Creates a Y rotation matrix.
angleInDegrees | Rotation angle in degrees. |
|
static |
Creates a Y rotation matrix.
angleInRadians | Rotation angle in radians. |
|
static |
Creates a Z rotation matrix.
angleInDegrees | Rotation angle in degrees. |
|
static |
Creates a Z rotation matrix.
angleInRadians | Rotation angle in radians. |
|
static |
Extracts from a matrix the scale, rotation, and translation information.
matrix | Input matrix. |
scale | Scale vector. |
rotationInRadians | Rotation vector, rotation angle in radians. |
translation | Translation vector. |
float get | ( | long | index | ) |
Returns individual matrix element value at index.
Vector4 getColumn | ( | long | index | ) |
Gets the column of a matrix.
index | Index of the accessed column. |
|
static |
Calculates the determinant of a matrix.
matrix | The matrix for which you want to return the determinant. |
|
static |
Calculates the determinant of the 3x3 part of a matrix.
matrix | The matrix for which you want to return the determinant. |
Vector3 getRotationAngle | ( | ) |
Calculates Euler rotation angles of the matrix.
Kanzi Engine represents Euler angles as Tait-Bryan angles where the rotations are applied in the order x, y and z.
Vector4 getRow | ( | long | index | ) |
Gets the row of a matrix.
index | Index of the accessed row. |
|
static |
Calculates the trace of a matrix.
Vector3 getTranslation | ( | ) |
Get translation.
float getTranslationX | ( | ) |
Get translation on X axis.
float getTranslationY | ( | ) |
Get translation on Y axis.
float getTranslationZ | ( | ) |
Get translation on Z axis.
Matrix4x4 inverse | ( | ) |
Applies an inversion to a matrix.
Matrix4x4 inverseAffine | ( | ) |
Applies an inversion to an affine matrix.
Matrix4x4 inverseOrthogonal | ( | ) |
Applies an inversion to an orthogonal affine matrix.
|
static |
Returns whether a matrix is translation-only.
matrix | Input matrix. |
Multiplies a 3D vector with the top 3x3 part of a given matrix.
matrix | The matrix that you want to multiply with a 3D vector. |
vector | The 3D vector that you want to multiply with a matrix. |
Multiply a 3-component vector with this matrix.
vector | A Vector3. |
Multiply a 4-component vector with this matrix.
vector | A Vector4. |
Modifies this matrix by multiplying it with another matrix.
m | Another matrix. |
Multiplies two matrices and returns the product.
lhs | First matrix, left hand side. |
rhs | Second matrix, right hand side. |
Multiplies two affine matrices and returns the product.
left | Left hand side matrix. |
right | Right hand side matrix. |
Orthonormalizes base vectors of the given matrix.
The result is in out_matrix.
The orthonormalization is done using the Gram-Schmidt process. Z axis is kept still, then Y is handled, then X.
This function can be used to prevent value drift.
matrix | Input matrix. |
Orthonormalizes base vectors of the given matrix.
The result is in out_matrix.
The orthonormalization is done using the Gram-Schmidt process. Z axis is kept still, then Y is handled, then X.
You can use this function to prevent value drift.
matrix | Input matrix. |
void scale | ( | Vector3 | scale | ) |
Scales this matrix.
scale | Scaling vector. |
void scaleUniform | ( | float | scale | ) |
Scales this matrix.
scale | Uniform scaling value. |
void set | ( | long | index, |
float | v | ||
) |
Sets the individual matrix element at index to value.
index | Matrix element index to set. |
void setColumn | ( | long | index, |
Vector4 | column | ||
) |
Sets the column of a matrix.
index | Index of the accessed column. |
column | The value to set to the column. |
void setRow | ( | long | index, |
Vector4 | row | ||
) |
Sets the row of a matrix.
index | Index of the accessed row. |
row | The value to set to the row. |
void setTranslation | ( | Vector3 | translation | ) |
Set translation.
translation | Translation vector. |
void setTranslationX | ( | float | translationX | ) |
Set translation on X axis.
translationX | Translation X component. |
void setTranslationY | ( | float | translationY | ) |
Set translation on Y axis.
translationY | Translation Y component. |
void setTranslationZ | ( | float | translationZ | ) |
Set translation on Z axis.
translationZ | Translation Y component. |
void setXAxis | ( | Vector3 | v | ) |
Set X axis.
v | X axis vector. |
void setYAxis | ( | Vector3 | v | ) |
Set Y axis.
v | Y axis vector. |
void setZAxis | ( | Vector3 | v | ) |
Set Z axis.
v | Z axis vector. |
Modifies this matrix by subtracting another matrix from this matrix.
v | Another matrix. |
Creates a new matrix by subtracting an existing matrix from another one.
lhs | First matrix, left hand side. |
rhs | Second matrix, right hand side. |
void translate | ( | Vector3 | translate | ) |
Translates this matrix.
translate | Translation vector. |
Matrix4x4 transposed | ( | ) |
Applies a transpose to a matrix.