]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/CLHEP/Vector/Rotation.h
2fc636c34dd2e6ac7de95e660d58355a059e6ae1
[u/mrichter/AliRoot.git] / PHOS / CLHEP / Vector / Rotation.h
1 // -*- C++ -*-
2 // CLASSDOC OFF
3 // $Id$
4 // ---------------------------------------------------------------------------
5 // CLASSDOC ON
6 //
7 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
8 //
9 // This is the definition of the HepRotation class for performing rotations
10 // on objects of the Hep3Vector class.
11 //
12 // .SS See Also
13 // ThreeVector.h, LorentzVector.h, LorentzRotation.h
14 //
15 // .SS Author
16 // Leif Lonnblad
17
18 #ifndef HEP_ROTATION_H
19 #define HEP_ROTATION_H
20
21 #ifdef GNUPRAGMA
22 #pragma interface
23 #endif
24
25 #include "CLHEP/config/CLHEP.h"
26 #include "CLHEP/Vector/ThreeVector.h"
27
28 #ifdef HEP_NO_INLINE_IN_DECLARATION
29 #define inline
30 #endif
31
32 class HepRotation {
33
34 public:
35
36   inline HepRotation();
37   // Default constructor. Gives a unit matrix.
38
39   inline HepRotation(const HepRotation &);
40   // Copy constructor.
41
42   inline HepDouble xx() const;
43   inline HepDouble xy() const;
44   inline HepDouble xz() const;
45   inline HepDouble yx() const;
46   inline HepDouble yy() const;
47   inline HepDouble yz() const;
48   inline HepDouble zx() const;
49   inline HepDouble zy() const;
50   inline HepDouble zz() const;
51   // Elements of the rotation matrix (Geant4).
52
53   HepDouble operator () (int, int) const;
54   // Returns (i,j) element of the rotation matrix.
55
56   inline HepRotation & operator = (const HepRotation &);
57   // Assignment.
58
59   inline HepBoolean operator == (const HepRotation &) const;
60   inline HepBoolean operator != (const HepRotation &) const;
61   // Comparisons (Geant4).
62
63   inline HepBoolean isIdentity() const;
64   // Returns true if the identity matrix (Geant4).
65
66   inline Hep3Vector operator * (const Hep3Vector &) const;
67   // Multiplication with a Hep3Vector.
68
69   HepRotation operator * (const HepRotation &) const;
70   inline HepRotation & operator *= (const HepRotation &);
71   inline HepRotation & transform(const HepRotation &);
72   // Matrix multiplication.
73   // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a;
74
75   inline HepRotation inverse() const;
76   // Returns the inverse.
77
78   inline HepRotation & invert();
79   // Inverts the Rotation matrix.
80
81   HepRotation & rotateX(HepDouble);
82   // Rotation around the x-axis.
83
84   HepRotation & rotateY(HepDouble);
85   // Rotation around the y-axis.
86
87   HepRotation & rotateZ(HepDouble);
88   // Rotation around the z-axis.
89
90   HepRotation & rotate(HepDouble, const Hep3Vector &);
91   inline HepRotation & rotate(HepDouble, const Hep3Vector *);
92   // Rotation around a specified vector.
93
94   HepRotation & rotateAxes(const Hep3Vector & newX,
95                            const Hep3Vector & newY,
96                            const Hep3Vector & newZ);
97   // Rotation of local axes (Geant4).
98
99   HepDouble phiX() const;
100   HepDouble phiY() const;
101   HepDouble phiZ() const;
102   HepDouble thetaX() const;
103   HepDouble thetaY() const;
104   HepDouble thetaZ() const;
105   // Return angles (RADS) made by rotated axes against original axes (Geant4).
106
107   void getAngleAxis(HepDouble &, Hep3Vector &) const;
108   // Returns the rotation angle and rotation axis (Geant4).
109
110 protected:
111
112   inline HepRotation(HepDouble, HepDouble, HepDouble, HepDouble, HepDouble,
113                      HepDouble, HepDouble, HepDouble, HepDouble);
114   // Protected constructor.
115
116   HepDouble rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz;
117   // The matrix elements.
118 };
119
120 #ifdef HEP_NO_INLINE_IN_DECLARATION
121 #undef inline
122 #endif
123
124 #ifdef HEP_SHORT_NAMES
125 typedef HepRotation Rotation;
126 #endif
127
128 #ifndef HEP_DEBUG_INLINE
129 #include "CLHEP/Vector/Rotation.icc"
130 #endif
131
132 #endif /* HEP_ROTATION_H */
133