Ogre::Matrix3 Class Reference
Core » Math

A 3x3 matrix which can represent rotations around axes. More...

`#include <OgreMatrix3.h>`

## Public Member Functions

| Matrix3 ()
| Default constructor. More...
| Matrix3 (const Real arr[3][3])
| Matrix3 (const Matrix3 &rkMatrix)
| Matrix3 (Real fEntry00, Real fEntry01, Real fEntry02, Real fEntry10, Real fEntry11, Real fEntry12, Real fEntry20, Real fEntry21, Real fEntry22)
Real | Determinant () const
void | EigenSolveSymmetric (Real afEigenvalue[3], Vector3 akEigenvector[3]) const
| Eigensolver, matrix must be symmetric. More...
void | FromAngleAxis (const Vector3 &rkAxis, const Radian &fRadians)
void | FromAxes (const Vector3 &xAxis, const Vector3 &yAxis, const Vector3 &zAxis)
void | FromEulerAnglesXYZ (const Radian &fYAngle, const Radian &fPAngle, const Radian &fRAngle)
void | FromEulerAnglesXZY (const Radian &fYAngle, const Radian &fPAngle, const Radian &fRAngle)
void | FromEulerAnglesYXZ (const Radian &fYAngle, const Radian &fPAngle, const Radian &fRAngle)
void | FromEulerAnglesYZX (const Radian &fYAngle, const Radian &fPAngle, const Radian &fRAngle)
void | FromEulerAnglesZXY (const Radian &fYAngle, const Radian &fPAngle, const Radian &fRAngle)
void | FromEulerAnglesZYX (const Radian &fYAngle, const Radian &fPAngle, const Radian &fRAngle)
Vector3 | GetColumn (size_t iCol) const
bool | hasScale () const
| Determines if this matrix involves a scaling. More...
bool | Inverse (Matrix3 &rkInverse, Real fTolerance=1e-06) const
Matrix3 | Inverse (Real fTolerance=1e-06) const
bool | operator!= (const Matrix3 &rkMatrix) const
| Tests 2 matrices for inequality. More...
Matrix3 | operator* (const Matrix3 &rkMatrix) const
| Matrix concatenation using '*'. More...
Vector3 | operator* (const Vector3 &rkVector) const
| Matrix * vector [3x3 * 3x1 = 3x1]. More...
Matrix3 | operator* (Real fScalar) const
| Matrix * scalar. More...
Matrix3 | operator+ (const Matrix3 &rkMatrix) const
| Matrix addition. More...
Matrix3 | operator- (const Matrix3 &rkMatrix) const
| Matrix subtraction. More...
Matrix3 | operator- () const
Matrix3 & | operator= (const Matrix3 &rkMatrix)
| Assignment and comparison. More...
bool | operator== (const Matrix3 &rkMatrix) const
| Tests 2 matrices for equality. More...
const Real * | operator[] (size_t iRow) const
| Member access, allows use of construct mat[r][c]. More...
Real * | operator[] (size_t iRow)
void | Orthonormalize ()
| Gram-Schmidt orthonormalization (applied to columns of rotation matrix) More...
void | QDUDecomposition (Matrix3 &rkQ, Vector3 &rkD, Vector3 &rkU) const
| Orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12) More...
void | SetColumn (size_t iCol, const Vector3 &vec)
void | SingularValueComposition (const Matrix3 &rkL, const Vector3 &rkS, const Matrix3 &rkR)
void | SingularValueDecomposition (Matrix3 &rkL, Vector3 &rkS, Matrix3 &rkR) const
| Singular value decomposition. More...
Real | SpectralNorm () const
void | swap (Matrix3 &other)
| Exchange the contents of this matrix with another. More...
void | ToAngleAxis (Vector3 &rkAxis, Radian &rfAngle) const
| Note: Matrix must be orthonormal. More...
void | ToAngleAxis (Vector3 &rkAxis, Degree &rfAngle) const
bool | ToEulerAnglesXYZ (Radian &rfYAngle, Radian &rfPAngle, Radian &rfRAngle) const
| The matrix must be orthonormal. More...
bool | ToEulerAnglesXZY (Radian &rfYAngle, Radian &rfPAngle, Radian &rfRAngle) const
bool | ToEulerAnglesYXZ (Radian &rfYAngle, Radian &rfPAngle, Radian &rfRAngle) const
bool | ToEulerAnglesYZX (Radian &rfYAngle, Radian &rfPAngle, Radian &rfRAngle) const
bool | ToEulerAnglesZXY (Radian &rfYAngle, Radian &rfPAngle, Radian &rfRAngle) const
bool | ToEulerAnglesZYX (Radian &rfYAngle, Radian &rfPAngle, Radian &rfRAngle) const
Matrix3 | Transpose () const

## Static Public Member Functions

