Ocular Engine
Ocular::Math::Matrix3x3 Class Reference

A 3x3 column-major float matrix. More...

#include <Matrix3x3.hpp>

Public Member Functions

 Matrix3x3 (float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2)
 
 Matrix3x3 (float const *values)
 
 Matrix3x3 (Vector3< float > const &col0, Vector3< float > const &col1, Vector3< float > const &col2)
 
 Matrix3x3 (Quaternion const &quat)
 
 Matrix3x3 (Euler const &euler)
 
 Matrix3x3 (Vector3< float > const &euler)
 
 Matrix3x3 (Matrix3x3_Internal const &data)
 
 Matrix3x3 (Matrix3x3 const &other)
 
 Matrix3x3 ()
 
float operator[] (uint32_t index)
 
Matrix3x3operator= (Matrix3x3 const &rhs)
 
Matrix3x3operator+= (Matrix3x3 const &rhs)
 
Matrix3x3operator-= (Matrix3x3 const &rhs)
 
Matrix3x3operator*= (Matrix3x3 const &rhs)
 
Matrix3x3operator*= (Vector3< float > const &rhs)
 
Matrix3x3operator*= (float rhs)
 
void setElement (uint32_t index, float value)
 
float getElement (uint32_t index) const
 
void setRow (uint32_t index, Vector3< float > const &row)
 
void getRow (uint32_t index, Vector3< float > &row) const
 
Vector3< float > getRow (uint32_t index) const
 
void setCol (uint32_t index, Vector3< float > const &col)
 
void getCol (uint32_t index, Vector3< float > &col) const
 
Vector3< float > getCol (uint32_t index) const
 
void setData (float const *data)
 
void getData (float *data) const
 
void invert ()
 
Matrix3x3 getInverse () const
 
float getDeterminant () const
 
Matrix3x3 getTranspose () const
 
Matrix3x3_InternalgetInternal () const
 

Detailed Description

A 3x3 column-major float matrix.

x.x y.x z.x x.y y.y z.y x.z y.z z.z

00 10 20 01 11 21 02 12 22

00 03 06 01 04 07 02 05 08

Constructor & Destructor Documentation

Ocular::Math::Matrix3x3::Matrix3x3 ( float  x0,
float  y0,
float  z0,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)

Creates a new 3x3 column-major matrix.

Parameters
[in]x0First element of the x-rotation column
[in]y0First element of the y-rotation column
[in]z0First element of the z-rotation column
[in]x1Second element of the x-rotation column
[in]y1Second element of the y-rotation column
[in]z1Second element of the z-rotation column
[in]x2Third element of the x-rotation column
[in]y2Third element of the y-rotation column
[in]z2Third element of the z-rotation column
Ocular::Math::Matrix3x3::Matrix3x3 ( float const *  values)

Creates a new 3x3 column-major matrix.

Parameters
[in]values9-element float array of values in column-major order ({x0, x1, x2, ..., z2, z3})
Ocular::Math::Matrix3x3::Matrix3x3 ( Quaternion const &  quat)

Constructs a 3x3 rotational matrix from a quaternion.

Parameters
[in]quat
Ocular::Math::Matrix3x3::Matrix3x3 ( Euler const &  euler)

Constructs a 3x3 rotational matrix from a set of Euler angles.

Parameters
[in]euler
Ocular::Math::Matrix3x3::Matrix3x3 ( Vector3< float > const &  euler)

Constructs a 3x3 rotational matrix from a set of euler angles.

Parameters
[in]euler(pitch, yaw, roll)
Ocular::Math::Matrix3x3::Matrix3x3 ( )

Creates a new identity Matrix

Member Function Documentation

void Ocular::Math::Matrix3x3::getCol ( uint32_t  index,
Vector3< float > &  col 
) const

Retrieves the value of a single column of the matrix.

Parameters
[in]indexColumn index [0, 3)
[out]colVector to store the column values
void Ocular::Math::Matrix3x3::getData ( float *  data) const

Retrieves the matrix data values as an array of floats.

Parameters
[out]dataAn array of at least 9 floating point values (if more, only the first 9 are filled).
float Ocular::Math::Matrix3x3::getElement ( uint32_t  index) const

Returns an individual element of the matrix. Matrix elements are ordered as follows:

{rotX.x, rotX.y, rotX.z, rotY.x, rotY.y, rotY.z, rotZ.x, rotZ.y, rotZ.z}

or

0 3 6
1 4 7
2 5 8
Parameters
[in]indexElement index to retrieve.
Returns
Element value at the specified index.
Matrix3x3_Internal * Ocular::Math::Matrix3x3::getInternal ( ) const

For internal use only. Only modify this pointer if you want your application to crash.

void Ocular::Math::Matrix3x3::getRow ( uint32_t  index,
Vector3< float > &  row 
) const

Retrieves the value of a single row of the matrix.

Parameters
[in]indexRow index [0, 3)
[out]rowVector to store the row values
void Ocular::Math::Matrix3x3::setCol ( uint32_t  index,
Vector3< float > const &  col 
)

Sets the value of a single column of the matrix.

Parameters
[in]indexColumn index [0,3)
[in]colVector of column values
void Ocular::Math::Matrix3x3::setData ( float const *  data)

Sets the matrix data values from an array of floats.

Parameters
[in]dataAn array of at least 9 floating point values (if more, only the first 9 are used).
void Ocular::Math::Matrix3x3::setElement ( uint32_t  index,
float  value 
)

Sets an individual element of the matrix. Matrix elements are ordered as follows:

{rotX.x, rotX.y, rotX.z, rotY.x, rotY.y, rotY.z, rotZ.x, rotZ.y, rotZ.z}

or

0 3 6
1 4 7
2 5 8
Parameters
[in]indexElement index to set [0, 9)
[in]valueValue to set the element to
void Ocular::Math::Matrix3x3::setRow ( uint32_t  index,
Vector3< float > const &  row 
)

Sets the value of a single row of the matrix.

Parameters
[in]indexRow index [0,3)
[in]rowVector of row values

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