Tizen Native API  6.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.
Matrix3operator= (const Matrix3 &matrix)
 Assignment Operator.
Matrix3operator= (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

Copy Constructor.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]mA reference to the copied 3x3 matrix

Constructor.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]mA 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]s00First element
[in]s01Second element
[in]s02Third element
[in]s10Fourth element
[in]s11Fifth element
[in]s12Sixth element
[in]s20Seventh element
[in]s21Eighth element
[in]s22Ninth 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

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

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
Parameters:
[out]resultResult of the multiplication
[in]lhsMatrix, this can be same matrix as result
[in]rhsMatrix, this cannot be same matrix as result
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]rhsThe Matrix to compare this to
Returns:
true if the matrices are equal
Matrix3& Dali::Matrix3::operator= ( const Matrix3 matrix)

Assignment Operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]matrixFrom which to copy values
Returns:
Reference to this object
Matrix3& Dali::Matrix3::operator= ( const Matrix matrix)

Assignment Operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]matrixA 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]rhsThe 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]scaleThe 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, otherwise false

Sets the matrix to the identity matrix.

Since:
3.0, DALi version 1.0.0

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]oThe output stream operator
[in]matrixThe matrix to print
Returns:
The output stream operator