trackball.hpp
Go to the documentation of this file.
1 /*
2 ** TP CPE Lyon
3 ** Copyright (C) 2013 Damien Rohmer & David Odin
4 **
5 ** This program is free software: you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation, either version 3 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef TRACKBALL_HPP_
20 # define TRACKBALL_HPP_
21 
22 
23 
24 
25 #include <quaternion.hpp>
26 
27 namespace cpe
28 {
29 
31  class trackball
32  {
33  public:
34 
35  // ********************************************* //
36  // ********************************************* //
37  // CONSTRUCTORS
38  // ********************************************* //
39  // ********************************************* //
40 
42  trackball();
43 
44 
45  //*********************************************//
46  //*********************************************//
47  // Get quaternion
48  //*********************************************//
49  //*********************************************//
50 
52  const quaternion& quat() const;
54  quaternion& quat();
55 
57  const quaternion& d_quat() const;
59  quaternion& d_quat();
60 
61  //*********************************************//
62  //*********************************************//
63  // Disc radius
64  //*********************************************//
65  //*********************************************//
66 
68  double& radius();
70  const double& radius() const;
71 
72  //*********************************************//
73  //*********************************************//
74  // Manipulation
75  //*********************************************//
76  //*********************************************//
77 
79  double project_to_disc(const double& x,const double& y) const;
80 
82  void set_2d_coords(const double& x0,const double& y0,const double& x1,const double& y1);
83 
85  void apply_rotation();
86 
88  void no_motion();
89 
90 
91 
92 
93 
94  private:
95 
100 
102  double disc_radius;
103 
104  };
105 
106 }
107 
108 #endif