MC_quaternion.hpp

Go to the documentation of this file.
00001 /*
00002 **    Mesh Converter
00003 **    Copyright (C) 2009 Damien Rohmer
00004 **
00005 **    This program is free software: you can redistribute it and/or modify
00006 **    it under the terms of the GNU General Public License as published by
00007 **    the Free Software Foundation, either version 3 of the License, or
00008 **    (at your option) any later version.
00009 **
00010 **   This program is distributed in the hope that it will be useful,
00011 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 **    GNU General Public License for more details.
00014 **
00015 **    You should have received a copy of the GNU General Public License
00016 **    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 
00021 #ifndef MC_MC_QUATERNION_HPP
00022 #define MC_MC_QUATERNION_HPP
00023 
00024 #include <iostream>
00025 #include <cmath>
00026 
00027 #include <MC_v4d.hpp>
00028 #include <vector>
00029 
00030 
00031 
00032 
00033 namespace mesh_conv
00034 {
00035 
00036     class MC_v3d;
00037     class MC_v3d_vector;
00038     class MC_double_vector;
00039 
00041 
00043     class MC_quaternion : public MC_v4d
00044     {
00045     public:
00046 
00047         //*********************************************//
00048         //*********************************************//
00049         // CONSTRUCTORS
00050         //*********************************************//
00051         //*********************************************//
00052 
00054         MC_quaternion();
00056         MC_quaternion(const MC_v3d& axis,const double& angle);
00058         MC_quaternion(const MC_v4d& v);
00060         MC_quaternion(const MC_quaternion& q);
00062         MC_quaternion(const double& x,const double& y,const double& z,const double& w);
00063 
00064 
00065 
00066         //*********************************************//
00067         //*********************************************//
00068         // Math Operator
00069         //*********************************************//
00070         //*********************************************//
00071 
00075         MC_matrix matrix() const;
00076 
00078         MC_quaternion conjugated() const;
00079 
00081         friend MC_quaternion operator*(const MC_quaternion& q0,const MC_quaternion& q1);
00083         MC_quaternion& operator*=(const MC_quaternion& q1);
00084 
00085 
00086 
00089         MC_quaternion pow(const double& t) const;
00090 
00093         MC_quaternion inverted() const;
00094 
00095 
00099         MC_v3d log() const;
00100 
00104         static MC_quaternion exp(const MC_v3d& v);
00105 
00111         static MC_quaternion slerp(const MC_quaternion& q0,const MC_quaternion& q1,const double& t);
00112 
00113 
00117         static MC_quaternion quat_interp(const std::vector <MC_quaternion>& quaternion_vec,const MC_double_vector& weights);
00121         static MC_matrix quat_interp(const std::vector <MC_matrix>& matrix_vec,const MC_double_vector& weights);
00123         static MC_matrix quat_interp(const std::vector <MC_quaternion>& quaternion_vec,const MC_double_vector& weights,const MC_v3d_vector& translation_vec);
00124 
00125 
00126         //*********************************************//
00127         //*********************************************//
00128         // GET
00129         //*********************************************//
00130         //*********************************************//
00131 
00133         MC_v3d axis() const;
00135         double angle() const;
00136 
00137         //*********************************************//
00138         //*********************************************//
00139         // OUTPUT
00140         //*********************************************//
00141         //*********************************************//
00142 
00143 
00144     private:
00145 
00146 
00147     };
00148 
00149 
00150 
00151 }
00152 
00153 #endif // MC_v4d_HPP

Generated on Sun Apr 18 20:24:47 2010 by  doxygen 1.6.1