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

RotationP.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, other than those
8 // involving Euler or axis/angle representations, lengthy corrections of
9 // the rotation matrix, or I/O.
10 //
11 
12 #ifdef GNUPRAGMA
13 #pragma implementation
14 #endif
15 
16 #include "CLHEP/Vector/defs.h"
17 #include "CLHEP/Vector/Rotation.h"
18 
19 #include <cmath>
20 
21 
22 
23 namespace CLHEP {
24 
25 void HepRotation::decompose(HepAxisAngle & rotation, Hep3Vector & boost)const {
26  boost.set(0,0,0);
27  rotation = axisAngle();
28 }
29 
30 void HepRotation::decompose(Hep3Vector & boost, HepAxisAngle & rotation)const {
31  boost.set(0,0,0);
32  rotation = axisAngle();
33 }
34 
35 double HepRotation::distance2( const HepRotation & r ) const {
36  double sum = rxx * r.rxx + rxy * r.rxy + rxz * r.rxz
37  + ryx * r.ryx + ryy * r.ryy + ryz * r.ryz
38  + rzx * r.rzx + rzy * r.rzy + rzz * r.rzz;
39  double answer = 3.0 - sum;
40  return (answer >= 0 ) ? answer : 0;
41 }
42 
43 double HepRotation::howNear( const HepRotation & r ) const {
44  return std::sqrt( distance2( r ) );
45 }
46 
48  double epsilon) const {
49  return distance2( r ) <= epsilon*epsilon;
50 }
51 
52 double HepRotation::norm2() const {
53  double answer = 3.0 - rxx - ryy - rzz;
54  return (answer >= 0 ) ? answer : 0;
55 }
56 
57 } // namespace CLHEP
HepAxisAngle axisAngle() const
Definition: RotationA.cc:105
void set(double x, double y, double z)
void decompose(HepAxisAngle &rotation, Hep3Vector &boost) const
Definition: RotationP.cc:25
double distance2(const HepRotation &r) const
Definition: RotationP.cc:35
double norm2() const
Definition: RotationP.cc:52
bool isNear(const HepRotation &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationP.cc:47
double howNear(const HepRotation &r) const
Definition: RotationP.cc:43