00001 00002 /* 00003 ** TP ETI3 CPE Lyon 00004 ** Copyright (C) 2009 Damien Rohmer 00005 ** 00006 ** This program is free software: you can redistribute it and/or modify 00007 ** it under the terms of the GNU General Public License as published by 00008 ** the Free Software Foundation, either version 3 of the License, or 00009 ** (at your option) any later version. 00010 ** 00011 ** This program is distributed in the hope that it will be useful, 00012 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 ** GNU General Public License for more details. 00015 ** 00016 ** You should have received a copy of the GNU General Public License 00017 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 00021 #ifndef MC_TRACKBALL_HPP_ 00022 # define MC_TRACKBALL_HPP_ 00023 00024 00025 00026 #include <iostream> 00027 00028 00029 #include <MC_quaternion.hpp> 00030 00031 namespace mesh_conv 00032 { 00033 00035 class MC_trackball 00036 { 00037 public: 00038 00039 //*********************************************// 00040 //*********************************************// 00041 // CONSTRUCTORS 00042 //*********************************************// 00043 //*********************************************// 00044 00046 MC_trackball(); 00047 00049 ~MC_trackball(); 00050 00051 //*********************************************// 00052 //*********************************************// 00053 // Get quaternion 00054 //*********************************************// 00055 //*********************************************// 00056 00058 const MC_quaternion& quaternion() const; 00060 MC_quaternion& quaternion(); 00061 00063 const MC_quaternion& d_quaternion() const; 00065 MC_quaternion& d_quaternion(); 00066 00067 //*********************************************// 00068 //*********************************************// 00069 // Manipulation 00070 //*********************************************// 00071 //*********************************************// 00072 00074 double project_to_disc(const double& x,const double& y) const; 00075 00077 MC_trackball& set_2d_coords(const double& x0,const double& y0,const double& x1,const double& y1); 00078 00080 MC_trackball& apply_rotation(); 00081 00083 MC_trackball& no_motion(); 00084 00085 00087 double disc_radius; 00088 00089 private: 00090 00091 00092 00094 MC_quaternion current_q; 00096 MC_quaternion d_q; 00097 }; 00098 00099 } 00100 00101 #endif