deQuaternion.h

Go to the documentation of this file.
00001 /* Copyright (c) 2005 Arachi, Inc. and Stanford University.
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining
00004  * a copy of this software and associated documentation files (the
00005  * "Software"), to deal in the Software without restriction, including
00006  * without limitation the rights to use, copy, modify, merge, publish,
00007  * distribute, sublicense, and/or sell copies of the Software, and to
00008  * permit persons to whom the Software is furnished to do so, subject
00009  * to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included
00012  * in all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00018  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00019  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00020  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00021  */
00022 
00023 #ifndef _deQuaternion_h
00024 #define _deQuaternion_h
00025 
00035 class deQuaternion
00036 {
00037 public:
00039         operator deFloat*() { return _data; }
00041         operator const deFloat*() const { return _data; }
00043         deFloat& operator[](const deInt i) { return _data[i]; }
00045         const deFloat& operator[](const deInt i) const { return _data[i]; }
00047         DE_MATH_API void operator=(const deQuaternion& q);
00049         DE_MATH_API deInt operator==(const deQuaternion& q);
00051         DE_MATH_API void operator+=(const deQuaternion& q);
00053         DE_MATH_API void operator-=(const deQuaternion& q);
00055         DE_MATH_API void operator*=(const deFloat s);
00057         DE_MATH_API void identity();
00059         DE_MATH_API void zero();
00061         DE_MATH_API deFloat dot(const deQuaternion& q);
00063         DE_MATH_API void normalize();
00065         DE_MATH_API void get(deVector3& axis, deFloat &angle) const;
00067         DE_MATH_API void set(const deMatrix3& m);
00069         DE_MATH_API void set(const deInt axis, const deFloat angle);
00071         DE_MATH_API void set(const deVector3& axis, const deFloat angle);
00073         DE_MATH_API void set(const deFloat x, const deFloat y, const deFloat z, const deFloat w);
00075         DE_MATH_API void set(const deFloat* q);
00077         DE_MATH_API void eulerZYX(const deVector3& v);
00079         DE_MATH_API void negate(const deQuaternion& q);
00081         DE_MATH_API void inverse(const deQuaternion& q);
00083         DE_MATH_API void add(const deQuaternion& q1, const deQuaternion& q2);
00085         DE_MATH_API void subtract(const deQuaternion& q1, const deQuaternion& q2);
00087         DE_MATH_API void multiply(const deQuaternion& q1, const deQuaternion& q2);
00089         DE_MATH_API void inversedMultiply(const deQuaternion& q1, const deQuaternion& q2);
00091         DE_MATH_API void multiplyInversed(const deQuaternion& q1, const deQuaternion& q2);
00093         // dq = E omega
00094         // dq = 0.5 q_tilde omega
00095         DE_MATH_API void velocity(const deQuaternion& q, const deVector3& omega);
00097 
00101         DE_MATH_API void consistentSign(const deQuaternion& q, const deQuaternion& qg);
00103         DE_MATH_API void slerp(const deQuaternion& q, const deQuaternion& qg, const deFloat t, const deFloat addedSpins);
00105 
00107         DE_MATH_API void lerp(const deQuaternion& q, const deQuaternion& qg, const deFloat t);
00108 
00109 private:
00110         deFloat _data[DE_QUATERNION_SIZE];
00111 };
00112 
00113 #endif // _deQuaternion_h

Generated on Sun Apr 9 22:12:42 2006 for TAO by  doxygen 1.4.6-NO