Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
E:/Programming/MyProject/K_Game_hg/GameEngine/include/core/Quaternion.h
Go to the documentation of this file.
00001 // Copyright 2006-2011 by Kat'Oun
00002 
00003 #ifndef _QUATERNION_H_
00004 #define _QUATERNION_H_
00005 
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 
00009 namespace core
00010 {
00011 
00012 class matrix4;
00013 class vector3d;
00014 
00016 class ENGINE_PUBLIC_EXPORT quaternion
00017 {
00018 
00019 public:
00020 
00021         quaternion();
00022         quaternion(const matrix4& mat);
00023         quaternion(f32 x, f32 y, f32 z);
00024         quaternion(f32 X, f32 Y, f32 Z, f32 W);
00025         quaternion(const quaternion& other);
00026         quaternion(const vector3d& axis, const f32& angle);
00027         
00028         quaternion operator- () const;
00029 
00031         quaternion& operator=(const quaternion& other);
00032 
00034         quaternion& operator=(const matrix4& other);
00035 
00037         quaternion operator+(const quaternion& other) const;
00038 
00040         quaternion operator-(const quaternion& other) const;
00041 
00043         quaternion operator*(const quaternion& other) const;
00044 
00046         quaternion operator*(f32 s) const;
00047 
00049         quaternion& operator*=(f32 s);
00050 
00052         vector3d operator*(const vector3d& v) const;
00053 
00055         quaternion& operator*=(const quaternion& other);
00056 
00058         bool operator==(const quaternion& other) const;
00059 
00060         bool operator!=(const quaternion& other) const;
00061 
00063         void set(f32 x, f32 y, f32 z, f32 w);
00064 
00066         void set(f32 x, f32 y, f32 z);
00067 
00069         void set(vector3d rot);
00070 
00072         void setDegrees(f32 x, f32 y, f32 z);
00073 
00075         void setDegrees(vector3d rot);
00076 
00078         void setDegrees(const vector3d& axis, const f32& angle);
00079 
00081         void invert();//non-zero quaternion
00082         void unitInvert();//unit-length quaternion
00083 
00085         quaternion getInverse() const;//non-zero quaternion
00086         quaternion getUnitInverse() const;//unit-length quaternion
00087 
00089         quaternion& normalize();
00090 
00092         f32 dotProduct(const quaternion& other) const;
00093 
00094         //from angle in radians and axis
00095         void fromAngleAxis(const f32& angle, const vector3d& axis);
00096 
00097         //from degrees and axis
00098         void fromDegreeAxis(const f32& degree, const vector3d& axis);
00099 
00100         void fromRotationMatrix(const matrix4& m);
00101 
00102         matrix4 toRotationMatrix() const;
00103 
00105         vector3d toEulerAngles() const;
00106 
00108         vector3d toEulerDegrees() const;
00109 
00111         f32 getXDegrees() const;
00112 
00114         f32 getYDegrees() const;
00115 
00117         f32 getZDegrees() const;
00118 
00119         static const quaternion ZERO;
00120         static const quaternion IDENTITY;
00121 
00122         f32 X, Y, Z, W;
00123 };
00124 
00125 } // end namespace core
00126 
00127 #endif

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:04 by Doxygen (1.7.4)