OgreMatrix4.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __Matrix4__
#define __Matrix4__
// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreVector3.h"
#include "OgreMatrix3.h"
#include "OgreVector4.h"
#include "OgrePlane.h"
namespace Ogre
{
class _OgreExport Matrix4
{
protected:
union {
Real m[4][4];
Real _m[16];
};
public:
inline Matrix4()
{
}
inline Matrix4(
Real m00, Real m01, Real m02, Real m03,
Real m10, Real m11, Real m12, Real m13,
Real m20, Real m21, Real m22, Real m23,
Real m30, Real m31, Real m32, Real m33 )
{
m[0][0] = m00;
m[0][1] = m01;
m[0][2] = m02;
m[0][3] = m03;
m[1][0] = m10;
m[1][1] = m11;
m[1][2] = m12;
m[1][3] = m13;
m[2][0] = m20;
m[2][1] = m21;
m[2][2] = m22;
m[2][3] = m23;
m[3][0] = m30;
m[3][1] = m31;
m[3][2] = m32;
m[3][3] = m33;
}
inline Matrix4(const Matrix3& m3x3)
{
operator=(IDENTITY);
operator=(m3x3);
}
inline Matrix4(const Quaternion& rot)
{
Matrix3 m3x3;
rot.ToRotationMatrix(m3x3);
operator=(IDENTITY);
operator=(m3x3);
}
inline void swap(Matrix4& other)
{
std::swap(m[0][0], other.m[0][0]);
std::swap(m[0][1], other.m[0][1]);
std::swap(m[0][2], other.m[0][2]);
std::swap(m[0][3], other.m[0][3]);
std::swap(m[1][0], other.m[1][0]);
std::swap(m[1][1], other.m[1][1]);
std::swap(m[1][2], other.m[1][2]);
std::swap(m[1][3], other.m[1][3]);
std::swap(m[2][0], other.m[2][0]);
std::swap(m[2][1], other.m[2][1]);
std::swap(m[2][2], other.m[2][2]);
std::swap(m[2][3], other.m[2][3]);
std::swap(m[3][0], other.m[3][0]);
std::swap(m[3][1], other.m[3][1]);
std::swap(m[3][2], other.m[3][2]);
std::swap(m[3][3], other.m[3][3]);
}
inline Real* operator [] ( size_t iRow )
{
assert( iRow < 4 );
return m[iRow];
}
inline const Real *operator [] ( size_t iRow ) const
{
assert( iRow < 4 );
return m[iRow];
}
inline Matrix4 concatenate(const Matrix4 &m2) const
{
Matrix4 r;
r.m[0][0] = m[0][0] * m2.m[0][0] + m[0][1] * m2.m[1][0] + m[0][2] * m2.m[2][0] + m[0][3] * m2.m[3][0];
r.m[0][1] = m[0][0] * m2.m[0][1] + m[0][1] * m2.m[1][1] + m[0][2] * m2.m[2][1] + m[0][3] * m2.m[3][1];
r.m[0][2] = m[0][0] * m2.m[0][2] + m[0][1] * m2.m[1][2] + m[0][2] * m2.m[2][2] + m[0][3] * m2.m[3][2];
r.m[0][3] = m[0][0] * m2.m[0][3] + m[0][1] * m2.m[1][3] + m[0][2] * m2.m[2][3] + m[0][3] * m2.m[3][3];
r.m[1][0] = m[1][0] * m2.m[0][0] + m[1][1] * m2.m[1][0] + m[1][2] * m2.m[2][0] + m[1][3] * m2.m[3][0];
r.m[1][1] = m[1][0] * m2.m[0][1] + m[1][1] * m2.m[1][1] + m[1][2] * m2.m[2][1] + m[1][3] * m2.m[3][1];
r.m[1][2] = m[1][0] * m2.m[0][2] + m[1][1] * m2.m[1][2] + m[1][2] * m2.m[2][2] + m[1][3] * m2.m[3][2];
r.m[1][3] = m[1][0] * m2.m[0][3] + m[1][1] * m2.m[1][3] + m[1][2] * m2.m[2][3] + m[1][3] * m2.m[3][3];
r.m[2][0] = m[2][0] * m2.m[0][0] + m[2][1] * m2.m[1][0] + m[2][2] * m2.m[2][0] + m[2][3] * m2.m[3][0];
r.m[2][1] = m[2][0] * m2.m[0][1] + m[2][1] * m2.m[1][1] + m[2][2] * m2.m[2][1] + m[2][3] * m2.m[3][1];
r.m[2][2] = m[2][0] * m2.m[0][2] + m[2][1] * m2.m[1][2] + m[2][2] * m2.m[2][2] + m[2][3] * m2.m[3][2];
r.m[2][3] = m[2][0] * m2.m[0][3] + m[2][1] * m2.m[1][3] + m[2][2] * m2.m[2][3] + m[2][3] * m2.m[3][3];
r.m[3][0] = m[3][0] * m2.m[0][0] + m[3][1] * m2.m[1][0] + m[3][2] * m2.m[2][0] + m[3][3] * m2.m[3][0];
r.m[3][1] = m[3][0] * m2.m[0][1] + m[3][1] * m2.m[1][1] + m[3][2] * m2.m[2][1] + m[3][3] * m2.m[3][1];
r.m[3][2] = m[3][0] * m2.m[0][2] + m[3][1] * m2.m[1][2] + m[3][2] * m2.m[2][2] + m[3][3] * m2.m[3][2];
r.m[3][3] = m[3][0] * m2.m[0][3] + m[3][1] * m2.m[1][3] + m[3][2] * m2.m[2][3] + m[3][3] * m2.m[3][3];
return r;
}
inline Matrix4 operator * ( const Matrix4 &m2 ) const
{
return concatenate( m2 );
}
inline Vector3 operator * ( const Vector3 &v ) const
{
Vector3 r;
Real fInvW = 1.0f / ( m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] );
r.x = ( m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] ) * fInvW;
r.y = ( m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] ) * fInvW;
r.z = ( m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] ) * fInvW;
return r;
}
inline Vector4 operator * (const Vector4& v) const
{
return Vector4(
m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w,
m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w,
m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w,
m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] * v.w
);
}
inline Plane operator * (const Plane& p) const
{
Plane ret;
Matrix4 invTrans = inverse().transpose();
Vector4 v4( p.normal.x, p.normal.y, p.normal.z, p.d );
v4 = invTrans * v4;
ret.normal.x = v4.x;
ret.normal.y = v4.y;
ret.normal.z = v4.z;
ret.d = v4.w / ret.normal.normalise();
return ret;
}
inline Matrix4 operator + ( const Matrix4 &m2 ) const
{
Matrix4 r;
r.m[0][0] = m[0][0] + m2.m[0][0];
r.m[0][1] = m[0][1] + m2.m[0][1];
r.m[0][2] = m[0][2] + m2.m[0][2];
r.m[0][3] = m[0][3] + m2.m[0][3];
r.m[1][0] = m[1][0] + m2.m[1][0];
r.m[1][1] = m[1][1] + m2.m[1][1];
r.m[1][2] = m[1][2] + m2.m[1][2];
r.m[1][3] = m[1][3] + m2.m[1][3];
r.m[2][0] = m[2][0] + m2.m[2][0];
r.m[2][1] = m[2][1] + m2.m[2][1];
r.m[2][2] = m[2][2] + m2.m[2][2];
r.m[2][3] = m[2][3] + m2.m[2][3];
r.m[3][0] = m[3][0] + m2.m[3][0];
r.m[3][1] = m[3][1] + m2.m[3][1];
r.m[3][2] = m[3][2] + m2.m[3][2];
r.m[3][3] = m[3][3] + m2.m[3][3];
return r;
}
inline Matrix4 operator - ( const Matrix4 &m2 ) const
{
Matrix4 r;
r.m[0][0] = m[0][0] - m2.m[0][0];
r.m[0][1] = m[0][1] - m2.m[0][1];
r.m[0][2] = m[0][2] - m2.m[0][2];
r.m[0][3] = m[0][3] - m2.m[0][3];
r.m[1][0] = m[1][0] - m2.m[1][0];
r.m[1][1] = m[1][1] - m2.m[1][1];
r.m[1][2] = m[1][2] - m2.m[1][2];
r.m[1][3] = m[1][3] - m2.m[1][3];
r.m[2][0] = m[2][0] - m2.m[2][0];
r.m[2][1] = m[2][1] - m2.m[2][1];
r.m[2][2] = m[2][2] - m2.m[2][2];
r.m[2][3] = m[2][3] - m2.m[2][3];
r.m[3][0] = m[3][0] - m2.m[3][0];
r.m[3][1] = m[3][1] - m2.m[3][1];
r.m[3][2] = m[3][2] - m2.m[3][2];
r.m[3][3] = m[3][3] - m2.m[3][3];
return r;
}
inline bool operator == ( const Matrix4& m2 ) const
{
if(
m[0][0] != m2.m[0][0] || m[0][1] != m2.m[0][1] || m[0][2] != m2.m[0][2] || m[0][3] != m2.m[0][3] ||
m[1][0] != m2.m[1][0] || m[1][1] != m2.m[1][1] || m[1][2] != m2.m[1][2] || m[1][3] != m2.m[1][3] ||
m[2][0] != m2.m[2][0] || m[2][1] != m2.m[2][1] || m[2][2] != m2.m[2][2] || m[2][3] != m2.m[2][3] ||
m[3][0] != m2.m[3][0] || m[3][1] != m2.m[3][1] || m[3][2] != m2.m[3][2] || m[3][3] != m2.m[3][3] )
return false;
return true;
}
inline bool operator != ( const Matrix4& m2 ) const
{
if(
m[0][0] != m2.m[0][0] || m[0][1] != m2.m[0][1] || m[0][2] != m2.m[0][2] || m[0][3] != m2.m[0][3] ||
m[1][0] != m2.m[1][0] || m[1][1] != m2.m[1][1] || m[1][2] != m2.m[1][2] || m[1][3] != m2.m[1][3] ||
m[2][0] != m2.m[2][0] || m[2][1] != m2.m[2][1] || m[2][2] != m2.m[2][2] || m[2][3] != m2.m[2][3] ||
m[3][0] != m2.m[3][0] || m[3][1] != m2.m[3][1] || m[3][2] != m2.m[3][2] || m[3][3] != m2.m[3][3] )
return true;
return false;
}
inline void operator = ( const Matrix3& mat3 )
{
m[0][0] = mat3.m[0][0]; m[0][1] = mat3.m[0][1]; m[0][2] = mat3.m[0][2];
m[1][0] = mat3.m[1][0]; m[1][1] = mat3.m[1][1]; m[1][2] = mat3.m[1][2];
m[2][0] = mat3.m[2][0]; m[2][1] = mat3.m[2][1]; m[2][2] = mat3.m[2][2];
}
inline Matrix4 transpose(void) const
{
return Matrix4(m[0][0], m[1][0], m[2][0], m[3][0],
m[0][1], m[1][1], m[2][1], m[3][1],
m[0][2], m[1][2], m[2][2], m[3][2],
m[0][3], m[1][3], m[2][3], m[3][3]);
}
/*
-----------------------------------------------------------------------
Translation Transformation
-----------------------------------------------------------------------
*/
inline void setTrans( const Vector3& v )
{
m[0][3] = v.x;
m[1][3] = v.y;
m[2][3] = v.z;
}
inline Vector3 getTrans() const
{
return Vector3(m[0][3], m[1][3], m[2][3]);
}
inline void makeTrans( const Vector3& v )
{
m[0][0] = 1.0; m[0][1] = 0.0; m[0][2] = 0.0; m[0][3] = v.x;
m[1][0] = 0.0; m[1][1] = 1.0; m[1][2] = 0.0; m[1][3] = v.y;
m[2][0] = 0.0; m[2][1] = 0.0; m[2][2] = 1.0; m[2][3] = v.z;
m[3][0] = 0.0; m[3][1] = 0.0; m[3][2] = 0.0; m[3][3] = 1.0;
}
inline void makeTrans( Real tx, Real ty, Real tz )
{
m[0][0] = 1.0; m[0][1] = 0.0; m[0][2] = 0.0; m[0][3] = tx;
m[1][0] = 0.0; m[1][1] = 1.0; m[1][2] = 0.0; m[1][3] = ty;
m[2][0] = 0.0; m[2][1] = 0.0; m[2][2] = 1.0; m[2][3] = tz;
m[3][0] = 0.0; m[3][1] = 0.0; m[3][2] = 0.0; m[3][3] = 1.0;
}
inline static Matrix4 getTrans( const Vector3& v )
{
Matrix4 r;
r.m[0][0] = 1.0; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = v.x;
r.m[1][0] = 0.0; r.m[1][1] = 1.0; r.m[1][2] = 0.0; r.m[1][3] = v.y;
r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = 1.0; r.m[2][3] = v.z;
r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
return r;
}
inline static Matrix4 getTrans( Real t_x, Real t_y, Real t_z )
{
Matrix4 r;
r.m[0][0] = 1.0; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = t_x;
r.m[1][0] = 0.0; r.m[1][1] = 1.0; r.m[1][2] = 0.0; r.m[1][3] = t_y;
r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = 1.0; r.m[2][3] = t_z;
r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
return r;
}
/*
-----------------------------------------------------------------------
Scale Transformation
-----------------------------------------------------------------------
*/
inline void setScale( const Vector3& v )
{
m[0][0] = v.x;
m[1][1] = v.y;
m[2][2] = v.z;
}
inline static Matrix4 getScale( const Vector3& v )
{
Matrix4 r;
r.m[0][0] = v.x; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = 0.0;
r.m[1][0] = 0.0; r.m[1][1] = v.y; r.m[1][2] = 0.0; r.m[1][3] = 0.0;
r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = v.z; r.m[2][3] = 0.0;
r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
return r;
}
inline static Matrix4 getScale( Real s_x, Real s_y, Real s_z )
{
Matrix4 r;
r.m[0][0] = s_x; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = 0.0;
r.m[1][0] = 0.0; r.m[1][1] = s_y; r.m[1][2] = 0.0; r.m[1][3] = 0.0;
r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = s_z; r.m[2][3] = 0.0;
r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
return r;
}
inline void extract3x3Matrix(Matrix3& m3x3) const
{
m3x3.m[0][0] = m[0][0];
m3x3.m[0][1] = m[0][1];
m3x3.m[0][2] = m[0][2];
m3x3.m[1][0] = m[1][0];
m3x3.m[1][1] = m[1][1];
m3x3.m[1][2] = m[1][2];
m3x3.m[2][0] = m[2][0];
m3x3.m[2][1] = m[2][1];
m3x3.m[2][2] = m[2][2];
}
inline bool hasScale() const
{
// check magnitude of column vectors (==local axes)
Real t = m[0][0] * m[0][0] + m[1][0] * m[1][0] + m[2][0] * m[2][0];
if (!Math::RealEqual(t, 1.0, (Real)1e-04))
return true;
t = m[0][1] * m[0][1] + m[1][1] * m[1][1] + m[2][1] * m[2][1];
if (!Math::RealEqual(t, 1.0, (Real)1e-04))
return true;
t = m[0][2] * m[0][2] + m[1][2] * m[1][2] + m[2][2] * m[2][2];
if (!Math::RealEqual(t, 1.0, (Real)1e-04))
return true;
return false;
}
inline bool hasNegativeScale() const
{
return determinant() < 0;
}
inline Quaternion extractQuaternion() const
{
Matrix3 m3x3;
extract3x3Matrix(m3x3);
return Quaternion(m3x3);
}
static const Matrix4 ZERO;
static const Matrix4 ZEROAFFINE;
static const Matrix4 IDENTITY;
static const Matrix4 CLIPSPACE2DTOIMAGESPACE;
inline Matrix4 operator*(Real scalar) const
{
return Matrix4(
scalar*m[0][0], scalar*m[0][1], scalar*m[0][2], scalar*m[0][3],
scalar*m[1][0], scalar*m[1][1], scalar*m[1][2], scalar*m[1][3],
scalar*m[2][0], scalar*m[2][1], scalar*m[2][2], scalar*m[2][3],
scalar*m[3][0], scalar*m[3][1], scalar*m[3][2], scalar*m[3][3]);
}
inline _OgreExport friend std::ostream& operator <<
( std::ostream& o, const Matrix4& mat )
{
o << "Matrix4(";
for (size_t i = 0; i < 4; ++i)
{
o << " row" << (unsigned)i << "{";
for(size_t j = 0; j < 4; ++j)
{
o << mat[i][j] << " ";
}
o << "}";
}
o << ")";
return o;
}
Matrix4 adjoint() const;
Real determinant() const;
Matrix4 inverse() const;
void makeTransform(const Vector3& position, const Vector3& scale, const Quaternion& orientation);
void makeInverseTransform(const Vector3& position, const Vector3& scale, const Quaternion& orientation);
void decomposition(Vector3& position, Vector3& scale, Quaternion& orientation) const;
inline bool isAffine(void) const
{
return m[3][0] == 0 && m[3][1] == 0 && m[3][2] == 0 && m[3][3] == 1;
}
Matrix4 inverseAffine(void) const;
inline Matrix4 concatenateAffine(const Matrix4 &m2) const
{
assert(isAffine() && m2.isAffine());
return Matrix4(
m[0][0] * m2.m[0][0] + m[0][1] * m2.m[1][0] + m[0][2] * m2.m[2][0],
m[0][0] * m2.m[0][1] + m[0][1] * m2.m[1][1] + m[0][2] * m2.m[2][1],
m[0][0] * m2.m[0][2] + m[0][1] * m2.m[1][2] + m[0][2] * m2.m[2][2],
m[0][0] * m2.m[0][3] + m[0][1] * m2.m[1][3] + m[0][2] * m2.m[2][3] + m[0][3],
m[1][0] * m2.m[0][0] + m[1][1] * m2.m[1][0] + m[1][2] * m2.m[2][0],
m[1][0] * m2.m[0][1] + m[1][1] * m2.m[1][1] + m[1][2] * m2.m[2][1],
m[1][0] * m2.m[0][2] + m[1][1] * m2.m[1][2] + m[1][2] * m2.m[2][2],
m[1][0] * m2.m[0][3] + m[1][1] * m2.m[1][3] + m[1][2] * m2.m[2][3] + m[1][3],
m[2][0] * m2.m[0][0] + m[2][1] * m2.m[1][0] + m[2][2] * m2.m[2][0],
m[2][0] * m2.m[0][1] + m[2][1] * m2.m[1][1] + m[2][2] * m2.m[2][1],
m[2][0] * m2.m[0][2] + m[2][1] * m2.m[1][2] + m[2][2] * m2.m[2][2],
m[2][0] * m2.m[0][3] + m[2][1] * m2.m[1][3] + m[2][2] * m2.m[2][3] + m[2][3],
0, 0, 0, 1);
}
inline Vector3 transformAffine(const Vector3& v) const
{
assert(isAffine());
return Vector3(
m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3],
m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3],
m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3]);
}
inline Vector4 transformAffine(const Vector4& v) const
{
assert(isAffine());
return Vector4(
m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w,
m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w,
m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w,
v.w);
}
};
/* Removed from Vector4 and made a non-member here because otherwise
OgreMatrix4.h and OgreVector4.h have to try to include and inline each
other, which frankly doesn't work ;)
*/
inline Vector4 operator * (const Vector4& v, const Matrix4& mat)
{
return Vector4(
v.x*mat[0][0] + v.y*mat[1][0] + v.z*mat[2][0] + v.w*mat[3][0],
v.x*mat[0][1] + v.y*mat[1][1] + v.z*mat[2][1] + v.w*mat[3][1],
v.x*mat[0][2] + v.y*mat[1][2] + v.z*mat[2][2] + v.w*mat[3][2],
v.x*mat[0][3] + v.y*mat[1][3] + v.z*mat[2][3] + v.w*mat[3][3]
);
}
}
#endif
OgreVector4.h
Ogre::Vector3::z
Real z
Definition: OgreVector3.h:54
OgreVector3.h
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::Vector4::w
Real w
Definition: OgreVector4.h:48
Ogre::Matrix4::transformAffine
Vector4 transformAffine(const Vector4 &v) const
4-D Vector transformation specially for an affine matrix.
Definition: OgreMatrix4.h:631
Ogre::Matrix4::extractQuaternion
Quaternion extractQuaternion() const
Extracts the rotation / scaling part as a quaternion from the Matrix.
Definition: OgreMatrix4.h:502
Ogre::Quaternion
Implementation of a Quaternion, i.e.
Definition: OgreQuaternion.h:57
Ogre::Vector4::z
Real z
Definition: OgreVector4.h:48
OgrePlane.h
Ogre::Matrix4::IDENTITY
static const Matrix4 IDENTITY
Definition: OgreMatrix4.h:511
Ogre::Matrix3
A 3x3 matrix which can represent rotations around axes.
Definition: OgreMatrix3.h:68
Ogre::Vector4
4-dimensional homogeneous vector.
Definition: OgreVector4.h:45
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::Matrix4::setScale
void setScale(const Vector3 &v)
Sets the scale part of the matrix.
Definition: OgreMatrix4.h:427
Ogre::Plane::normal
Vector3 normal
Definition: OgrePlane.h:144
Ogre::Matrix4::getScale
static Matrix4 getScale(const Vector3 &v)
Gets a scale matrix.
Definition: OgreMatrix4.h:436
Ogre::Matrix4::ZERO
static const Matrix4 ZERO
Definition: OgreMatrix4.h:509
Ogre::Matrix4::makeTrans
void makeTrans(const Vector3 &v)
Builds a translation matrix.
Definition: OgreMatrix4.h:376
Ogre::Matrix4::getScale
static Matrix4 getScale(Real s_x, Real s_y, Real s_z)
Gets a scale matrix - variation for not using a vector.
Definition: OgreMatrix4.h:449
Ogre::Matrix3::m
Real m[3][3]
Definition: OgreMatrix3.h:286
Ogre::Plane
Defines a plane in 3D space.
Definition: OgrePlane.h:61
Ogre::Matrix4::CLIPSPACE2DTOIMAGESPACE
static const Matrix4 CLIPSPACE2DTOIMAGESPACE
Useful little matrix which takes 2D clipspace {-1, 1} to {0,1} and inverts the Y. ...
Definition: OgreMatrix4.h:514
Ogre::Matrix4::transformAffine
Vector3 transformAffine(const Vector3 &v) const
3-D Vector transformation specially for an affine matrix.
Definition: OgreMatrix4.h:617
Ogre::Matrix4::getTrans
static Matrix4 getTrans(Real t_x, Real t_y, Real t_z)
Gets a translation matrix - variation for not using a vector.
Definition: OgreMatrix4.h:408
Ogre::Matrix4::hasNegativeScale
bool hasNegativeScale() const
Determines if this matrix involves a negative scaling.
Definition: OgreMatrix4.h:495
Ogre::Plane::d
Real d
Definition: OgrePlane.h:145
Ogre::Matrix4
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
Ogre::Vector3
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Ogre::Quaternion::ToRotationMatrix
void ToRotationMatrix(Matrix3 &kRot) const
Ogre::Matrix4::getTrans
Vector3 getTrans() const
Extracts the translation transformation part of the matrix.
Definition: OgreMatrix4.h:368
OgrePrerequisites.h
Ogre::Matrix4::concatenate
Matrix4 concatenate(const Matrix4 &m2) const
Definition: OgreMatrix4.h:174
Ogre::Matrix4::swap
void swap(Matrix4 &other)
Exchange the contents of this matrix with another.
Definition: OgreMatrix4.h:142
Ogre::Matrix4::hasScale
bool hasScale() const
Determines if this matrix involves a scaling.
Definition: OgreMatrix4.h:478
Ogre::Vector3::y
Real y
Definition: OgreVector3.h:54
Ogre::operator!=
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
Definition: OgreMemorySTLAllocator.h:202
Ogre::Matrix4::Matrix4
Matrix4(Real m00, Real m01, Real m02, Real m03, Real m10, Real m11, Real m12, Real m13, Real m20, Real m21, Real m22, Real m23, Real m30, Real m31, Real m32, Real m33)
Definition: OgreMatrix4.h:95
Ogre::Matrix4::makeTrans
void makeTrans(Real tx, Real ty, Real tz)
Definition: OgreMatrix4.h:384
Ogre::Matrix4::operator*
Matrix4 operator*(Real scalar) const
Definition: OgreMatrix4.h:516
Ogre::Matrix4::setTrans
void setTrans(const Vector3 &v)
Sets the translation transformation part of the matrix.
Definition: OgreMatrix4.h:359
std::swap
void swap(Ogre::SmallVectorImpl< T > &LHS, Ogre::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
Definition: OgreSmallVector.h:802
Ogre::Matrix4::getTrans
static Matrix4 getTrans(const Vector3 &v)
Gets a translation matrix.
Definition: OgreMatrix4.h:394
OgreMatrix3.h
Ogre::Matrix4::extract3x3Matrix
void extract3x3Matrix(Matrix3 &m3x3) const
Extracts the rotation / scaling part of the Matrix as a 3x3 matrix.
Definition: OgreMatrix4.h:463
Ogre::Matrix4::ZEROAFFINE
static const Matrix4 ZEROAFFINE
Definition: OgreMatrix4.h:510
Ogre::Matrix4::m
Real m[4][4]
Definition: OgreMatrix4.h:83
Ogre::Vector3::x
Real x
Definition: OgreVector3.h:54
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::Vector3::normalise
Real normalise()
Normalises the vector.
Definition: OgreVector3.h:446
Ogre::Vector4::x
Real x
Definition: OgreVector4.h:48
Ogre::Vector4::y
Real y
Definition: OgreVector4.h:48
Ogre::operator==
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
Definition: OgreMemorySTLAllocator.h:184
Ogre::Matrix4::transpose
Matrix4 transpose(void) const
Definition: OgreMatrix4.h:344
Ogre::Matrix4::Matrix4
Matrix4(const Quaternion &rot)
Creates a standard 4x4 transformation matrix with a zero translation part from a rotation/scaling Qua...
Definition: OgreMatrix4.h:131
Ogre::Matrix4::Matrix4
Matrix4(const Matrix3 &m3x3)
Creates a standard 4x4 transformation matrix with a zero translation part from a rotation/scaling 3x3...
Definition: OgreMatrix4.h:122
Ogre::Matrix4::isAffine
bool isAffine(void) const
Check whether or not the matrix is affine matrix.
Definition: OgreMatrix4.h:572
Ogre::operator*
Radian operator*(Real a, const Radian &b)
Definition: OgreMath.h:747
Ogre::Matrix4::Matrix4
Matrix4()
Default constructor.
Definition: OgreMatrix4.h:91
Ogre::Math::RealEqual
static bool RealEqual(Real a, Real b, Real tolerance=std::numeric_limits< Real >::epsilon())
Compare 2 reals, using tolerance for inaccuracies.
Ogre::Matrix4::concatenateAffine
Matrix4 concatenateAffine(const Matrix4 &m2) const
Concatenate two affine matrices.
Definition: OgreMatrix4.h:587

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