Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLRotateManip.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Richard Maunder 04/10/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGLRotateManip
13 #define ROOT_TGLRotateManip
14 
15 #include "TGLManip.h"
16 
17 
18 class TGLRotateManip : public TGLManip
19 {
20 private:
21  // Active ring interaction - set on mouse down
22  // Shallow ring interaction
23  // Where the ring plane forms a shallow angle to the eye direction -
24  // a different interaction is required in these cases - see HandleMotion()
25  Bool_t fShallowRing; //! does active ring form shallow angle to eye?
26  Bool_t fShallowFront; //! front or back of the active shallow ring?
27  TGLPlane fActiveRingPlane; //! plane of the active ring (widget)
28  TGLVertex3 fActiveRingCenter; //! center of active ring
29  // TODO: Is ring center required - why not get from plane?
30 
31  // Normal interaction tracking (non-shallow)
32  TGLLine3 fRingLine;
33  TGLLine3 fRingLineOld;
34 
35  void DrawAxisRing(const TGLVertex3& origin, const TGLVector3& axis,
36  Double_t radius, Float_t rgba[4]) const;
37  Double_t CalculateAngleDelta(const TPoint& mouse, const TGLCamera& camera);
38  TGLLine3 CalculateRingLine(const TPoint& mouse, const TGLCamera& camera) const;
39 
40 protected:
41  static Double_t Angle(const TGLVector3& v1, const TGLVector3& v2);
42  static Double_t Angle(const TGLVector3& v1, const TGLVector3& v2, const TGLVector3& ref);
43 
44 public:
45  TGLRotateManip();
46  TGLRotateManip(TGLPhysicalShape* shape);
47  virtual ~TGLRotateManip();
48 
49  virtual void Draw(const TGLCamera& camera) const;
50  virtual Bool_t HandleButton(const Event_t& event, const TGLCamera& camera);
51  virtual Bool_t HandleMotion(const Event_t& event, const TGLCamera& camera);
52 
53  ClassDef(TGLRotateManip, 0); // GL rotation manipulator widget
54 };
55 
56 #endif