Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TrackballControl.hh
1 #ifndef __TrackballControl_HH__
2 #define __TrackballControl_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 <Base/Math/Vector3.hh>
11 #include <GLviewer/Controller/TrackballBase.hh>
12 
13 namespace BIAS {
14  /**
15  \class TrackballControl
16  \author cmenk
17  \ingroup g_glviewer
18  \brief class for camera movement in trackball mode.
19  */
20  class BIASGLviewer_EXPORT TrackballControl : public TrackballBase
21  {
22  public:
25 
26  /**\brief Moves the camera forward to point of interest if y2-y1 is positive
27  * else the camera is moved away from point of interest. */
28  bool RightMouseMoved(int x1, int x2, int y1, int y2);
29  void MoveInViewingDirection(double stepSize);
30 
31  /**\brief Rotates the camera around the point of interest. x1, x2, y1, y2 are the
32  * mouse coordinates and width, height must be the size of the window. The
33  * trackball contains the whole window. The radius of the trackball is
34  * sqrt from width*width/4 + height*height/4. */
35  bool LeftMouseMoved(int x1, int x2, int y1, int y2);
36 
37  /** \brief Rotate around the point of interest*/
38  void RotateAroundPOI(BIAS::Vector3<double> axis, double angleRAD);
39  /** \brief Rotate around viewing direction*/
40  void RotateAroundViewingDirection(double rotationAngleRAD);
41 
42  /** \brief Computes from the coordinates x,y a 3D point in the scene and tries to
43  * set it to the point of interest. */
44  virtual bool LeftMouseDoubleClicked(int x, int y, int m);
45 
46  /** \brief react to mouse move if left and right button is pressed. */
47  bool LeftAndRightMouseMoved(int x1, int x2, int y1, int y2);
48 
49  /** \brief Handles Mouse Wheel events and zooms in or out */
50  bool MouseWheelUsed(double stepsize);
51 
52  /** \brief Moves the camera left/right/up/down and sets new point of interest. */
53  bool MiddleMouseMoved(int x1, int x2, int y1, int y2);
54 
55  /** \brief Get point of interest
56  * \deprecated use GetPointOfInterest instead */
57  BIAS::Vector3<double> GetPoI() { return PointOfInterest_; }
58  /** \brief Get point of interest */
59  BIAS::Vector3<double> GetPointOfInterest() { return PointOfInterest_; }
60  /** \brief Set point of interest the controller will circle around.
61  * Adapts stepsize of movement depending on scene distance to camera*/
62  void SetPointOfInterest(const BIAS::Vector3<double>& poi);
63 
64  /** \brief Set the ProjectionParametersInterface (camera)*/
65  void SetGLProjectionParametersInterface(BIAS::GLProjectionParametersInterface* projInterface);
66 
67  protected:
68 
70  };
71 }//end of namespace
72 #endif //__TrackballControl_HH__
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 ...
BIAS::Vector3< double > PointOfInterest_
BIAS::Vector3< double > GetPoI()
Get point of interest.
BIAS::Vector3< double > GetPointOfInterest()
Get point of interest.
class for camera movement in trackball mode.