static void | TensorProduct (const Vector3 &rkU, const Vector3 &rkV, Matrix3 &rkProduct)

## Static Public Attributes

static const Real | EPSILON
static const Matrix3 | IDENTITY
static const Matrix3 | ZERO

## Protected Member Functions

bool | QLAlgorithm (Real afDiag[3], Real afSubDiag[3])
void | Tridiagonal (Real afDiag[3], Real afSubDiag[3])

## Static Protected Member Functions

static void | Bidiagonalize (Matrix3 &kA, Matrix3 &kL, Matrix3 &kR)
static void | GolubKahanStep (Matrix3 &kA, Matrix3 &kL, Matrix3 &kR)
static Real | MaxCubicRoot (Real afCoeff[3])

## Protected Attributes

Real | m [3][3]

## Static Protected Attributes

static const Real | msSvdEpsilon
static const unsigned int | msSvdMaxIterations

## Friends

class | Matrix4
_OgreExport friend Vector3 | operator* (const Vector3 &rkVector, const Matrix3 &rkMatrix)
| Vector * matrix [1x3 * 3x3 = 1x3]. More...
_OgreExport friend Matrix3 | operator* (Real fScalar, const Matrix3 &rkMatrix)
| Scalar * matrix. More...
_OgreExport friend std::ostream & | operator<< (std::ostream &o, const Matrix3 &mat)
| Function for writing to a stream. More...

## Detailed Description

A 3x3 matrix which can represent rotations around axes.

