Tizen Native API
5.0
|
A 3x3 matrix. More...
Public Member Functions | |
Matrix3 () | |
Constructor. | |
Matrix3 (const Matrix3 &m) | |
Copy Constructor. | |
Matrix3 (const Matrix &m) | |
Constructor. | |
Matrix3 (float s00, float s01, float s02, float s10, float s11, float s12, float s20, float s21, float s22) | |
Constructor. | |
Matrix3 & | operator= (const Matrix3 &matrix) |
Assignment Operator. | |
Matrix3 & | operator= (const Matrix &matrix) |
Assignment Operator. | |
bool | operator== (const Matrix3 &rhs) const |
The equality operator. | |
bool | operator!= (const Matrix3 &rhs) const |
The inequality operator. | |
~Matrix3 () | |
Destructor. | |
void | SetIdentity () |
Sets the matrix to the identity matrix. | |
const float * | AsFloat () const |
Returns the contents of the matrix as an array of 9 floats. | |
float * | AsFloat () |
Returns the contents of the matrix as an array of 9 floats. | |
bool | Invert () |
Inverts the matrix. | |
bool | Transpose () |
Swaps the rows to columns. | |
void | Scale (float scale) |
Multiplies all elements of the matrix by the scale value. | |
float | Magnitude () const |
Magnitude returns the average of the absolute values of the elements * 3. | |
bool | ScaledInverseTranspose () |
If the matrix is invertible, then this method inverts, transposes and scales the matrix such that the resultant element values average 1. | |
Static Public Member Functions | |
static void | Multiply (Matrix3 &result, const Matrix3 &lhs, const Matrix3 &rhs) |
Function to multiply two matrices and store the result onto third. | |
Static Public Attributes | |
static const Matrix3 | IDENTITY |
The identity matrix. | |
Friends | |
DALI_CORE_API std::ostream & | operator<< (std::ostream &o, const Matrix3 &matrix) |
Prints a 3x3 matrix. |
Detailed Description
A 3x3 matrix.
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):
0 3 6 1 4 7 2 5 8
Each axis is contiguous in memory, so the x-axis corresponds to elements 0, 1 and 2, the y-axis corresponds to elements 3, 4 and 5, and the z-axis corresponds to elements 6, 7 and 8.
- Since:
- 3.0, DALi version 1.0.0
Constructor & Destructor Documentation
Constructor.
- Since:
- 3.0, DALi version 1.0.0
Dali::Matrix3::Matrix3 | ( | const Matrix3 & | m | ) |
Copy Constructor.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] m A reference to the copied 3x3 matrix
Dali::Matrix3::Matrix3 | ( | const Matrix & | m | ) |
Constructor.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] m A 4x4 matrix. The translation and shear components are ignored
Dali::Matrix3::Matrix3 | ( | float | s00, |
float | s01, | ||
float | s02, | ||
float | s10, | ||
float | s11, | ||
float | s12, | ||
float | s20, | ||
float | s21, | ||
float | s22 | ||
) |
Constructor.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] s00 First element [in] s01 Second element [in] s02 Third element [in] s10 Fourth element [in] s11 Fifth element [in] s12 Sixth element [in] s20 Seventh element [in] s21 Eighth element [in] s22 Ninth element
Destructor.
- Since:
- 3.0, DALi version 1.0.0
Member Function Documentation
const float* Dali::Matrix3::AsFloat | ( | ) | const |
Returns the contents of the matrix as an array of 9 floats.
The order of the values for a matrix is:
[ xAxis.x, xAxis.y, xAxis.z, yAxis.x, yAxis.y, yAxis.z, zAxis.x, zAxis.y, zAxis.z ]
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- The matrix contents as an array of 9 floats
float* Dali::Matrix3::AsFloat | ( | ) |
Returns the contents of the matrix as an array of 9 floats.
The order of the values for a matrix is:
[ xAxis.x, xAxis.y, xAxis.z, yAxis.x, yAxis.y, yAxis.z, zAxis.x, zAxis.y, zAxis.z ]
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- The matrix contents as an array of 9 floats
bool Dali::Matrix3::Invert | ( | ) |
Inverts the matrix.
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- True if successful
float Dali::Matrix3::Magnitude | ( | ) | const |
Magnitude returns the average of the absolute values of the elements * 3.
(The Magnitude of the unit matrix is therefore 1)
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- The magnitude - always positive
static void Dali::Matrix3::Multiply | ( | Matrix3 & | result, |
const Matrix3 & | lhs, | ||
const Matrix3 & | rhs | ||
) | [static] |
Function to multiply two matrices and store the result onto third.
Use this method in time critical path as it does not require temporaries
result = rhs * lhs
- Since:
- 3.0, DALi version 1.0.0
bool Dali::Matrix3::operator!= | ( | const Matrix3 & | rhs | ) | const |
The inequality operator.
Utilizes appropriate machine epsilon values.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The Matrix to compare this to
- Returns:
- true if the matrices are equal
Assignment Operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] matrix From which to copy values
- Returns:
- Reference to this object
Assignment Operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] matrix A reference to the copied matrix
- Returns:
- A reference to this
bool Dali::Matrix3::operator== | ( | const Matrix3 & | rhs | ) | const |
The equality operator.
Utilizes appropriate machine epsilon values.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] rhs The Matrix to compare this to
- Returns:
- True if the matrices are equal
void Dali::Matrix3::Scale | ( | float | scale | ) |
Multiplies all elements of the matrix by the scale value.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] scale The value by which to scale the whole matrix
If the matrix is invertible, then this method inverts, transposes and scales the matrix such that the resultant element values average 1.
If the matrix is not invertible, then the matrix is left unchanged.
- Since:
- 3.0, DALi version 1.0.0
- Returns:
true
if the matrix is invertible, otherwisefalse
void Dali::Matrix3::SetIdentity | ( | ) |
Sets the matrix to the identity matrix.
- Since:
- 3.0, DALi version 1.0.0
bool Dali::Matrix3::Transpose | ( | ) |
Swaps the rows to columns.
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- True if successful
Friends And Related Function Documentation
DALI_CORE_API std::ostream& operator<< | ( | std::ostream & | o, |
const Matrix3 & | matrix | ||
) | [friend] |
Prints a 3x3 matrix.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] o The output stream operator [in] matrix The matrix to print
- Returns:
- The output stream operator