// $Id: EsafRefSys.hh,v 1.2 2005/04/14 12:35:12 moreggia Exp $ // Author: Alessandro Thea 2005/03/21 /***************************************************************************** * ESAF: Euso Simulation and Analysis Framework * * * * Id: EsafRefSys * * Package: Base * * Coordinator: Marco.Pallavicini, Alessandro.Thea * * * *****************************************************************************/ #ifndef __ESAFREFSYS_HH__ #define __ESAFREFSYS_HH__ #include "euso.hh" #include #include //////////////////////////////////////////////////////////////////////////////// // // // EsafRefSys // // // // Base class for all the objects which have a local coordinate reference // // frame // // // //////////////////////////////////////////////////////////////////////////////// class EsafRefSys { public: EsafRefSys(); virtual ~EsafRefSys(); inline const TVector3& GetPos() const { return fPos; } inline const TVector3& GetXaxis() const { return fXaxis; } inline const TVector3& GetYaxis() const { return fYaxis; } inline const TVector3& GetZaxis() const { return fZaxis; } inline void SetPos( const TVector3& p ) { fPos=p; } inline void SetAxes( const TVector3& x, const TVector3& y, const TVector3& z); inline TVector3 ToLocal( const TVector3& ) const; inline TVector3 ToGlobal( const TVector3& ) const; protected: // EsafRefSys( const TVector3& p, const TVector3& x, const TVector3& y, const TVector3& z ); TVector3 fPos; // position in a reference system to be assigned TVector3 fXaxis; TVector3 fYaxis; TVector3 fZaxis; TRotation fRot; TRotation fInvRot; ClassDef(EsafRefSys,0) }; inline void EsafRefSys::SetAxes( const TVector3& x, const TVector3& y, const TVector3& z) { fXaxis = x; fYaxis = y; fZaxis = z; fRot = fRot.RotateAxes(fXaxis, fYaxis, fZaxis); fInvRot = fRot.Inverse(); } inline TVector3 EsafRefSys::ToLocal( const TVector3& v ) const { TVector3 nv = v; if ( !fInvRot.IsIdentity() ) nv.Transform(fInvRot); return nv; } inline TVector3 EsafRefSys::ToGlobal( const TVector3& v ) const { TVector3 nv = v; if ( !fRot.IsIdentity() ) nv.Transform(fRot); return nv; } #endif /* __ESAFREFSYS_HH__ */