Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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
17
18#include <cmath>
19
20
21namespace CLHEP {
22
23void HepRotation::decompose(HepAxisAngle & rotation, Hep3Vector & boost)const {
24 boost.set(0,0,0);
25 rotation = axisAngle();
26}
27
28void HepRotation::decompose(Hep3Vector & boost, HepAxisAngle & rotation)const {
29 boost.set(0,0,0);
30 rotation = axisAngle();
31}
32
33double HepRotation::distance2( const HepRotation & r ) const {
34 double sum = rxx * r.rxx + rxy * r.rxy + rxz * r.rxz
35 + ryx * r.ryx + ryy * r.ryy + ryz * r.ryz
36 + rzx * r.rzx + rzy * r.rzy + rzz * r.rzz;
37 double answer = 3.0 - sum;
38 return (answer >= 0 ) ? answer : 0;
39}
40
41double HepRotation::howNear( const HepRotation & r ) const {
42 return std::sqrt( distance2( r ) );
43}
44
46 double epsilon) const {
47 return distance2( r ) <= epsilon*epsilon;
48}
49
50double HepRotation::norm2() const {
51 double answer = 3.0 - rxx - ryy - rzz;
52 return (answer >= 0 ) ? answer : 0;
53}
54
55} // namespace CLHEP
void set(double x, double y, double z)
HepAxisAngle axisAngle() const
Definition: RotationA.cc:102
double distance2(const HepRotation &r) const
Definition: RotationP.cc:33
double norm2() const
Definition: RotationP.cc:50
void decompose(HepAxisAngle &rotation, Hep3Vector &boost) const
Definition: RotationP.cc:23
bool isNear(const HepRotation &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationP.cc:45
double howNear(const HepRotation &r) const
Definition: RotationP.cc:41
Definition: DoubConv.h:17