ROOT logo
// @(#)root/g3d:$Id: TRotMatrix.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Rene Brun   14/09/95

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TRotMatrix
#define ROOT_TRotMatrix


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRotMatrix                                                           //
//                                                                      //
// Rotation Matrix for 3-D geometry objects.                            //
//                                                                      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif


class TRotMatrix  : public TNamed {
private:
   virtual      void  SetReflection();   // Set the "reflection" flag if det < 0

protected:
   Int_t        fNumber;      //Rotation matrix number
   Int_t        fType;        //Type of matrix (0=identity, 1=reflexion, 2=otherwise)
   Double_t     fTheta;       //theta angle
   Double_t     fPhi;         //phi angle
   Double_t     fPsi;         //psi angle
   Double_t     fMatrix[9];   //Rotation matrix

public:
   //TRotMatrix status bits
   enum {
      kReflection = BIT(23)   //  "Reflection" bit
   };
      
   TRotMatrix();
   TRotMatrix(const char *name, const char *title, Double_t *matrix);
   TRotMatrix(const char *name, const char *title, Double_t theta, Double_t phi, Double_t psi);
   TRotMatrix(const char *name, const char *title, Double_t theta1, Double_t phi1,
                                           Double_t theta2, Double_t phi2,
                                           Double_t theta3, Double_t phi3);
   virtual ~TRotMatrix();
   virtual Double_t  Determinant() const ;   // returns the determinant of this matrix
   virtual Double_t* GetMatrix()         {return &fMatrix[0];}
   virtual Int_t     GetNumber()   const {return fNumber;}
   virtual Int_t     GetType()     const {return fType;}
   virtual Double_t  GetTheta()    const {return fTheta;}
   virtual Double_t  GetPhi()      const {return fPhi;}
   virtual Double_t  GetPsi()      const {return fPsi;}
   virtual Double_t* GetGLMatrix(Double_t *rGLMatrix) const ;  // Convert this matrix to the OpenGL [4x4]
   virtual Bool_t    IsReflection() const {return TestBit(kReflection);}  // Return kTRUE if this matrix defines the reflection
   virtual const     Double_t* SetAngles(Double_t theta1, Double_t phi1,Double_t theta2, Double_t phi2, Double_t theta3, Double_t phi3);
   virtual void      SetMatrix(const Double_t *matrix);
   virtual void      SetName(const char *name);

   ClassDef(TRotMatrix,2)  //Rotation Matrix for 3-D geometry objects
};

inline void TRotMatrix::SetName(const char *) { }

#endif
 TRotMatrix.h:1
 TRotMatrix.h:2
 TRotMatrix.h:3
 TRotMatrix.h:4
 TRotMatrix.h:5
 TRotMatrix.h:6
 TRotMatrix.h:7
 TRotMatrix.h:8
 TRotMatrix.h:9
 TRotMatrix.h:10
 TRotMatrix.h:11
 TRotMatrix.h:12
 TRotMatrix.h:13
 TRotMatrix.h:14
 TRotMatrix.h:15
 TRotMatrix.h:16
 TRotMatrix.h:17
 TRotMatrix.h:18
 TRotMatrix.h:19
 TRotMatrix.h:20
 TRotMatrix.h:21
 TRotMatrix.h:22
 TRotMatrix.h:23
 TRotMatrix.h:24
 TRotMatrix.h:25
 TRotMatrix.h:26
 TRotMatrix.h:27
 TRotMatrix.h:28
 TRotMatrix.h:29
 TRotMatrix.h:30
 TRotMatrix.h:31
 TRotMatrix.h:32
 TRotMatrix.h:33
 TRotMatrix.h:34
 TRotMatrix.h:35
 TRotMatrix.h:36
 TRotMatrix.h:37
 TRotMatrix.h:38
 TRotMatrix.h:39
 TRotMatrix.h:40
 TRotMatrix.h:41
 TRotMatrix.h:42
 TRotMatrix.h:43
 TRotMatrix.h:44
 TRotMatrix.h:45
 TRotMatrix.h:46
 TRotMatrix.h:47
 TRotMatrix.h:48
 TRotMatrix.h:49
 TRotMatrix.h:50
 TRotMatrix.h:51
 TRotMatrix.h:52
 TRotMatrix.h:53
 TRotMatrix.h:54
 TRotMatrix.h:55
 TRotMatrix.h:56
 TRotMatrix.h:57
 TRotMatrix.h:58
 TRotMatrix.h:59
 TRotMatrix.h:60
 TRotMatrix.h:61
 TRotMatrix.h:62
 TRotMatrix.h:63
 TRotMatrix.h:64
 TRotMatrix.h:65
 TRotMatrix.h:66
 TRotMatrix.h:67
 TRotMatrix.h:68
 TRotMatrix.h:69
 TRotMatrix.h:70
 TRotMatrix.h:71
 TRotMatrix.h:72
 TRotMatrix.h:73