ROOT  6.06/09
Reference Guide
TArcBall.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Timur Pocheptsov 03/08/2004
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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_TArcBall
13 #define ROOT_TArcBall
14 
15 #ifndef ROOT_Rtypes
16 #include "Rtypes.h"
17 #endif
18 
19 class TPoint;
20 
21 class TArcBall {
22 private:
26  Double_t fStVec[3]; //Saved click vector
27  Double_t fEnVec[3]; //Saved drag vector
28  Double_t fAdjustWidth; //Mouse bounds width
29  Double_t fAdjustHeight; //Mouse bounds height
30  //Non-copyable
31  TArcBall(const TArcBall &);
32  TArcBall & operator = (const TArcBall &);
33  void ResetMatrices();
34 protected:
35  void MapToSphere(const TPoint &NewPt, Double_t *NewVec)const;
36 public:
37  TArcBall(UInt_t NewWidth = 100, UInt_t NewHeight = 100);
38  virtual ~TArcBall() { }
39 
40  void SetBounds(UInt_t NewWidth, UInt_t NewHeight)
41  {
42  fAdjustWidth = 1.0f / ((NewWidth - 1.) * 0.5);
43  fAdjustHeight = 1.0f / ((NewHeight - 1.) * 0.5);
44  }
45  //Mouse down
46  void Click(const TPoint &NewPt);
47  //Mouse drag, calculate rotation
48  void Drag(const TPoint &NewPt);
49  const Double_t *GetRotMatrix()const
50  {
51  return fTransform;
52  }
53 
54  ClassDef(TArcBall,0) //ArcBall manipulator
55 };
56 
57 #endif
58 
Double_t fTransform[16]
Definition: TArcBall.h:25
void Click(const TPoint &NewPt)
Mouse down.
Definition: TArcBall.cxx:249
Double_t fEnVec[3]
Definition: TArcBall.h:27
Double_t fLastRot[9]
Definition: TArcBall.h:24
Double_t fStVec[3]
Definition: TArcBall.h:26
Double_t fThisRot[9]
Definition: TArcBall.h:23
TArcBall & operator=(const TArcBall &)
#define ClassDef(name, id)
Definition: Rtypes.h:254
void Drag(const TPoint &NewPt)
Mouse drag, calculate rotation.
Definition: TArcBall.cxx:260
virtual ~TArcBall()
Definition: TArcBall.h:38
Definition: TPoint.h:33
const Double_t * GetRotMatrix() const
Definition: TArcBall.h:49
unsigned int UInt_t
Definition: RtypesCore.h:42
void MapToSphere(const TPoint &NewPt, Double_t *NewVec) const
map to sphere
Definition: TArcBall.cxx:210
double Double_t
Definition: RtypesCore.h:55
TArcBall(const TArcBall &)
void ResetMatrices()
Set rotation matrix as union.
Definition: TArcBall.cxx:287
Double_t fAdjustWidth
Definition: TArcBall.h:28
Implements the arc-ball rotation manipulator.
Definition: TArcBall.h:21
Double_t fAdjustHeight
Definition: TArcBall.h:29
void SetBounds(UInt_t NewWidth, UInt_t NewHeight)
Definition: TArcBall.h:40