Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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/Rotation.h"
17 
18 #include <cmath>
19 
20 namespace CLHEP {
21 
22 // ---------- distance2 and related member functions:
23 //
24 // WHy do we have forms for HepLorentzRotation and HepBoost but not for
25 // HepBoostX, HepBoostY, HepBoostZ? Because the latter can be gotten by
26 // implicit conversion to HepBoost; but if we just had HepLorentzRotation
27 // then this would involve double conversion when HepBoostX was used.
28 
29 double HepRotation::distance2( const HepLorentzRotation & lt ) const {
30  HepAxisAngle a;
31  Hep3Vector b;
32  lt.decompose(b, a);
33  double bet = b.beta();
34  double bet2 = bet*bet;
35  HepRotation r(a);
36  return bet2/(1-bet2) + distance2(r);
37 }
38 
39 double HepRotation::distance2( const HepBoost & lt ) const {
40  return distance2( HepLorentzRotation(lt));
41 }
42 
43 double HepRotation::howNear( const HepLorentzRotation & lt ) const {
44  return std::sqrt( distance2( lt ) );
45 }
46 
47 double HepRotation::howNear( const HepBoost & lt ) const {
48  return std::sqrt( distance2( lt ) );
49 }
50 
52  double epsilon) const {
53  return distance2( lt ) <= epsilon*epsilon;
54 }
55 
56 bool HepRotation::isNear( const HepBoost & lt,
57  double epsilon) const {
58  return distance2( lt ) <= epsilon*epsilon;
59 }
60 
61 } // namespace CLHEP
62 
bool isNear(const HepRotation &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationP.cc:45
double beta() const
Definition: SpaceVectorP.cc:30
void decompose(Hep3Vector &boost, HepAxisAngle &rotation) const
double howNear(const HepRotation &r) const
Definition: RotationP.cc:41
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33