Logo ROOT   6.12/07
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 #include "Rtypes.h"
16 
17 class TPoint;
18 
19 class TArcBall {
20 private:
24  Double_t fStVec[3]; //Saved click vector
25  Double_t fEnVec[3]; //Saved drag vector
26  Double_t fAdjustWidth; //Mouse bounds width
27  Double_t fAdjustHeight; //Mouse bounds height
28  //Non-copyable
29  TArcBall(const TArcBall &);
30  TArcBall & operator = (const TArcBall &);
31  void ResetMatrices();
32 protected:
33  void MapToSphere(const TPoint &NewPt, Double_t *NewVec)const;
34 public:
35  TArcBall(UInt_t NewWidth = 100, UInt_t NewHeight = 100);
36  virtual ~TArcBall() { }
37 
38  void SetBounds(UInt_t NewWidth, UInt_t NewHeight)
39  {
40  fAdjustWidth = 1.0f / ((NewWidth - 1.) * 0.5);
41  fAdjustHeight = 1.0f / ((NewHeight - 1.) * 0.5);
42  }
43  //Mouse down
44  void Click(const TPoint &NewPt);
45  //Mouse drag, calculate rotation
46  void Drag(const TPoint &NewPt);
47  const Double_t *GetRotMatrix()const
48  {
49  return fTransform;
50  }
51 
52  ClassDef(TArcBall,0) //ArcBall manipulator
53 };
54 
55 #endif
56 
Double_t fTransform[16]
Definition: TArcBall.h:23
void Click(const TPoint &NewPt)
Mouse down.
Definition: TArcBall.cxx:249
Double_t fEnVec[3]
Definition: TArcBall.h:25
const Double_t * GetRotMatrix() const
Definition: TArcBall.h:47
Double_t fLastRot[9]
Definition: TArcBall.h:22
Double_t fStVec[3]
Definition: TArcBall.h:24
Double_t fThisRot[9]
Definition: TArcBall.h:21
TArcBall & operator=(const TArcBall &)
#define ClassDef(name, id)
Definition: Rtypes.h:320
void Drag(const TPoint &NewPt)
Mouse drag, calculate rotation.
Definition: TArcBall.cxx:260
virtual ~TArcBall()
Definition: TArcBall.h:36
Definition: TPoint.h:31
unsigned int UInt_t
Definition: RtypesCore.h:42
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:26
Implements the arc-ball rotation manipulator.
Definition: TArcBall.h:19
Double_t fAdjustHeight
Definition: TArcBall.h:27
void SetBounds(UInt_t NewWidth, UInt_t NewHeight)
Definition: TArcBall.h:38
void MapToSphere(const TPoint &NewPt, Double_t *NewVec) const
map to sphere
Definition: TArcBall.cxx:210