source: trunk/CLHEP/src/RotationL.cc@ 13

Last change on this file since 13 was 4, checked in by Pavel Demin, 17 years ago

first commit

File size: 1.8 KB
Line 
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
21namespace 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
30double 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
40double HepRotation::distance2( const HepBoost & lt ) const {
41 return distance2( HepLorentzRotation(lt));
42}
43
44double HepRotation::howNear( const HepLorentzRotation & lt ) const {
45 return sqrt( distance2( lt ) );
46}
47
48double HepRotation::howNear( const HepBoost & lt ) const {
49 return sqrt( distance2( lt ) );
50}
51
52bool HepRotation::isNear( const HepLorentzRotation & lt,
53 double epsilon) const {
54 return distance2( lt ) <= epsilon*epsilon;
55}
56
57bool HepRotation::isNear( const HepBoost & lt,
58 double epsilon) const {
59 return distance2( lt ) <= epsilon*epsilon;
60}
61
62} // namespace CLHEP
63
Note: See TracBrowser for help on using the repository browser.