Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TrackballBase.hh
1 #ifndef __TrackballBase_HH__
2 #define __TrackballBase_HH__
3 
4 #include <bias_config.h>
5 
6 #ifndef BIAS_HAVE_OPENGL
7 # error You need BIAS with USE_OpenGL Please recompile BIAS.
8 #endif // BUILD_GLviewer
9 
10 #include <GLviewer/Controller/ControlInterface.hh>
11 #include <GLviewer/GLProjectionParametersBase.hh>
12 #include <Base/Math/Vector3.hh>
13 
14 namespace BIAS {
15 /**
16  \class TrackballBase
17  \author grauel, cmenk
18  \ingroup g_glviewer
19  \brief functionality for editing cameras or transformations in trackball mode.
20  parts of trackballcontroller code have been moved to this base class
21  so they can be used in other trackball classes like trackballTransController. */
22  class BIASGLviewer_EXPORT TrackballBase : public ControlInterface
23  {
24  public:
25  TrackballBase();
27 
28  void SetStepsize(double stepsize);
29  bool SpecialKeyPressed(int key);
30 
31  void SetUseLeftDouble(bool ld) {UseLeftDouble_ = ld;};
32  bool GetUseLeftDouble(){return UseLeftDouble_;};
33 
34  protected:
35 
36  void GetMoveinViewDirection(GLProjectionParametersInterface* cam,
37  const double stepsize,
38  const BIAS::Vector3<double>& viewdir,
39  BIAS::Vector3<double>& res_translation);
40 
41  bool GetRotationAxisAndAngle(GLProjectionParametersInterface* cam,
42  const int x1,
43  const int x2,
44  const int y1,
45  const int y2,
47  double& angleRAD);
48 
49  // the translation from mouse movement (middlemousemoved case)
50  void GetTranslation(GLProjectionParametersInterface* cam,
51  const int x1,
52  const int x2,
53  const int y1,
54  const int y2,
55  const BIAS::Vector3<double>& viewdir,
56  BIAS::Vector3<double>& transl);
57 
58  //get rotation angle from mouse movement for rotation around view direction
59  double GetRotationAngle(GLProjectionParametersInterface* cam,
60  const int x1,
61  const int x2,
62  const int y1,
63  const int y2,
64  const BIAS::Vector3<double> viewdir);
65 
66  void GetViewDirection(GLProjectionParametersInterface* cam,
67  BIAS::Vector3<double>& direction);
68 
69  double Stepsize_;
71  };
72 }//end of namespace
73 #endif
Abstract interface class to handle changes in rendering parameters by controllers and in rendering co...
functionality for editing cameras or transformations in trackball mode. parts of trackballcontroller ...
void SetUseLeftDouble(bool ld)
Defines the common interface used for communication between rendering components. ...