00001
00002
00003
00004
00005
00006
00007
00008
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
00023
00024
00025
00026
00027
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 }
00062