ML Reference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00004 00009 //---------------------------------------------------------------------------------- 00010 #ifndef __mlRotation_H 00011 #define __mlRotation_H 00012 00013 #include "mlLinearAlgebraSystem.h" 00014 #include "mlVector3.h" 00015 #include "mlMatrix4.h" 00016 00017 ML_LA_START_NAMESPACE 00018 00020 00034 class ML_LINEAR_ALGEBRA_EXPORT Rotation 00035 { 00036 public: 00038 Rotation (); 00039 00041 Rotation (const Vector3& axis, MLdouble angle); 00042 00044 Rotation (const Vector3& fromVec, const Vector3& toVec); 00045 00047 Rotation (const Matrix4& m); 00048 00050 Rotation (const Rotation&); 00051 00054 Rotation (MLdouble x, MLdouble y, MLdouble z, MLdouble w); 00055 00057 Matrix4 getMatrix () const; 00058 00060 void getRotation (Vector3& axis, MLdouble &angle) const; 00061 00063 void setRotation (const Vector3& axis, MLdouble angle); 00064 00066 Rotation multiply (const Rotation& rotation) const; 00067 00069 Vector3 rotate(const Vector3& vec) const; 00070 00072 Rotation& conjugate (); 00073 00075 Rotation& operator*=(const Rotation& rotation); 00076 00078 Rotation& operator= (const Rotation& rotation); 00079 00081 ML_LINEAR_ALGEBRA_EXPORT friend Rotation operator*(const Rotation& a,const Rotation& b); 00082 00085 static Matrix4 slerp(const Matrix4& m1, const Matrix4& m2, MLdouble t); 00086 00089 static Rotation slerp(const Rotation& rot1, const Rotation& rot2, MLdouble t); 00090 00091 protected: 00093 Vector3 _vector; 00094 00096 MLdouble _scalar; 00097 00098 private: 00100 void _normalize(); 00101 00103 static Matrix4 _outer (const Vector3& v); 00104 00106 static Matrix4 _generator (const Vector3& v); 00107 }; 00108 00109 ML_LA_END_NAMESPACE 00110 00111 00112 #endif // __mlRotation_H