Quat.h

00001 /****************************************************************************
00002  * Copyright 2005 Evan Drumwright
00003  * This library is distributed under the terms of the GNU General Public 
00004  * License (found in COPYING).
00005  ****************************************************************************/
00006 
00007 #ifndef _QUAT_H
00008 #define _QUAT_H
00009 
00010 #include <Physsim/Base.h>
00011 #include <Physsim/VectorN.h>
00012 #include <Physsim/Vector3.h>
00013 
00014 namespace Physsim {
00015 
00016 class Matrix3;
00017 class Matrix4;
00018 class AAngle;
00019 
00021 
00025 class Quat : public Base
00026 {
00027         public:
00028                 Quat();
00029                 Quat(Real x, Real y, Real z, Real w);
00030                 Quat(boost::shared_array<const Real>  q);
00031                 Quat(const Quat& q);
00032                 Quat(const VectorN& v);
00033                 Quat(const Matrix3* m);
00034                 Quat(const Matrix4* m);
00035                 Quat(const AAngle* a);
00036                 static Quat zero();
00037                 void conjugate();
00038                 static Quat conjugate(const Quat& q);
00039                 bool epsilon_equals(const Quat& q, Real epsilon);
00040                 static bool epsilon_equals(const Quat& q1, const Quat& q2, Real epsilon);
00041                 void slerp(const Quat& q, Real alpha);
00042                 static Quat slerp(const Quat& q1, const Quat& q2, Real alpha);
00043                 void inverse();
00044                 static Quat inverse(const Quat& q);
00045                 void normalize();
00046                 static Quat normalize(const Quat& q); 
00047                 void set(const VectorN& v);
00048                 void set(const AAngle* a);
00049                 void set(const Matrix3* m);
00050                 void set(const Matrix4* m);
00051                 Quat operator-(const Quat& q) const;
00052                 void operator-=(const Quat& q);
00053                 Quat operator+(const Quat& q) const;
00054                 void operator+=(const Quat& q);
00055                 void operator=(const Quat& q);
00056                 Quat operator*(const Quat& q) const;
00057                 Quat operator*(Real scalar) const;
00058                 void operator*=(const Quat& q);
00059                 void operator*=(Real scalar);
00060                 Real magnitude() const;
00061                 static Quat deriv(const Quat& q, const Vector3& w);
00062                 static Vector3 to_omega(const Quat& q, const Quat& qd);
00063                 
00065                 Real _x;
00066 
00068                 Real _y;
00069 
00071                 Real _z; 
00072 
00074                 Real _w;
00075 };
00076 
00077 Quat operator*(Real scalar, const Quat& q);
00078 std::ostream& operator<<(std::ostream& out, const Quat& q);
00079 
00080 }
00081 #endif

Generated on Wed Oct 24 14:54:22 2007 for Physsim by  doxygen 1.5.1