TArcBall.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TArcBall.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author:  Timur Pocheptsov  03/08/2004
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TArcBall
00013 #define ROOT_TArcBall
00014 
00015 #ifndef ROOT_Rtypes
00016 #include "Rtypes.h"
00017 #endif
00018 
00019 class TPoint;
00020 
00021 class TArcBall {
00022 private:
00023    Double_t fThisRot[9];
00024    Double_t fLastRot[9];
00025    Double_t fTransform[16];
00026    Double_t fStVec[3];          //Saved click vector
00027    Double_t fEnVec[3];          //Saved drag vector
00028    Double_t fAdjustWidth;      //Mouse bounds width
00029    Double_t fAdjustHeight;     //Mouse bounds height
00030    //Non-copyable
00031    TArcBall(const TArcBall &);
00032    TArcBall & operator = (const TArcBall &);
00033    void ResetMatrices();
00034 protected:
00035    void MapToSphere(const TPoint &NewPt, Double_t *NewVec)const;
00036 public:
00037    TArcBall(UInt_t NewWidth = 100, UInt_t NewHeight = 100);
00038    virtual ~TArcBall() { }
00039 
00040    void SetBounds(UInt_t NewWidth, UInt_t NewHeight)
00041    {
00042       fAdjustWidth  = 1.0f / ((NewWidth  - 1.) * 0.5);
00043       fAdjustHeight = 1.0f / ((NewHeight - 1.) * 0.5);
00044    }
00045    //Mouse down
00046    void Click(const TPoint &NewPt);
00047    //Mouse drag, calculate rotation
00048    void Drag(const TPoint &NewPt);
00049    const Double_t *GetRotMatrix()const
00050    {
00051       return fTransform;
00052    }
00053 
00054    ClassDef(TArcBall,0) //ArcBall manipulator
00055 };
00056 
00057 #endif
00058 

Generated on Tue Jul 5 14:16:42 2011 for ROOT_528-00b_version by  doxygen 1.5.1