Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:29

0001 // @(#)root/gl:$Id$
0002 // Author:  Timur Pocheptsov  03/08/2004
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TArcBall
0013 #define ROOT_TArcBall
0014 
0015 #include "Rtypes.h"
0016 
0017 class TPoint;
0018 
0019 class TArcBall {
0020 private:
0021    Double_t fThisRot[9];
0022    Double_t fLastRot[9];
0023    Double_t fTransform[16];
0024    Double_t fStVec[3];          //Saved click vector
0025    Double_t fEnVec[3];          //Saved drag vector
0026    Double_t fAdjustWidth;      //Mouse bounds width
0027    Double_t fAdjustHeight;     //Mouse bounds height
0028    //Non-copyable
0029    TArcBall(const TArcBall &);
0030    TArcBall & operator = (const TArcBall &);
0031    void ResetMatrices();
0032 protected:
0033    void MapToSphere(const TPoint &NewPt, Double_t *NewVec)const;
0034 public:
0035    TArcBall(UInt_t NewWidth = 100, UInt_t NewHeight = 100);
0036    virtual ~TArcBall() { }
0037 
0038    void SetBounds(UInt_t NewWidth, UInt_t NewHeight)
0039    {
0040       fAdjustWidth  = 1.0f / ((NewWidth  - 1.) * 0.5);
0041       fAdjustHeight = 1.0f / ((NewHeight - 1.) * 0.5);
0042    }
0043    //Mouse down
0044    void Click(const TPoint &NewPt);
0045    //Mouse drag, calculate rotation
0046    void Drag(const TPoint &NewPt);
0047    const Double_t *GetRotMatrix()const
0048    {
0049       return fTransform;
0050    }
0051 
0052    ClassDef(TArcBall,0) //ArcBall manipulator
0053 };
0054 
0055 #endif
0056