RotationL.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // ---------------------------------------------------------------------------
00003 //
00004 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
00005 //
00006 // This is the implementation of methods of the HepRotation class which
00007 // were introduced when ZOOM PhysicsVectors was merged in, which might cause 
00008 // pulling in of LorentzTransformation related code units.
00009 //
00010 
00011 #ifdef GNUPRAGMA
00012 #pragma implementation
00013 #endif
00014 
00015 #include "CLHEP/Vector/Rotation.h"
00016 #include "CLHEP/Vector/LorentzRotation.h"
00017 
00018 #include <cmath>
00019 
00020 namespace CLHEP  {
00021 
00022 // ----------  distance2 and related member functions:
00023 //
00024 // WHy do we have forms for HepLorentzRotation and HepBoost but not for 
00025 // HepBoostX, HepBoostY, HepBoostZ?  Because the latter can be gotten by 
00026 // implicit conversion to HepBoost; but if we just had HepLorentzRotation 
00027 // then this would involve double conversion when HepBoostX was used.
00028 
00029 double HepRotation::distance2( const HepLorentzRotation & lt  ) const {
00030   HepAxisAngle a; 
00031   Hep3Vector   b;
00032   lt.decompose(b, a);
00033   double bet = b.beta();
00034   double bet2 = bet*bet;
00035   HepRotation r(a);
00036   return bet2/(1-bet2) + distance2(r);
00037 }
00038 
00039 double HepRotation::distance2( const HepBoost & lt ) const {
00040   return distance2( HepLorentzRotation(lt));
00041 }
00042 
00043 double HepRotation::howNear( const HepLorentzRotation & lt  ) const {
00044   return  std::sqrt( distance2( lt ) );
00045 }
00046 
00047 double HepRotation::howNear( const HepBoost & lt  ) const {
00048   return  std::sqrt( distance2( lt ) );
00049 }
00050 
00051 bool HepRotation::isNear(   const HepLorentzRotation & lt,
00052                                      double epsilon) const {
00053  return  distance2( lt ) <= epsilon*epsilon;
00054 }
00055 
00056 bool HepRotation::isNear(   const HepBoost & lt,
00057                                      double epsilon) const {
00058  return  distance2( lt ) <= epsilon*epsilon;
00059 }
00060 
00061 }  // namespace CLHEP
00062 

Generated on Mon May 27 17:50:34 2013 for Geant4 by  doxygen 1.4.7