CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
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#include "CLHEP/Vector/defs.h"
13#include "CLHEP/Vector/Rotation.h"
14
15#include <cmath>
16
17
18
19namespace CLHEP {
20
21void HepRotation::decompose(HepAxisAngle & rotation, Hep3Vector & boost)const {
22 boost.set(0,0,0);
23 rotation = axisAngle();
24}
25
26void HepRotation::decompose(Hep3Vector & boost, HepAxisAngle & rotation)const {
27 boost.set(0,0,0);
28 rotation = axisAngle();
29}
30
31double HepRotation::distance2( const HepRotation & r ) const {
32 double sum = rxx * r.rxx + rxy * r.rxy + rxz * r.rxz
33 + ryx * r.ryx + ryy * r.ryy + ryz * r.ryz
34 + rzx * r.rzx + rzy * r.rzy + rzz * r.rzz;
35 double answer = 3.0 - sum;
36 return (answer >= 0 ) ? answer : 0;
37}
38
39double HepRotation::howNear( const HepRotation & r ) const {
40 return std::sqrt( distance2( r ) );
41}
42
44 double epsilon) const {
45 return distance2( r ) <= epsilon*epsilon;
46}
47
48double HepRotation::norm2() const {
49 double answer = 3.0 - rxx - ryy - rzz;
50 return (answer >= 0 ) ? answer : 0;
51}
52
53} // namespace CLHEP
void set(double x, double y, double z)
HepAxisAngle axisAngle() const
Definition: RotationA.cc:121
double distance2(const HepRotation &r) const
Definition: RotationP.cc:31
double norm2() const
Definition: RotationP.cc:48
void decompose(HepAxisAngle &rotation, Hep3Vector &boost) const
Definition: RotationP.cc:21
bool isNear(const HepRotation &r, double epsilon=Hep4RotationInterface::tolerance) const
Definition: RotationP.cc:43
double howNear(const HepRotation &r) const
Definition: RotationP.cc:39