ROOT logo
// @(#)root/gl:$Id$
// Author:  Richard Maunder  04/10/2005

/*************************************************************************
 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGLRotateManip
#define ROOT_TGLRotateManip

#ifndef ROOT_TGLManip
#include "TGLManip.h"
#endif


class TGLRotateManip : public TGLManip
{
private:
   // Active ring interaction - set on mouse down
   // Shallow ring interaction
   // Where the ring plane forms a shallow angle to the eye direction -
   // a different interaction is required in these cases - see HandleMotion()
   Bool_t     fShallowRing;         //! does active ring form shallow angle to eye?
   Bool_t     fShallowFront;        //! front or back of the active shallow ring?
   TGLPlane   fActiveRingPlane;     //! plane of the active ring (widget)
   TGLVertex3 fActiveRingCenter;    //! center of active ring
   // TODO: Is ring center required - why not get from plane?

   // Normal interaction tracking (non-shallow)
   TGLLine3 fRingLine;
   TGLLine3 fRingLineOld;

   void DrawAxisRing(const TGLVertex3& origin, const TGLVector3& axis,
                     Double_t radius, Float_t rgba[4]) const;
   Double_t CalculateAngleDelta(const TPoint& mouse, const TGLCamera& camera);
   TGLLine3 CalculateRingLine(const TPoint& mouse, const TGLCamera& camera) const;

protected:
   static Double_t Angle(const TGLVector3& v1, const TGLVector3& v2);
   static Double_t Angle(const TGLVector3& v1, const TGLVector3& v2, const TGLVector3& ref);

public:
   TGLRotateManip();
   TGLRotateManip(TGLPhysicalShape* shape);
   virtual ~TGLRotateManip();

   virtual void   Draw(const TGLCamera& camera) const;
   virtual Bool_t HandleButton(const Event_t& event, const TGLCamera& camera);
   virtual Bool_t HandleMotion(const Event_t& event, const TGLCamera& camera);

   ClassDef(TGLRotateManip, 0); // GL rotation manipulator widget
};

#endif
 TGLRotateManip.h:1
 TGLRotateManip.h:2
 TGLRotateManip.h:3
 TGLRotateManip.h:4
 TGLRotateManip.h:5
 TGLRotateManip.h:6
 TGLRotateManip.h:7
 TGLRotateManip.h:8
 TGLRotateManip.h:9
 TGLRotateManip.h:10
 TGLRotateManip.h:11
 TGLRotateManip.h:12
 TGLRotateManip.h:13
 TGLRotateManip.h:14
 TGLRotateManip.h:15
 TGLRotateManip.h:16
 TGLRotateManip.h:17
 TGLRotateManip.h:18
 TGLRotateManip.h:19
 TGLRotateManip.h:20
 TGLRotateManip.h:21
 TGLRotateManip.h:22
 TGLRotateManip.h:23
 TGLRotateManip.h:24
 TGLRotateManip.h:25
 TGLRotateManip.h:26
 TGLRotateManip.h:27
 TGLRotateManip.h:28
 TGLRotateManip.h:29
 TGLRotateManip.h:30
 TGLRotateManip.h:31
 TGLRotateManip.h:32
 TGLRotateManip.h:33
 TGLRotateManip.h:34
 TGLRotateManip.h:35
 TGLRotateManip.h:36
 TGLRotateManip.h:37
 TGLRotateManip.h:38
 TGLRotateManip.h:39
 TGLRotateManip.h:40
 TGLRotateManip.h:41
 TGLRotateManip.h:42
 TGLRotateManip.h:43
 TGLRotateManip.h:44
 TGLRotateManip.h:45
 TGLRotateManip.h:46
 TGLRotateManip.h:47
 TGLRotateManip.h:48
 TGLRotateManip.h:49
 TGLRotateManip.h:50
 TGLRotateManip.h:51
 TGLRotateManip.h:52
 TGLRotateManip.h:53
 TGLRotateManip.h:54
 TGLRotateManip.h:55
 TGLRotateManip.h:56
 TGLRotateManip.h:57
 TGLRotateManip.h:58