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 |
|
---|
24 | namespace CLHEP {
|
---|
25 |
|
---|
26 | void HepRotation::decompose(HepAxisAngle & rotation, Hep3Vector & boost)const {
|
---|
27 | boost.set(0,0,0);
|
---|
28 | rotation = axisAngle();
|
---|
29 | }
|
---|
30 |
|
---|
31 | void HepRotation::decompose(Hep3Vector & boost, HepAxisAngle & rotation)const {
|
---|
32 | boost.set(0,0,0);
|
---|
33 | rotation = axisAngle();
|
---|
34 | }
|
---|
35 |
|
---|
36 | double HepRotation::distance2( const HepRotation & r ) const {
|
---|
37 | double sum = rxx * r.rxx + rxy * r.rxy + rxz * r.rxz
|
---|
38 | + ryx * r.ryx + ryy * r.ryy + ryz * r.ryz
|
---|
39 | + rzx * r.rzx + rzy * r.rzy + rzz * r.rzz;
|
---|
40 | double answer = 3.0 - sum;
|
---|
41 | return (answer >= 0 ) ? answer : 0;
|
---|
42 | }
|
---|
43 |
|
---|
44 | double HepRotation::howNear( const HepRotation & r ) const {
|
---|
45 | return sqrt( distance2( r ) );
|
---|
46 | }
|
---|
47 |
|
---|
48 | bool HepRotation::isNear( const HepRotation & r,
|
---|
49 | double epsilon) const {
|
---|
50 | return distance2( r ) <= epsilon*epsilon;
|
---|
51 | }
|
---|
52 |
|
---|
53 | double HepRotation::norm2() const {
|
---|
54 | double answer = 3.0 - rxx - ryy - rzz;
|
---|
55 | return (answer >= 0 ) ? answer : 0;
|
---|
56 | }
|
---|
57 |
|
---|
58 | } // namespace CLHEP
|
---|