Note
  All the code is adapted from the Wild Magic 0.2 Matrix library (http://www.geometrictools.com/).

  The coordinate system is assumed to be right-handed.

Definition at line 68 of file OgreMatrix3.h.

## Constructor & Destructor Documentation

## Matrix3() [1/4]

Ogre::Matrix3::Matrix3 | ( |  | ) |

Default constructor.

Note
  It does NOT initialize the matrix for efficiency.

Definition at line 75 of file OgreMatrix3.h.

## Matrix3() [2/4]

Ogre::Matrix3::Matrix3 | ( | const Real | arr[3][3] | ) |

explicit

Definition at line 76 of file OgreMatrix3.h.

## Matrix3() [3/4]

Ogre::Matrix3::Matrix3 | ( | const Matrix3 & | rkMatrix | ) |

Definition at line 80 of file OgreMatrix3.h.

References m.

## Matrix3() [4/4]

Ogre::Matrix3::Matrix3 | ( | Real | fEntry00,
|  | Real | fEntry01,
|  | Real | fEntry02,
|  | Real | fEntry10,
|  | Real | fEntry11,
|  | Real | fEntry12,
|  | Real | fEntry20,
|  | Real | fEntry21,
|  | Real | fEntry22
| ) |  |

Definition at line 84 of file OgreMatrix3.h.

## Member Function Documentation

## Bidiagonalize()

static void Ogre::Matrix3::Bidiagonalize | ( | Matrix3 & | kA,
|  | Matrix3 & | kL,
|  | Matrix3 & | kR
| ) |  |

static protected

## Determinant()

Real Ogre::Matrix3::Determinant | ( |  | ) | const

## EigenSolveSymmetric()

void Ogre::Matrix3::EigenSolveSymmetric | ( | Real | afEigenvalue[3],
|  | Vector3 | akEigenvector[3]
| ) |  | const

Eigensolver, matrix must be symmetric.

## FromAngleAxis()

void Ogre::Matrix3::FromAngleAxis | ( | const Vector3 & | rkAxis,
|  | const Radian & | fRadians
| ) |  |

## FromAxes()

void Ogre::Matrix3::FromAxes | ( | const Vector3 & | xAxis,
|  | const Vector3 & | yAxis,
|  | const Vector3 & | zAxis
| ) |  |

## FromEulerAnglesXYZ()

void Ogre::Matrix3::FromEulerAnglesXYZ | ( | const Radian & | fYAngle,
|  | const Radian & | fPAngle,
|  | const Radian & | fRAngle
| ) |  |

## FromEulerAnglesXZY()

void Ogre::Matrix3::FromEulerAnglesXZY | ( | const Radian & | fYAngle,
|  | const Radian & | fPAngle,
|  | const Radian & | fRAngle
| ) |  |

## FromEulerAnglesYXZ()

void Ogre::Matrix3::FromEulerAnglesYXZ | ( | const Radian & | fYAngle,
|  | const Radian & | fPAngle,
|  | const Radian & | fRAngle
| ) |  |

## FromEulerAnglesYZX()

void Ogre::Matrix3::FromEulerAnglesYZX | ( | const Radian & | fYAngle,
|  | const Radian & | fPAngle,
|  | const Radian & | fRAngle
| ) |  |

## FromEulerAnglesZXY()

void Ogre::Matrix3::FromEulerAnglesZXY | ( | const Radian & | fYAngle,
|  | const Radian & | fPAngle,
|  | const Radian & | fRAngle
| ) |  |

## FromEulerAnglesZYX()

void Ogre::Matrix3::FromEulerAnglesZYX | ( | const Radian & | fYAngle,
|  | const Radian & | fPAngle,
|  | const Radian & | fRAngle
| ) |  |

## GetColumn()

Vector3 Ogre::Matrix3::GetColumn | ( | size_t | iCol | ) | const

## GolubKahanStep()

static void Ogre::Matrix3::GolubKahanStep | ( | Matrix3 & | kA,
|  | Matrix3 & | kL,
|  | Matrix3 & | kR
| ) |  |

static protected

## hasScale()

bool Ogre::Matrix3::hasScale | ( |  | ) | const

Determines if this matrix involves a scaling.

Definition at line 239 of file OgreMatrix3.h.

References _OgreExport, and Ogre::Math::RealEqual().

## Inverse() [1/2]

bool Ogre::Matrix3::Inverse | ( | Matrix3 & | rkInverse,
|  | Real | fTolerance = `1e-06`
| ) |  | const

## Inverse() [2/2]

Matrix3 Ogre::Matrix3::Inverse | ( | Real | fTolerance = `1e-06` | ) | const

## MaxCubicRoot()

static Real Ogre::Matrix3::MaxCubicRoot | ( | Real | afCoeff[3] | ) |

static protected

## operator!=()

bool Ogre::Matrix3::operator!= | ( | const Matrix3 & | rkMatrix | ) | const

Tests 2 matrices for inequality.

Definition at line 148 of file OgreMatrix3.h.

References _OgreExport, Ogre::operator*(), and Ogre::operator==().

## operator*() [1/3]

Matrix3 Ogre::Matrix3::operator* | ( | const Matrix3 & | rkMatrix | ) | const

Matrix concatenation using '*'.

## operator*() [2/3]

Vector3 Ogre::Matrix3::operator* | ( | const Vector3 & | rkVector | ) | const

Matrix * vector [3x3 * 3x1 = 3x1].

## operator*() [3/3]

Matrix3 Ogre::Matrix3::operator* | ( | Real | fScalar | ) | const

Matrix * scalar.

## operator+()

Matrix3 Ogre::Matrix3::operator+ | ( | const Matrix3 & | rkMatrix | ) | const

Matrix addition.

## operator-() [1/2]

Matrix3 Ogre::Matrix3::operator- | ( | const Matrix3 & | rkMatrix | ) | const

Matrix subtraction.

## operator-() [2/2]

Matrix3 Ogre::Matrix3::operator- | ( |  | ) | const

## operator=()

Matrix3& Ogre::Matrix3::operator= | ( | const Matrix3 & | rkMatrix | ) |

Assignment and comparison.

Definition at line 136 of file OgreMatrix3.h.

References m, and Ogre::operator==().

## operator==()

bool Ogre::Matrix3::operator== | ( | const Matrix3 & | rkMatrix | ) | const

Tests 2 matrices for equality.

## operator[]() [1/2]

const Real* Ogre::Matrix3::operator[] | ( | size_t | iRow | ) | const

Member access, allows use of construct mat[r][c].

Definition at line 115 of file OgreMatrix3.h.

## operator[]() [2/2]

Real* Ogre::Matrix3::operator[] | ( | size_t | iRow | ) |

Definition at line 120 of file OgreMatrix3.h.

## Orthonormalize()

void Ogre::Matrix3::Orthonormalize | ( |  | ) |

Gram-Schmidt orthonormalization (applied to columns of rotation matrix)

## QDUDecomposition()

void Ogre::Matrix3::QDUDecomposition | ( | Matrix3 & | rkQ,
|  | Vector3 & | rkD,
|  | Vector3 & | rkU
| ) |  | const

Orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12)

## QLAlgorithm()

bool Ogre::Matrix3::QLAlgorithm | ( | Real | afDiag[3],
|  | Real | afSubDiag[3]
| ) |  |

protected

## SetColumn()

void Ogre::Matrix3::SetColumn | ( | size_t | iCol,
|  | const Vector3 & | vec
| ) |  |

## SingularValueComposition()

void Ogre::Matrix3::SingularValueComposition | ( | const Matrix3 & | rkL,
|  | const Vector3 & | rkS,
|  | const Matrix3 & | rkR
| ) |  |

## SingularValueDecomposition()

void Ogre::Matrix3::SingularValueDecomposition | ( | Matrix3 & | rkL,
|  | Vector3 & | rkS,
|  | Matrix3 & | rkR
| ) |  | const

Singular value decomposition.

## SpectralNorm()

Real Ogre::Matrix3::SpectralNorm | ( |  | ) | const

