Biomechanical Joint Model
 Author: Anderson Maciel

quaternion.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  * Quaternion class written by BlackAxe / Kolor aka Laurent Schmalen in 1997
00003  * this class is freeware. you are fully allowed to use this class in non-
00004  * commercial products. Use in commercial environment is strictly prohibited
00005  * if you use this, i'll be happy if you greet/credit me and my group
00006  *
00007  * Official Version 0.9
00008  *
00009  * Laurent aka Blackaxe/KoLoR
00010  */
00011 
00012 
00013 #ifndef BA_QUATERNION_H__
00014 #define BA_QUATERNION_H__
00015 
00016 //#include <iostream.h>
00017 #include <algebra/comevector3d.h>
00018 
00019 #ifndef PI
00020 #define PI 3.14159264
00021 #endif
00022 
00023 class Quaternion
00024 {
00025   private:
00026     double W, X, Y, Z;      // components of a quaternion
00027 
00028   public:
00029     // default constructor
00030     Quaternion();
00031     Quaternion(const double, const double = 0.0, const double = 0.0, const double = 0.0);
00032   
00033     // print a quaternion using streams
00034 //    void PrintOn(ostream& = cout) const;
00035 
00036     // quaternion multiplication
00037     friend Quaternion operator * (const Quaternion&, const Quaternion&);
00038     const Quaternion& operator *= (const Quaternion&);
00039 
00040     // konjugiertes Quaternion
00041     const Quaternion& operator ~ ();
00042 
00043     // this function inverts the quaternion
00044     const Quaternion& operator - ();
00045 
00046     // this normalizes a quaternion 
00047     const Quaternion& Normalize();
00048     const Quaternion& FromAxis(const double, double, double, double);
00049     void ToMatrix(double matrix[3][3]) const;
00050 
00051     void Slerp(const Quaternion&, const Quaternion&, const double);
00052 
00053     // some additional Quaternion functions
00054     // getting the exponent of a quaternion
00055     const Quaternion& exp();
00056     const Quaternion& log();
00057         
00058         //Added by Jean create a quaternion from two vectors
00059         void Quaternion::makeFromVecs(COME_Vector3D vec1, COME_Vector3D vec2); // modified Ken Shoemake - tested ok
00060         void Quaternion::setAxisAngle(double axis_angle[]);
00061         void Quaternion::setAxisAngle(COME_Vector3D axis, double angle);  // radians
00062 
00063 
00064 };
00065 
00066 //inline ostream& operator << (ostream &strm, const Quaternion &q)
00067 //{
00068 //  q.PrintOn(strm);
00069 //  return strm;
00070 //}
00071 
00072 #endif

Generated on Thu Dec 1 10:13:40 2005 for COME - Biomechanical Joint Model by  doxygen 1.4.5