1    	// @(#)root/g3d:$Id$
2    	// Author: Rene Brun   14/09/95
3    	
4    	/*************************************************************************
5    	 * Copyright (C) 1995-2000, 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_TRotMatrix
13   	#define ROOT_TRotMatrix
14   	
15   	
16   	//////////////////////////////////////////////////////////////////////////
17   	//                                                                      //
18   	// TRotMatrix                                                           //
19   	//                                                                      //
20   	// Rotation Matrix for 3-D geometry objects.                            //
21   	//                                                                      //
22   	//                                                                      //
23   	//////////////////////////////////////////////////////////////////////////
24   	
25   	#ifndef ROOT_TNamed
26   	#include "TNamed.h"
27   	#endif
28   	
29   	
30   	class TRotMatrix  : public TNamed {
31   	private:
32   	   virtual      void  SetReflection();   // Set the "reflection" flag if det < 0
33   	
34   	protected:
35   	   Int_t        fNumber;      //Rotation matrix number
36   	   Int_t        fType;        //Type of matrix (0=identity, 1=reflexion, 2=otherwise)
37   	   Double_t     fTheta;       //theta angle
38   	   Double_t     fPhi;         //phi angle
39   	   Double_t     fPsi;         //psi angle
40   	   Double_t     fMatrix[9];   //Rotation matrix
41   	
42   	public:
43   	   //TRotMatrix status bits
44   	   enum {
45   	      kReflection = BIT(23)   //  "Reflection" bit
46   	   };
47   	      
48   	   TRotMatrix();
49   	   TRotMatrix(const char *name, const char *title, Double_t *matrix);
50   	   TRotMatrix(const char *name, const char *title, Double_t theta, Double_t phi, Double_t psi);
51   	   TRotMatrix(const char *name, const char *title, Double_t theta1, Double_t phi1,
52   	                                           Double_t theta2, Double_t phi2,
53   	                                           Double_t theta3, Double_t phi3);
54   	   virtual ~TRotMatrix();
55   	   virtual Double_t  Determinant() const ;   // returns the determinant of this matrix
56   	   virtual Double_t* GetMatrix()         {return &fMatrix[0];}
57   	   virtual Int_t     GetNumber()   const {return fNumber;}
58   	   virtual Int_t     GetType()     const {return fType;}
59   	   virtual Double_t  GetTheta()    const {return fTheta;}
60   	   virtual Double_t  GetPhi()      const {return fPhi;}
61   	   virtual Double_t  GetPsi()      const {return fPsi;}
62   	   virtual Double_t* GetGLMatrix(Double_t *rGLMatrix) const ;  // Convert this matrix to the OpenGL [4x4]
63   	   virtual Bool_t    IsReflection() const {return TestBit(kReflection);}  // Return kTRUE if this matrix defines the reflection
64   	   virtual const     Double_t* SetAngles(Double_t theta1, Double_t phi1,Double_t theta2, Double_t phi2, Double_t theta3, Double_t phi3);
65   	   virtual void      SetMatrix(const Double_t *matrix);
66   	   virtual void      SetName(const char *name);
67   	
68   	   ClassDef(TRotMatrix,2)  //Rotation Matrix for 3-D geometry objects
69   	};
70   	
71   	inline void TRotMatrix::SetName(const char *) { }
72   	
73   	#endif
74