Logo ROOT   6.12/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 /*************************************************************************
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 #include "TNamed.h"
26 
27 
28 class TRotMatrix : public TNamed {
29 private:
30  virtual void SetReflection(); // Set the "reflection" flag if det < 0
31 
32 protected:
33  Int_t fNumber; //Rotation matrix number
34  Int_t fType; //Type of matrix (0=identity, 1=reflexion, 2=otherwise)
35  Double_t fTheta; //theta angle
36  Double_t fPhi; //phi angle
37  Double_t fPsi; //psi angle
38  Double_t fMatrix[9]; //Rotation matrix
39 
40 public:
41  //TRotMatrix status bits
42  enum {
43  kReflection = BIT(23) // "Reflection" bit
44  };
45 
46  TRotMatrix();
47  TRotMatrix(const char *name, const char *title, Double_t *matrix);
48  TRotMatrix(const char *name, const char *title, Double_t theta, Double_t phi, Double_t psi);
49  TRotMatrix(const char *name, const char *title, Double_t theta1, Double_t phi1,
50  Double_t theta2, Double_t phi2,
51  Double_t theta3, Double_t phi3);
52  virtual ~TRotMatrix();
53  virtual Double_t Determinant() const ; // returns the determinant of this matrix
54  virtual Double_t* GetMatrix() {return &fMatrix[0];}
55  virtual Int_t GetNumber() const {return fNumber;}
56  virtual Int_t GetType() const {return fType;}
57  virtual Double_t GetTheta() const {return fTheta;}
58  virtual Double_t GetPhi() const {return fPhi;}
59  virtual Double_t GetPsi() const {return fPsi;}
60  virtual Double_t* GetGLMatrix(Double_t *rGLMatrix) const ; // Convert this matrix to the OpenGL [4x4]
61  virtual Bool_t IsReflection() const {return TestBit(kReflection);} // Return kTRUE if this matrix defines the reflection
62  virtual const Double_t* SetAngles(Double_t theta1, Double_t phi1,Double_t theta2, Double_t phi2, Double_t theta3, Double_t phi3);
63  virtual void SetMatrix(const Double_t *matrix);
64  virtual void SetName(const char *name);
65 
66  ClassDef(TRotMatrix,2) //Rotation Matrix for 3-D geometry objects
67 };
68 
69 inline void TRotMatrix::SetName(const char *) { }
70 
71 #endif
virtual Double_t GetPhi() const
Definition: TRotMatrix.h:58
Double_t fTheta
Definition: TRotMatrix.h:35
virtual Double_t * GetMatrix()
Definition: TRotMatrix.h:54
TRotMatrix()
RotMatrix default constructor.
Definition: TRotMatrix.cxx:28
Double_t fPsi
Definition: TRotMatrix.h:37
#define BIT(n)
Definition: Rtypes.h:78
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
virtual Double_t Determinant() const
Returns the value of the determinant of this matrix.
Definition: TRotMatrix.cxx:122
Double_t fPhi
Definition: TRotMatrix.h:36
Int_t fNumber
Definition: TRotMatrix.h:33
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:61
#define ClassDef(name, id)
Definition: Rtypes.h:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
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:56
virtual Double_t GetPsi() const
Definition: TRotMatrix.h:59
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TRotMatrix.h:69
Manages a detector rotation matrix.
Definition: TRotMatrix.h:28
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:34
double Double_t
Definition: RtypesCore.h:55
virtual Int_t GetNumber() const
Definition: TRotMatrix.h:55
virtual Double_t GetTheta() const
Definition: TRotMatrix.h:57
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:38
char name[80]
Definition: TGX11.cxx:109