forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TArcBall.h
58 lines (49 loc) · 1.69 KB
/
TArcBall.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// @(#)root/gl:$Id$
// Author: Timur Pocheptsov 03/08/2004
/*************************************************************************
* Copyright (C) 1995-2004, 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_TArcBall
#define ROOT_TArcBall
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
class TPoint;
class TArcBall {
private:
Double_t fThisRot[9];
Double_t fLastRot[9];
Double_t fTransform[16];
Double_t fStVec[3]; //Saved click vector
Double_t fEnVec[3]; //Saved drag vector
Double_t fAdjustWidth; //Mouse bounds width
Double_t fAdjustHeight; //Mouse bounds height
//Non-copyable
TArcBall(const TArcBall &);
TArcBall & operator = (const TArcBall &);
void ResetMatrices();
protected:
void MapToSphere(const TPoint &NewPt, Double_t *NewVec)const;
public:
TArcBall(UInt_t NewWidth = 100, UInt_t NewHeight = 100);
virtual ~TArcBall() { }
void SetBounds(UInt_t NewWidth, UInt_t NewHeight)
{
fAdjustWidth = 1.0f / ((NewWidth - 1.) * 0.5);
fAdjustHeight = 1.0f / ((NewHeight - 1.) * 0.5);
}
//Mouse down
void Click(const TPoint &NewPt);
//Mouse drag, calculate rotation
void Drag(const TPoint &NewPt);
const Double_t *GetRotMatrix()const
{
return fTransform;
}
ClassDef(TArcBall,0) //ArcBall manipulator
};
#endif