C:/Users/Mike/Documents/Visual Studio Projects/GameEngine/include/Quaternion.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 Copyright (C) 2006 Michael Harnetty
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 -----------------------------------------------------------------------------
00019 */
00020 
00021 #ifndef QUATERNION_H
00022 #define QUATERNION_H
00023 
00024 #include "Vector3.h"
00025 
00026 #include "GameEnginePrerequisites.h"
00027 
00028 namespace GameEngine {
00029 
00032         class ENGINE_DECL Quaternion 
00033         {
00034         public:
00035                 Quaternion();
00036                 Quaternion(const Quaternion& q);
00037                 Quaternion(Real w, Real x, Real y, Real z);
00038 
00039                 ~Quaternion();
00040 
00041 
00042                 // Algebraic functions
00043                 Quaternion operator+ (const Quaternion& q) const;
00044                 Quaternion operator- (const Quaternion& q) const;
00045 
00046                 Vector3 operator* (const Vector3& v) const; // Rotate a vector by this quaternion
00047 
00048                 Quaternion& normalise();
00049 
00050 
00051                 // Mathematical functions
00052 
00053 
00054                 // Comparison functions
00055 
00056 
00057                 // Euler angles
00058                 Real getYawDeg() const;
00059                 Real getPitchDeg() const;
00060                 Real getRollDeg() const;
00061 
00062                 Real getYawRad() const;
00063                 Real getPitchRad() const;
00064                 Real getRollRad() const;
00065 
00066 
00067 
00068                 // Conversions to and from other libraries Quaternions
00069                 operator Ogre::Quaternion() { return Ogre::Quaternion(mW, mX, mY, mZ); }
00070                 operator opal::Quaternion() { return opal::Quaternion(mW, mX, mY, mZ); }
00071 
00072                 static Quaternion quatFromOgre(Ogre::Quaternion q) { return Quaternion(q.w, q.x, q.y, q.z); }
00073                 static Quaternion quatFromOpal(opal::Quaternion q) { return Quaternion(q.w, q.x, q.y, q.z); }
00074 
00075 
00076 
00077                 Real mW, mX, mY, mZ;
00078 
00079 
00080                 // Special Quaternions
00081                 static const Quaternion IDENTITY; // No rotation
00082         };
00083 
00084 }
00085 
00086 #endif

Generated on Thu Apr 19 09:47:02 2007 for GameEngine by  doxygen 1.5.2