00001 /*************************************************************************** 00002 glquaternion.h - description 00003 ------------------- 00004 begin : Fri May 16 2003 00005 copyright : (C) 2003 by Jacques Gasselin de Richebourg 00006 email : jacquesgasselin@hotmail.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU Lesser General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef GLQUATERNION_H 00019 #define GLQUATERNION_H 00020 00021 #include "glvector.h" 00022 00027 class GLQuaternion 00028 { 00029 GLVector v; 00030 GLfloat w; 00031 //w, x, y, z 00032 00033 public: 00034 GLQuaternion(); 00035 GLQuaternion(GLfloat f, GLVector gv); 00036 GLQuaternion(GLVector gv); 00037 GLQuaternion(const GLQuaternion& gq); 00038 GLQuaternion(GLVector gv, GLfloat dblangle); 00039 ~GLQuaternion(); 00040 00041 inline GLfloat getW() { return w; } 00042 inline GLVector getV() { return v; } 00043 inline void set(GLfloat, GLVector); 00044 inline void set(GLfloat, GLfloat, GLfloat, GLfloat); 00045 inline void set(const GLfloat* gq); 00046 inline void set(GLVector vec, GLfloat angle); 00047 00048 00049 GLQuaternion operator + (GLQuaternion gq); 00050 GLQuaternion operator - (GLQuaternion gq); 00051 GLQuaternion& operator += (GLQuaternion gq); 00052 GLQuaternion& operator -= (GLQuaternion gq); 00053 00054 GLQuaternion operator * (GLQuaternion gq); 00055 GLQuaternion operator / (GLfloat); 00056 GLQuaternion& operator *= (GLQuaternion gq); 00057 GLQuaternion& operator /= (GLfloat); 00058 00059 GLfloat dot(GLQuaternion); 00060 GLQuaternion getCross(GLQuaternion); 00061 00062 GLQuaternion getConjugate(); 00063 GLQuaternion& conjugate(); 00064 00065 GLQuaternion getInverse(); 00066 GLQuaternion& inverse(); 00067 00068 GLfloat selection(); 00069 GLfloat norm(); 00070 00071 GLVector rotateVector(GLVector); 00072 00073 }; 00074 00075 #endif