Ogre矩阵Matrix3类和Matrix4类的成员方法
来源:互联网 发布:人民的名义 知乎 编辑:程序博客网 时间:2024/06/05 15:54
Matrix3类
3*3矩阵类。
常量
const Real Matrix3::EPSILON = 1e-06;
const Matrix3 Matrix3::ZERO(0,0,0,0,0,0,0,0,0);
const Matrix3 Matrix3::IDENTITY(1,0,0,0,1,0,0,0,1);
const Real Matrix3::ms_fSvdEpsilon = 1e-04;
const int Matrix3::ms_iSvdMaxIterations = 32;
构造函数
Matrix3 ();
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* operator[] (int iRow) const;
指针操作符
operator Real* ();
Matrix3& operator= (const Matrix3& rkMatrix);
bool operator== (const Matrix3& rkMatrix) const;
bool operator!= (const Matrix3& rkMatrix) const;
Matrix3 operator+ (const Matrix3& rkMatrix) const;
Matrix3 operator- (const Matrix3& rkMatrix) const;
Matrix3 operator* (const Matrix3& rkMatrix) const;
负号操作符
Matrix3 operator- () const;
Matrix3乘Vector3,结果是3*1的Vector3。
Vector3 operator* (const Vector3& rkVector) const;
以友员方式重载的乘号操作符,Vector3乘Matrix3,结果是1*3的Vector3。
friend Vector3 operator* (const Vector3& rkVector,const Matrix3& rkMatrix);
Matrix3乘以一个标量。
Matrix3 operator* (Real fScalar) const;
友员方式重载的标量乘Matrix3。
friend Matrix3 operator* (Real fScalar, const Matrix3& rkMatrix);
取得Matrix3中的指定列。
Vector3 GetColumn (int iCol) const;
设定Matrix3中的指定列。
void SetColumn(int iCol, const Vector3& vec);
指定三个轴向量,构成一个Matrix3,注意:每个轴在Matrix3表现为一列。
void Matrix3::FromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis)
求当前矩阵的转置
Matrix3 Transpose () const;
求当前矩阵的逆矩阵,注意返回值是bool型的,得到的结果矩阵在第一个参数里。
bool Matrix3::Inverse (Matrix3& rkInverse, Real fTolerance) const
求当前矩阵的逆矩阵,返回值是结果矩阵。
Matrix3 Matrix3::Inverse (Real fTolerance) const
求本矩阵代表行列式的值
Real Matrix3::Determinant () const
Matrix4类
4*4矩阵。
常量
Matrix4::ZERO 零矩阵
Matrix4::IDENTITY 单位矩阵
构造函数:
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 )
成员函数:
重载下标操作符
inline Real* operator [] ( unsigned iRow )
重载下标操作符
inline const Real *const operator [] ( unsigned iRow ) const
矩阵乘法
inline Matrix4 concatenate(const Matrix4 &m2)
矩阵乘法
inline Matrix4 operator * ( const Matrix4 &m2 )
用当前矩阵完成Vector3的变换,返回值是结果Vector3。
inline Vector3 operator * ( const Vector3 &v ) const
矩阵加法
inline Matrix4 operator + ( const Matrix4 &m2 ) const
矩阵减法
inline Matrix4 operator - ( const Matrix4 &m2 )
重载等号
inline bool operator == ( const Matrix4& m2 ) const
重载不等号
inline bool operator != ( Matrix4& m2 ) const
将Matrix3转换为Matrix4
inline void operator = ( const Matrix3& mat3 )
矩阵转置
inline Matrix4 transpose(void)
设置变换矩阵中的平移部分。
结果是:
原值
原值
原值
v.x
原值
原值
原值
v.y
原值
原值
原值
v.z
原值
原值
原值
原值
inline void setTrans( const Vector3& v )
构建平移变换矩阵
得到的结果是:
0
0
0
v.x
0
0
0
v.y
0
0
0
v.z
0
0
0
0
inline void makeTrans( const Vector3& v )
构建平移变换矩阵
结果是:
0
0
0
tx
0
0
0
ty
0
0
0
tz
0
0
0
0
inline void makeTrans( Real tx, Real ty, Real tz )
由Vector3获得一个平移变换矩阵。注意是静态成员函数。
结果是:
0
0
0
v.x
0
0
0
v.y
0
0
0
v.z
0
0
0
0
inline static Matrix4 getTrans( const Vector3& v )
由3个实数获得一个平移变换矩阵。注意是静态成员函数。
结果是:
0
0
0
t_x
0
0
0
t_y
0
0
0
t_z
0
0
0
0
inline static Matrix4 getTrans( Real t_x, Real t_y, Real t_z )
设置矩阵中的缩放部分
结果是:
v.x
原值
原值
原值
原值
v.y
原值
原值
原值
原值
v.z
原值
原值
原值
原值
原值
inline void setScale( const Vector3& v )
由Vector3获得缩放矩阵
结果是:
v.x
0
0
0
0
v.y
0
0
0
0
v.z
0
0
0
0
0
inline static Matrix4 getScale( const Vector3& v )
由三个实数值获得缩放矩阵
结果是:
s_x
0
0
0
0
s_y
0
0
0
0
s_z
0
0
0
0
0
inline static Matrix4 getScale( Real s_x, Real s_y, Real s_z )
从4*4矩阵中析出旋转和缩放矩阵,参数是引用方式传参,接收结果。
inline void extract3x3Matrix(Matrix3& m3x3)
重载输出流操作符
inline _OgreExport friend std::ostream& operator << ( std::ostream& o, const Matrix4& m )
- Ogre矩阵Matrix3类和Matrix4类的成员方法
- Ogre矩阵Matrix3类和Matrix4类的成员方法
- Ogre矩阵Matrix3类和Matrix4类的成员方法
- Ogre中的向量Vector3的成员方法
- Ogre中的向量Vector3的成员方法
- Ogre中的向量Vector3的成员方法
- Ogre中的向量Vector3的成员方法
- matrix4
- CWinAPP类的成员变量和成员方法
- matrix3
- js 类的成员变量和方法
- PHP 成员方法和类的调用
- 类中的成员属性和成员方法
- 类的成员之二:成员方法
- Python的静态方法和类成员方法
- Python的静态方法和类成员方法
- Python的静态方法和类成员方法
- Python的静态方法和类成员方法
- poj 2185 Milking Grid
- Activity生命周期(Activity Lifecycle)
- Paxos Made Simple [续][原文解释版][转载]
- (四)Activities and Tasks
- hibernate延迟加载详解
- Ogre矩阵Matrix3类和Matrix4类的成员方法
- PHP常用函数对象
- 借助 C++ 进行 Windows 开发 异步 WinHTTP
- 计算机字符集简史
- 人工智能 a b c 说谎问题
- GBK、GB2312与UTF编码
- Ogre中的四元数Quaternion类
- bullzip pdf打印机安装过程中发生“参数无效”
- 由苏州工行的BICE所想到的