- Cal3D 0.9 API Reference - |
00001 //****************************************************************************// 00002 // quaternion.h // 00003 // Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger // 00004 //****************************************************************************// 00005 // This library is free software; you can redistribute it and/or modify it // 00006 // under the terms of the GNU Lesser General Public License as published by // 00007 // the Free Software Foundation; either version 2.1 of the License, or (at // 00008 // your option) any later version. // 00009 //****************************************************************************// 00010 00011 #ifndef CAL_QUATERNION_H 00012 #define CAL_QUATERNION_H 00013 00014 //****************************************************************************// 00015 // Includes // 00016 //****************************************************************************// 00017 00018 #include "cal3d/global.h" 00019 00020 //****************************************************************************// 00021 // Forward declarations // 00022 //****************************************************************************// 00023 00024 class CalVector; 00025 00026 //****************************************************************************// 00027 // Class declaration // 00028 //****************************************************************************// 00029 00030 /*****************************************************************************/ 00034 class CAL3D_API CalQuaternion 00035 { 00036 // member variables 00037 public: 00038 float x; 00039 float y; 00040 float z; 00041 float w; 00042 00043 // constructors/destructor 00044 public: 00045 CalQuaternion(); 00046 CalQuaternion(const CalQuaternion& q); 00047 CalQuaternion(float qx, float qy, float qz, float qw); 00048 ~CalQuaternion(); 00049 00050 // member functions 00051 public: 00052 float& operator[](unsigned int index); 00053 const float& operator[](unsigned int index) const; 00054 void operator=(const CalQuaternion& q); 00055 void operator*=(const CalQuaternion& q); 00056 void operator*=(const CalVector& v); 00057 friend CAL3D_API CalQuaternion operator*(const CalQuaternion& q, const CalQuaternion& r); 00058 void blend(float d, const CalQuaternion& q); 00059 void clear(); 00060 void conjugate(); 00061 void invert(); 00062 void set(float qx, float qy, float qz, float qw); 00063 friend CAL3D_API CalQuaternion shortestArc( const CalVector& from, const CalVector& to ); 00064 }; 00065 00066 #endif 00067 00068 //****************************************************************************//