## swap()

void Ogre::Matrix3::swap | ( | Matrix3 & | other | ) |

Exchange the contents of this matrix with another.

Definition at line 101 of file OgreMatrix3.h.

References m, and std::swap().

## TensorProduct()

static void Ogre::Matrix3::TensorProduct | ( | const Vector3 & | rkU,
|  | const Vector3 & | rkV,
|  | Matrix3 & | rkProduct
| ) |  |

static

## ToAngleAxis() [1/2]

void Ogre::Matrix3::ToAngleAxis | ( | Vector3 & | rkAxis,
|  | Radian & | rfAngle
| ) |  | const

Note: Matrix must be orthonormal.

## ToAngleAxis() [2/2]

void Ogre::Matrix3::ToAngleAxis | ( | Vector3 & | rkAxis,
|  | Degree & | rfAngle
| ) |  | const

Definition at line 203 of file OgreMatrix3.h.

## ToEulerAnglesXYZ()

bool Ogre::Matrix3::ToEulerAnglesXYZ | ( | Radian & | rfYAngle,
|  | Radian & | rfPAngle,
|  | Radian & | rfRAngle
| ) |  | const

The matrix must be orthonormal.

The decomposition is yaw*pitch*roll where yaw is rotation about the Up vector, pitch is rotation about the Right axis, and roll is rotation about the Direction axis.

## ToEulerAnglesXZY()

bool Ogre::Matrix3::ToEulerAnglesXZY | ( | Radian & | rfYAngle,
|  | Radian & | rfPAngle,
|  | Radian & | rfRAngle
| ) |  | const

## ToEulerAnglesYXZ()

bool Ogre::Matrix3::ToEulerAnglesYXZ | ( | Radian & | rfYAngle,
|  | Radian & | rfPAngle,
|  | Radian & | rfRAngle
| ) |  | const

## ToEulerAnglesYZX()

bool Ogre::Matrix3::ToEulerAnglesYZX | ( | Radian & | rfYAngle,
|  | Radian & | rfPAngle,
|  | Radian & | rfRAngle
| ) |  | const

## ToEulerAnglesZXY()

bool Ogre::Matrix3::ToEulerAnglesZXY | ( | Radian & | rfYAngle,
|  | Radian & | rfPAngle,
|  | Radian & | rfRAngle
| ) |  | const

## ToEulerAnglesZYX()

bool Ogre::Matrix3::ToEulerAnglesZYX | ( | Radian & | rfYAngle,
|  | Radian & | rfPAngle,
|  | Radian & | rfRAngle
| ) |  | const

## Transpose()

Matrix3 Ogre::Matrix3::Transpose | ( |  | ) | const

## Tridiagonal()

void Ogre::Matrix3::Tridiagonal | ( | Real | afDiag[3],
|  | Real | afSubDiag[3]
| ) |  |

protected

## Friends And Related Function Documentation

## Matrix4

friend class Matrix4

friend

Definition at line 289 of file OgreMatrix3.h.

## operator* [1/2]

_OgreExport friend Vector3 operator* | ( | const Vector3 & | rkVector,
|  | const Matrix3 & | rkMatrix
| ) |  |

friend

Vector * matrix [1x3 * 3x3 = 1x3].

## operator* [2/2]

_OgreExport friend Matrix3 operator* | ( | Real | fScalar,
|  | const Matrix3 & | rkMatrix
| ) |  |

friend

Scalar * matrix.

## operator<<

_OgreExport friend std::ostream& operator<< | ( | std::ostream & | o,
|  | const Matrix3 & | mat
| ) |  |

friend

Function for writing to a stream.

Definition at line 258 of file OgreMatrix3.h.

## Member Data Documentation

## EPSILON

const Real Ogre::Matrix3::EPSILON

static

Definition at line 266 of file OgreMatrix3.h.

## IDENTITY

const Matrix3 Ogre::Matrix3::IDENTITY

static

Definition at line 268 of file OgreMatrix3.h.

Referenced by Ogre::StringConverter::parseAngle().

## m

Real Ogre::Matrix3::m[3][3]

protected

Definition at line 286 of file OgreMatrix3.h.

Referenced by Ogre::Matrix4::extract3x3Matrix(), Matrix3(), operator=(), Ogre::Matrix4::operator=(), and swap().

## msSvdEpsilon

const Real Ogre::Matrix3::msSvdEpsilon

static protected

Definition at line 276 of file OgreMatrix3.h.

## msSvdMaxIterations

const unsigned int Ogre::Matrix3::msSvdMaxIterations

static protected

Definition at line 277 of file OgreMatrix3.h.

## ZERO

const Matrix3 Ogre::Matrix3::ZERO

static

Definition at line 267 of file OgreMatrix3.h.

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

- OgreMatrix3.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.