// -*- mode: c++ -*- #ifndef BRAT_BrRotMatrix #define BRAT_BrRotMatrix // $Id: BrRotMatrix.h,v 1.5 2002/02/26 08:59:08 cholm Exp $ ////////////////////////////////////////////////////////////////////////// // // // BrRotMatrix // // // // Rotation Matrix for 3-D geometry objects. // // Copied from ROOT source but modified to make simpler. See R.Brun // // copyright notice in BrRotMatrix.cxx source code. // // // ////////////////////////////////////////////////////////////////////////// #ifndef ROOT_TObject #include "TObject.h" #endif #include enum { kBrReflection = BIT(23) // "Reflection" bit }; class BrRotMatrix : public TObject { private: void SetReflection(); // Set the "reflection" flag if det < 0 private: Int_t fType; //Type of matrix (0=identity, 1=reflection, 2=otherwise) Double_t fTheta; // theta angle Double_t fPhi; // phi angle Double_t fPsi; // psi angle Double_t fMatrix[9]; // Rotation matrix void UpdateAngles();//Method to set angles if constructed with //rotation matrix public: BrRotMatrix(); // BrRotMatrix(const BrRotMatrix&); BrRotMatrix& operator=(const BrRotMatrix&); BrRotMatrix( Double_t *matrix); BrRotMatrix( Double_t theta, Double_t phi, Double_t psi); BrRotMatrix( Double_t theta1, Double_t phi1, Double_t theta2, Double_t phi2, Double_t theta3, Double_t phi3); BrRotMatrix(const BrRotMatrix* mat1, const BrRotMatrix* mat2 ); virtual ~BrRotMatrix(); Double_t Determinant(); // returns the determinant of this matrix const Double_t* GetMatrix() const { return &fMatrix[0];} Double_t* GetMatrix() { return &fMatrix[0];} Int_t GetType() { return fType;} const Double_t GetTheta() const { return fTheta;} const Double_t GetPhi() const { return fPhi;} const Double_t GetPsi() const { return fPsi;} const Bool_t IsReflection() const { return TestBit(kBrReflection);} // Return // kTRUE if this matrix defines the reflection void SetMatrix(const Double_t *matrix); BrRotMatrix GetInverse(); friend BrRotMatrix operator*(BrRotMatrix &r1, BrRotMatrix &r2); // friend ostream& operator<< (ostream & ,BrRotMatrix&); // friend ostream& operator<< (ostream & ,BrRotMatrix*); ClassDef(BrRotMatrix,1) //Rotation Matrix for 3-D geometry objects }; extern BrRotMatrix operator*(const BrRotMatrix &r1, const BrRotMatrix &r2); extern ostream& operator<< (ostream &, const BrRotMatrix&); extern ostream& operator<< (ostream & ,const BrRotMatrix*); #endif // $Log: BrRotMatrix.h,v $ // Revision 1.5 2002/02/26 08:59:08 cholm // Added const'ness to many methods - needed by ISO C++ // // Revision 1.4 2002/02/08 22:43:41 hagel // Added more funcationality for debugging processes as well as GetInverse() // // Revision 1.3 2002/01/16 15:05:01 hagel // Added method to calculate Inverse matrix // // Revision 1.2 2001/11/05 23:42:24 hagel // Added ostream stuff as well as UpdateAngles method to calculate angles from matrix // // Revision 1.1.1.1 2001/06/21 14:55:20 hagel // Initial revision of brat2 // // Revision 1.8 2000/10/10 18:10:15 videbaek // Changed the method name GetRotMatrix to GetMatrix to be symmetric // with SetMatrix and to distinguish from BrCoorDianteSystem->GetRotMatrix // that return a BrRotMatrix. // // Revision 1.7 2000/09/18 21:25:59 videbaek // Modified internal structure of BrDetectorvolume // Associated changes. // // Revision 1.6 2000/07/16 19:46:12 videbaek // Addition for declaring a new rotmatrix by means of two exsisting. // Fixing of errors in inverse matrix fro non-simple rotations, and constructor for // Rotmatrix using Euler angles. All thanks to Trine Tveter. // // Revision 1.5 1999/12/23 15:55:40 videbaek // Added the SetRelativeSystem // Fully debugged. // // Revision 1.4 1999/01/21 23:23:24 hagel // 1. Changed convention for checking includes. Current convention is: // BRAT_Br...... eg BRAT_BrModule ala ROOT. // 2. Added CVS logs to .h files that didn't have them. // 3. Moved checking of include definition to first line for easier reading // 4. Put checks before all includes in the include files as per BRAT specifications // 5. Added BrGeantHeader to Geant Makefile // 6. All changes have been checked to compile on NT ala Cygnus // // Revision 1.3 1998/12/21 20:32:04 videbaek // coordinate system changes mainly // // Revision 1.2 1998/12/08 20:44:08 hagel // Change kReflection to kBrReflection to avoid conflicts with TRotMatrix in TNode // // Revision 1.1 1998/12/01 20:49:58 videbaek // Added several classes to Geometry. Updated source and makefile(s) // - BrLine3D // - BrCoordinateSystem // - BrRotMatrix // //