Logo ROOT  
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
17class TPoint;
18
19class TArcBall {
20private:
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
31 void ResetMatrices();
32protected:
33 void MapToSphere(const TPoint &NewPt, Double_t *NewVec)const;
34public:
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 Double_t
Definition: RtypesCore.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:322
Implements the arc-ball rotation manipulator.
Definition: TArcBall.h:19
Double_t fStVec[3]
Definition: TArcBall.h:24
Double_t fTransform[16]
Definition: TArcBall.h:23
void ResetMatrices()
Set rotation matrix as union.
Definition: TArcBall.cxx:287
void MapToSphere(const TPoint &NewPt, Double_t *NewVec) const
map to sphere
Definition: TArcBall.cxx:210
void Drag(const TPoint &NewPt)
Mouse drag, calculate rotation.
Definition: TArcBall.cxx:260
Double_t fEnVec[3]
Definition: TArcBall.h:25
TArcBall & operator=(const TArcBall &)
Double_t fThisRot[9]
Definition: TArcBall.h:21
virtual ~TArcBall()
Definition: TArcBall.h:36
Double_t fLastRot[9]
Definition: TArcBall.h:22
Double_t fAdjustWidth
Definition: TArcBall.h:26
void SetBounds(UInt_t NewWidth, UInt_t NewHeight)
Definition: TArcBall.h:38
void Click(const TPoint &NewPt)
Mouse down.
Definition: TArcBall.cxx:249
Double_t fAdjustHeight
Definition: TArcBall.h:27
const Double_t * GetRotMatrix() const
Definition: TArcBall.h:47
TArcBall(const TArcBall &)
Definition: TPoint.h:31