OGRE  1.11.6
Object-Oriented Graphics Rendering Engine
Ogre::TransformBase Class Reference

Class encapsulating a standard 4x4 homogeneous matrix. More...

#include <OgreMatrix4.h>

+ Inheritance diagram for Ogre::TransformBase:

Public Member Functions

Real determinant () const
 
void extract3x3Matrix (Matrix3 &m3x3) const
 
Quaternion extractQuaternion () const
 
Vector3 getTrans () const
 Extracts the translation transformation part of the matrix. More...
 
Matrix3 linear () const
 Extracts the rotation / scaling part of the Matrix as a 3x3 matrix. More...
 
void makeInverseTransform (const Vector3 &position, const Vector3 &scale, const Quaternion &orientation)
 Building an inverse Affine3 from orientation / scale / position. More...
 
void makeTrans (const Vector3 &v)
 Builds a translation matrix. More...
 
void makeTrans (Real tx, Real ty, Real tz)
 
void makeTransform (const Vector3 &position, const Vector3 &scale, const Quaternion &orientation)
 Building a Affine3 from orientation / scale / position. More...
 
Realoperator[] (size_t iRow)
 
const Realoperator[] (size_t iRow) const
 
void set3x3Matrix (const Matrix3 &mat3)
 Assignment from 3x3 matrix. More...
 
void setScale (const Vector3 &v)
 Sets the scale part of the matrix. More...
 
void setTrans (const Vector3 &v)
 Sets the translation transformation part of the matrix. More...
 
Matrix4 transpose () const
 

Friends

std::ostream & operator<< (std::ostream &o, const TransformBase &mat)
 Function for writing to a stream. More...
 

Detailed Description

Class encapsulating a standard 4x4 homogeneous matrix.

Remarks
OGRE uses column vectors when applying matrix multiplications, This means a vector is represented as a single column, 4-row matrix. This has the effect that the transformations implemented by the matrices happens right-to-left e.g. if vector V is to be transformed by M1 then M2 then M3, the calculation would be M3 * M2 * M1 * V. The order that matrices are concatenated is vital since matrix multiplication is not commutative, i.e. you can get a different result if you concatenate in the wrong order.
The use of column vectors and right-to-left ordering is the standard in most mathematical texts, and is the same as used in OpenGL. It is, however, the opposite of Direct3D, which has inexplicably chosen to differ from the accepted standard and uses row vectors and left-to-right matrix multiplication.
OGRE deals with the differences between D3D and OpenGL etc. internally when operating through different render systems. OGRE users only need to conform to standard maths conventions, i.e. right-to-left matrix multiplication, (OGRE transposes matrices it passes to D3D to compensate).
The generic form M * V which shows the layout of the matrix entries is shown below:
        [ m[0][0]  m[0][1]  m[0][2]  m[0][3] ]   {x}
        | m[1][0]  m[1][1]  m[1][2]  m[1][3] | * {y}
        | m[2][0]  m[2][1]  m[2][2]  m[2][3] |   {z}
        [ m[3][0]  m[3][1]  m[3][2]  m[3][3] ]   {1}
    

Member Function Documentation

◆ operator[]() [1/2]

Real* Ogre::TransformBase::operator[] ( size_t  iRow)
inline

◆ operator[]() [2/2]

const Real* Ogre::TransformBase::operator[] ( size_t  iRow) const
inline

◆ set3x3Matrix()

void Ogre::TransformBase::set3x3Matrix ( const Matrix3 mat3)
inline

Assignment from 3x3 matrix.

◆ linear()

Matrix3 Ogre::TransformBase::linear ( ) const
inline

Extracts the rotation / scaling part of the Matrix as a 3x3 matrix.

◆ extract3x3Matrix()

void Ogre::TransformBase::extract3x3Matrix ( Matrix3 m3x3) const
inline

◆ extractQuaternion()

Quaternion Ogre::TransformBase::extractQuaternion ( ) const
inline

◆ setTrans()

void Ogre::TransformBase::setTrans ( const Vector3 v)
inline

Sets the translation transformation part of the matrix.

◆ getTrans()

Vector3 Ogre::TransformBase::getTrans ( ) const
inline

Extracts the translation transformation part of the matrix.

Referenced by Ogre::Affine3::operator const Matrix4 &().

◆ setScale()

void Ogre::TransformBase::setScale ( const Vector3 v)
inline

Sets the scale part of the matrix.

◆ makeTrans() [1/2]

void Ogre::TransformBase::makeTrans ( const Vector3 v)
inline

Builds a translation matrix.

◆ makeTrans() [2/2]

void Ogre::TransformBase::makeTrans ( Real  tx,
Real  ty,
Real  tz 
)
inline

◆ determinant()

Real Ogre::TransformBase::determinant ( ) const

◆ makeTransform()

void Ogre::TransformBase::makeTransform ( const Vector3 position,
const Vector3 scale,
const Quaternion orientation 
)

Building a Affine3 from orientation / scale / position.

Remarks
Transform is performed in the order scale, rotate, translation, i.e. translation is independent of orientation axes, scale does not affect size of translation, rotation and scaling are always centered on the origin.

◆ makeInverseTransform()

void Ogre::TransformBase::makeInverseTransform ( const Vector3 position,
const Vector3 scale,
const Quaternion orientation 
)

Building an inverse Affine3 from orientation / scale / position.

Remarks
As makeTransform except it build the inverse given the same data as makeTransform, so performing -translation, -rotate, 1/scale in that order.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  o,
const TransformBase mat 
)
friend

Function for writing to a stream.


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