Class Matrix
Definition
- Namespace:
- Tizen.NUI
- Assembly:
- Tizen.NUI.dll
The Matrix class represents transformations and projections.
The matrix is stored as a flat array and is Column Major, i.e. the storage order is as follows (numbers represent indices of array):
Copy0 4 8 12 1 5 9 13 2 6 10 14 3 7 11 15
Each axis is contiguous in memory, so the x-axis corresponds to elements 0, 1, 2 and 3, the y-axis corresponds to elements 4, 5, 6, 7, the z-axis corresponds to elements 12, 13, 14 and 15, and the translation vector corresponds to elements 12, 13 and 14.
C#Copypublic class Matrix : Disposable
- Inheritance
Constructors
Declaration
C#Copypublic Matrix()
Declaration
C#Copypublic Matrix(bool initialize)
Parameters
Type | Name | Description |
---|---|---|
Boolean | initialize | True if we want to initialize values as zero. False if we just allocate and do not initalize value. |
Declaration
C#Copypublic Matrix(float[] array)
Parameters
Type | Name | Description |
---|---|---|
Single[] | array | Array of float value. |
Declaration
C#Copypublic Matrix(Matrix matrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix | matrix | Matrix to create this matrix from |
Declaration
C#Copypublic Matrix(Rotation rotation)
Parameters
Type | Name | Description |
---|---|---|
Rotation | rotation | Rotation information. |
Properties
Declaration
C#Copypublic static Matrix Identity { get; }
Property Value
Type | Description |
---|---|
Matrix |
Declaration
C#Copypublic float this[uint index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
UInt32 | index | The index to get/set value. |
Property Value
Type | Description |
---|---|
Single |
Methods
Declaration
C#Copypublic bool EqualTo(Matrix rhs)
Parameters
Type | Name | Description |
---|---|---|
Matrix | rhs | The matrix to compare. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the two matrixes are equal, otherwise false. |
Declaration
C#Copypublic override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The Hash Code. |
GetTransformComponents(Vector3, Rotation, Vector3)
Gets the position, scale and rotation components from the given transform matrix.
Declaration
C#Copypublic void GetTransformComponents(Vector3 position, Rotation rotation, Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | Position to set. |
Rotation | rotation | Rotation to set - only valid if the transform matrix has not been skewed or sheared |
Vector3 | scale | Scale to set - only valid if the transform matrix has not been skewed or sheared. |
GetTranslation()
Gets the translate from a Transform matrix.
This assumes the matrix is a transform matrix.
Declaration
C#Copypublic Vector4 GetTranslation()
Returns
Type | Description |
---|---|
Vector4 | The Translation. |
GetTranslation3()
Gets the x, y, and z components of translate from a Transform matrix.
This assumes the matrix is a transform matrix.
Declaration
C#Copypublic Vector3 GetTranslation3()
Returns
Type | Description |
---|---|
Vector3 | The Translation. |
Declaration
C#Copypublic Vector3 GetXAxis()
Returns
Type | Description |
---|---|
Vector3 | The X axis. |
Declaration
C#Copypublic Vector3 GetYAxis()
Returns
Type | Description |
---|---|
Vector3 | The Y axis. |
Declaration
C#Copypublic Vector3 GetZAxis()
Returns
Type | Description |
---|---|
Vector3 | The Z axis. |
Declaration
C#Copypublic bool Invert()
Returns
Type | Description |
---|---|
Boolean | True if successful. |
InvertTransform(Matrix)
Inverts a transform Matrix.
Any Matrix representing only a rotation and/or translation
can be inverted using this function. It is faster and more accurate then using Invert().
Declaration
C#Copypublic void InvertTransform(Matrix result)
Parameters
Type | Name | Description |
---|---|---|
Matrix | result | The inverse of this Matrix. |
Declaration
C#Copypublic Matrix Multiply(Matrix rhs)
Parameters
Type | Name | Description |
---|---|---|
Matrix | rhs | The right-hand-side Matrix. |
Returns
Type | Description |
---|---|
Matrix | The matrix multiply as this * rhs. |
Multiply(Matrix, Matrix, Matrix)
Function to multiply two matrices and store the result onto third.
Use this method in time critical path as it does not require temporaries.
Declaration
C#Copypublic static void Multiply(Matrix result, Matrix lhs, Matrix rhs)
Parameters
Type | Name | Description |
---|---|---|
Matrix | result | Result of the multiplication. |
Matrix | lhs | The left-hand-side Matrix. this can be same matrix as result. |
Matrix | rhs | The right-hand-side Matrix. this cannot be same matrix as result. |
Multiply(Matrix, Matrix, Rotation)
Function to multiply a matrix and rotataion and store the result onto third.
Use this method in time critical path as it does not require temporaries.
Declaration
C#Copypublic static void Multiply(Matrix result, Matrix lhs, Rotation rhs)
Parameters
Type | Name | Description |
---|---|---|
Matrix | result | Result of the multiplication. |
Matrix | lhs | The left-hand-side Matrix. this can be same matrix as result. |
Rotation | rhs | The right-hand-side Rotation. |
Declaration
C#Copypublic Vector4 Multiply(Vector4 rhs)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | rhs | The right-hand-side Vector4. |
Returns
Type | Description |
---|---|
Vector4 | The vector multiply as this * rhs. |
MultiplyAssign(Matrix)
Multiply the Matrix and Matrix. Result will be stored into this Matrix.
Declaration
C#Copypublic void MultiplyAssign(Matrix rhs)
Parameters
Type | Name | Description |
---|---|---|
Matrix | rhs | The right-hand-side Matrix. |
Declaration
C#Copypublic bool NotEqualTo(Matrix rhs)
Parameters
Type | Name | Description |
---|---|---|
Matrix | rhs | The matrix to compare. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the two matrixes are not equal, otherwise false. |
OrthoNormalize()
Makes the axes of the matrix orthogonal to each other and of unit length.
This function is used to correct floating point errors which would otherwise accumulate
as operations are applied to the matrix.
This assumes the matrix is a transform matrix.
Declaration
C#Copypublic void OrthoNormalize()
Declaration
C#Copyprotected override void ReleaseSwigCPtr(Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type | Name | Description |
---|---|---|
Tizen.System.Runtime.InteropServices.HandleRef | swigCPtr |
Overrides
Declaration
C#Copypublic void SetIdentity()
Declaration
C#Copypublic void SetIdentityAndScale(Vector3 scale)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scale | The scale value to be multiplied into identity Matrix. |
SetInverseTransformComponents(Vector3, Rotation, Vector3)
Sets this matrix to contain the inverse of the position, scale and rotation components.
Performs scale, rotation, then translation
Declaration
C#Copypublic void SetInverseTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scale | Scale to apply. |
Rotation | rotation | Rotation to apply. |
Vector3 | translation | Translation to apply. |
SetInverseTransformComponents(Vector3, Vector3, Vector3, Vector3)
Sets this matrix to contain the inverse of the orthonormal basis and position components.
Performs scale, rotation, then translation
Declaration
C#Copypublic void SetInverseTransformComponents(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | xAxis | The X axis of the basis. |
Vector3 | yAxis | The Y axis of the basis. |
Vector3 | zAxis | The Z axis of the basis. |
Vector3 | translation | Translation to apply. |
SetTransformComponents(Vector3, Rotation, Vector3)
Sets this matrix to contain the position, scale and rotation components.
Performs scale, rotation, then translation
Declaration
C#Copypublic void SetTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | scale | Scale to apply. |
Rotation | rotation | Rotation to apply. |
Vector3 | translation | Translation to apply. |
SetTranslation(Vector3)
Sets the translate to a Transform matrix.
This assumes the matrix is a transform matrix.
Declaration
C#Copypublic void SetTranslation(Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | translation | The translation. |
SetTranslation(Vector4)
Sets the translate to a Transform matrix.
This assumes the matrix is a transform matrix.
Declaration
C#Copypublic void SetTranslation(Vector4 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector4 | translation | The translation. |
Declaration
C#Copypublic void SetValueAtIndex(uint index, float value)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | index | The index to set value. |
Single | value | The value to set. |
SetValueAtIndex(UInt32, UInt32, Single)
Set the value at matrix by it's row index and column index.
Declaration
C#Copypublic void SetValueAtIndex(uint indexRow, uint indexColumn, float value)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | indexRow | The row index to set value. |
UInt32 | indexColumn | The column index to set value. |
Single | value | The value to set. |
SetXAxis(Vector3)
Sets the X Axis to a Transform matrix.
This assumes the matrix is a transform matrix.
Declaration
C#Copypublic void SetXAxis(Vector3 axis)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | axis | The X axis. |
SetYAxis(Vector3)
Sets the Y Axis to a Transform matrix.
This assumes the matrix is a transform matrix.
Declaration
C#Copypublic void SetYAxis(Vector3 axis)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | axis | The Y axis. |
SetZAxis(Vector3)
Sets the Z Axis to a Transform matrix.
This assumes the matrix is a transform matrix.
Declaration
C#Copypublic void SetZAxis(Vector3 axis)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | axis | The Z axis. |
Declaration
C#Copypublic void Transpose()
Declaration
C#Copypublic float ValueOfIndex(uint index)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | index | The index to get value. |
Returns
Type | Description |
---|---|
Single | A value of index |
ValueOfIndex(UInt32, UInt32)
Get the value of matrix by it's row index and column index.
Declaration
C#Copypublic float ValueOfIndex(uint indexRow, uint indexColumn)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | indexRow | The row index to get value. |
UInt32 | indexColumn | The column index to get value. |
Returns
Type | Description |
---|---|
Single | A value of index |
Operators
Declaration
C#Copypublic static Matrix operator *(Matrix lhs, Matrix rhs)
Parameters
Type | Name | Description |
---|---|---|
Matrix | lhs | The left-hand-side Matrix. |
Matrix | rhs | The right-hand-side Matrix. |
Returns
Type | Description |
---|---|
Matrix | The Matrix multiply as lhs * rhs. |
Declaration
C#Copypublic static Vector4 operator *(Matrix lhs, Vector4 rhs)
Parameters
Type | Name | Description |
---|---|---|
Matrix | lhs | The left-hand-side Matrix. |
Vector4 | rhs | The right-hand-side Vector4. |
Returns
Type | Description |
---|---|
Vector4 | The vector multiply as lhs * rhs. |
Declaration
C#Copypublic static Matrix operator *(Rotation lhs, Matrix rhs)
Parameters
Type | Name | Description |
---|---|---|
Rotation | lhs | The left-hand-side Rotation. |
Matrix | rhs | The right-hand-side Matrix. |
Returns
Type | Description |
---|---|
Matrix | The Matrix multiply as lhs * rhs. |