ROOT   6.08/07 Reference Guide
TRotMatrix.h
Go to the documentation of this file.
1 // @(#)root/g3d:$Id$
2 // Author: Rene Brun 14/09/95
3
4 /*************************************************************************
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
virtual Double_t GetPhi() const
Definition: TRotMatrix.h:60
Double_t fTheta
Definition: TRotMatrix.h:37
virtual Double_t * GetMatrix()
Definition: TRotMatrix.h:56
TRotMatrix()
RotMatrix default constructor.
Definition: TRotMatrix.cxx:28
Double_t fPsi
Definition: TRotMatrix.h:39
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:157
#define BIT(n)
Definition: Rtypes.h:120
virtual Double_t Determinant() const
Returns the value of the determinant of this matrix.
Definition: TRotMatrix.cxx:122
Double_t fPhi
Definition: TRotMatrix.h:38
Int_t fNumber
Definition: TRotMatrix.h:35
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void SetMatrix(const Double_t *matrix)
copy predefined 3x3 matrix into TRotMatrix object
Definition: TRotMatrix.cxx:216
virtual Bool_t IsReflection() const
Definition: TRotMatrix.h:63
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual void SetReflection()
Checks whether the determinant of this matrix defines the reflection transformation and set the "refl...
Definition: TRotMatrix.cxx:233
virtual Int_t GetType() const
Definition: TRotMatrix.h:58
virtual Double_t GetPsi() const
Definition: TRotMatrix.h:61
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TRotMatrix.h:71
Manages a detector rotation matrix.
Definition: TRotMatrix.h:30
virtual const Double_t * SetAngles(Double_t theta1, Double_t phi1, Double_t theta2, Double_t phi2, Double_t theta3, Double_t phi3)
theta1 is the polar angle of the x-prim axis in the main reference system (MRS), theta2 and theta3 ha...
Definition: TRotMatrix.cxx:187
virtual ~TRotMatrix()
RotMatrix default destructor.
Definition: TRotMatrix.cxx:114
Int_t fType
Definition: TRotMatrix.h:36
double Double_t
Definition: RtypesCore.h:55
virtual Int_t GetNumber() const
Definition: TRotMatrix.h:57
virtual Double_t GetTheta() const
Definition: TRotMatrix.h:59
virtual Double_t * GetGLMatrix(Double_t *rGLMatrix) const
Convert this matrix to the OpenGL [4x4].
Definition: TRotMatrix.cxx:148
Double_t fMatrix[9]
Definition: TRotMatrix.h:40
char name[80]
Definition: TGX11.cxx:109