Logo ROOT  
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
28class TRotMatrix : public TNamed {
29private:
30 virtual void SetReflection(); // Set the "reflection" flag if det < 0
31
32protected:
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
40public:
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
69inline void TRotMatrix::SetName(const char *) { }
70
71#endif
int Int_t
Definition: RtypesCore.h:45
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:325
#define BIT(n)
Definition: Rtypes.h:85
char name[80]
Definition: TGX11.cxx:110
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
Manages a detector rotation matrix.
Definition: TRotMatrix.h:28
virtual ~TRotMatrix()
RotMatrix default destructor.
Definition: TRotMatrix.cxx:113
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:186
virtual Int_t GetType() const
Definition: TRotMatrix.h:56
virtual Int_t GetNumber() const
Definition: TRotMatrix.h:55
virtual Double_t GetPsi() const
Definition: TRotMatrix.h:59
Double_t fTheta
Definition: TRotMatrix.h:35
Double_t fPsi
Definition: TRotMatrix.h:37
virtual Double_t GetPhi() const
Definition: TRotMatrix.h:58
Double_t fPhi
Definition: TRotMatrix.h:36
virtual Double_t GetTheta() const
Definition: TRotMatrix.h:57
Int_t fNumber
Definition: TRotMatrix.h:33
virtual void SetReflection()
Checks whether the determinant of this matrix defines the reflection transformation and set the "refl...
Definition: TRotMatrix.cxx:232
virtual void SetMatrix(const Double_t *matrix)
copy predefined 3x3 matrix into TRotMatrix object
Definition: TRotMatrix.cxx:215
TRotMatrix()
RotMatrix default constructor.
Definition: TRotMatrix.cxx:27
virtual Double_t * GetMatrix()
Definition: TRotMatrix.h:54
Double_t fMatrix[9]
Definition: TRotMatrix.h:38
virtual Bool_t IsReflection() const
Definition: TRotMatrix.h:61
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TRotMatrix.h:69
Int_t fType
Definition: TRotMatrix.h:34
virtual Double_t Determinant() const
Returns the value of the determinant of this matrix.
Definition: TRotMatrix.cxx:121
virtual Double_t * GetGLMatrix(Double_t *rGLMatrix) const
Convert this matrix to the OpenGL [4x4].
Definition: TRotMatrix.cxx:147