Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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:
21  Double_t fThisRot[9];
22  Double_t fLastRot[9];
23  Double_t fTransform[16];
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