CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

RotationL.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // ---------------------------------------------------------------------------
3 //
4 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
5 //
6 // This is the implementation of methods of the HepRotation class which
7 // were introduced when ZOOM PhysicsVectors was merged in, which might cause
8 // pulling in of LorentzTransformation related code units.
9 //
10 
11 #ifdef GNUPRAGMA
12 #pragma implementation
13 #endif
14 
15 #include "CLHEP/Vector/defs.h"
16 #include "CLHEP/Vector/Rotation.h"
17 #include "CLHEP/Vector/LorentzRotation.h"
18 
19 #include <cmath>
20 
21 namespace CLHEP {
22 
23 // ---------- distance2 and related member functions:
24 //
25 // WHy do we have forms for HepLorentzRotation and HepBoost but not for
26 // HepBoostX, HepBoostY, HepBoostZ? Because the latter can be gotten by
27 // implicit conversion to HepBoost; but if we just had HepLorentzRotation
28 // then this would involve double conversion when HepBoostX was used.
29 
30 double HepRotation::distance2( const HepLorentzRotation & lt ) const {
31  HepAxisAngle a;
32  Hep3Vector b;
33  lt.decompose(b, a);
34  double bet = b.beta();
35  double bet2 = bet*bet;
36  HepRotation r(a);
37  return bet2/(1-bet2) + distance2(r);
38 }
39 
40 double HepRotation::distance2( const HepBoost & lt ) const {
41  return distance2( HepLorentzRotation(lt));
42 }
43 
44 double HepRotation::howNear( const HepLorentzRotation & lt ) const {
45  return std::sqrt( distance2( lt ) );
46 }
47 
48 double HepRotation::howNear( const HepBoost & lt ) const {
49  return std::sqrt( distance2( lt ) );
50 }
51 
53  double epsilon) const {
54  return distance2( lt ) <= epsilon*epsilon;
55 }
56 
57 bool HepRotation::isNear( const HepBoost & lt,
58  double epsilon) const {
59  return distance2( lt ) <= epsilon*epsilon;
60 }
61 
62 } // namespace CLHEP
63 
double distance2(const HepRotation &r) const
Definition: RotationP.cc:35
void decompose(Hep3Vector &boost, HepAxisAngle &rotation) const
bool isNear(const HepRotation &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationP.cc:47
double beta() const
Definition: SpaceVectorP.cc:32
double howNear(const HepRotation &r) const
Definition: RotationP.cc:43