OGRE  13.6
Object-Oriented Graphics Rendering Engine
Ogre::TransformBase< rows, T > Class Template Reference

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

#include <OgreMatrix4.h>

Public Member Functions

 TransformBase ()
 Do NOT initialize for efficiency. More...
 
template<typename U >
 TransformBase (const TransformBase< rows, U > &o)
 
template<typename U >
 TransformBase (const U *ptr)
 
Vector< 3, T > getTrans () const
 Extracts the translation transformation part of the matrix. More...
 
T * operator[] (size_t iRow)
 
const T * operator[] (size_t iRow) const
 
void setScale (const Vector< 3, T > &v)
 Sets the scale part of the matrix. More...
 
void setTrans (const Vector< 3, T > &v)
 Sets the translation transformation part of the matrix. More...
 

Detailed Description

template<int rows, typename T>
class Ogre::TransformBase< rows, T >

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}
    

Constructor & Destructor Documentation

◆ TransformBase() [1/3]

template<int rows, typename T >
Ogre::TransformBase< rows, T >::TransformBase ( )
inline

Do NOT initialize for efficiency.

◆ TransformBase() [2/3]

template<int rows, typename T >
template<typename U >
Ogre::TransformBase< rows, T >::TransformBase ( const U *  ptr)
inlineexplicit

◆ TransformBase() [3/3]

template<int rows, typename T >
template<typename U >
Ogre::TransformBase< rows, T >::TransformBase ( const TransformBase< rows, U > &  o)
inlineexplicit

Member Function Documentation

◆ operator[]() [1/2]

template<int rows, typename T >
T* Ogre::TransformBase< rows, T >::operator[] ( size_t  iRow)
inline

◆ operator[]() [2/2]

template<int rows, typename T >
const T* Ogre::TransformBase< rows, T >::operator[] ( size_t  iRow) const
inline

◆ setTrans()

template<int rows, typename T >
void Ogre::TransformBase< rows, T >::setTrans ( const Vector< 3, T > &  v)
inline

Sets the translation transformation part of the matrix.

◆ getTrans()

template<int rows, typename T >
Vector<3, T> Ogre::TransformBase< rows, T >::getTrans ( ) const
inline

Extracts the translation transformation part of the matrix.

◆ setScale()

template<int rows, typename T >
void Ogre::TransformBase< rows, T >::setScale ( const Vector< 3, T > &  v)
inline

Sets the scale part of the matrix.


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