MC_quaternion.hpp

Go to the documentation of this file.
00001 /*
00002 **    Mesh Converter
00003 **    Copyright (C) 2008 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);
00065         MC_quaternion(const MC_matrix& v);
00066 
00067 
00068         //*********************************************//
00069         //*********************************************//
00070         // Math Operator
00071         //*********************************************//
00072         //*********************************************//
00073 
00077         MC_matrix matrix() const;
00078 
00080         MC_quaternion conjugated() const;
00081 
00083         friend MC_quaternion operator*(const MC_quaternion& q0,const MC_quaternion& q1);
00085         MC_quaternion& operator*=(const MC_quaternion& q1);
00086 
00087 
00088 
00091         MC_quaternion pow(const double& t) const;
00092 
00095         MC_quaternion inverted() const;
00096 
00097 
00101         MC_v3d log() const;
00102 
00106         static MC_quaternion exp(const MC_v3d& v);
00107 
00113         static MC_quaternion slerp(const MC_quaternion& q0,const MC_quaternion& q1,const double& t);
00114 
00115 
00119         static MC_quaternion quat_interp(const std::vector <MC_quaternion>& quaternion_vec,const MC_double_vector& weights);
00123         static MC_matrix quat_interp(const std::vector <MC_matrix>& matrix_vec,const MC_double_vector& weights);
00125         static MC_matrix quat_interp(const std::vector <MC_quaternion>& quaternion_vec,const MC_double_vector& weights,const MC_v3d_vector& translation_vec);
00126 
00127 
00128         //*********************************************//
00129         //*********************************************//
00130         // GET
00131         //*********************************************//
00132         //*********************************************//
00133 
00135         MC_v3d axis() const;
00137         double angle() const;
00138 
00139         //*********************************************//
00140         //*********************************************//
00141         // OUTPUT
00142         //*********************************************//
00143         //*********************************************//
00144 
00145 
00146     private:
00147 
00148 
00149     };
00150 
00151 
00152 
00153 }
00154 
00155 #endif // MC_v4d_HPP

Generated on Fri Sep 25 13:31:35 2009 by  doxygen 1.5.8