Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/clhep/include/CLHEP/Vector/Rotation.h

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/clhep/include/CLHEP/Vector/Rotation.h (Version 11.3.0) and /externals/clhep/include/CLHEP/Vector/Rotation.h (Version 10.3.p3)


  1 // -*- C++ -*-                                      1 // -*- C++ -*-
  2 // CLASSDOC OFF                                     2 // CLASSDOC OFF
                                                   >>   3 // $Id:$
  3 // -------------------------------------------      4 // ---------------------------------------------------------------------------
  4 // CLASSDOC ON                                      5 // CLASSDOC ON
  5 //                                                  6 //
  6 // This file is a part of the CLHEP - a Class       7 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
  7 //                                                  8 //
  8 // This is the definition of the HepRotation c      9 // This is the definition of the HepRotation class for performing rotations
  9 // on objects of the Hep3Vector (and HepLorent     10 // on objects of the Hep3Vector (and HepLorentzVector) class.
 10 //                                                 11 //
 11 // HepRotation is a concrete implementation of     12 // HepRotation is a concrete implementation of Hep3RotationInterface.
 12 //                                                 13 //
 13 // .SS See Also                                    14 // .SS See Also
 14 // RotationInterfaces.h                            15 // RotationInterfaces.h
 15 // ThreeVector.h, LorentzVector.h, LorentzRota     16 // ThreeVector.h, LorentzVector.h, LorentzRotation.h
 16 //                                                 17 //
 17 // .SS Author                                      18 // .SS Author
 18 // Leif Lonnblad, Mark Fischler                    19 // Leif Lonnblad, Mark Fischler
 19                                                    20 
 20 #ifndef HEP_ROTATION_H                             21 #ifndef HEP_ROTATION_H
 21 #define HEP_ROTATION_H                             22 #define HEP_ROTATION_H
 22                                                    23 
                                                   >>  24 #ifdef GNUPRAGMA
                                                   >>  25 #pragma interface
                                                   >>  26 #endif
                                                   >>  27 
 23 #include "CLHEP/Vector/RotationInterfaces.h"       28 #include "CLHEP/Vector/RotationInterfaces.h"
 24 #include "CLHEP/Vector/RotationX.h"                29 #include "CLHEP/Vector/RotationX.h"
 25 #include "CLHEP/Vector/RotationY.h"                30 #include "CLHEP/Vector/RotationY.h"
 26 #include "CLHEP/Vector/RotationZ.h"                31 #include "CLHEP/Vector/RotationZ.h"
 27 #include "CLHEP/Vector/LorentzVector.h"            32 #include "CLHEP/Vector/LorentzVector.h"
 28                                                    33 
 29 namespace CLHEP {                                  34 namespace CLHEP {
 30                                                    35 
 31 // Declarations of classes and global methods      36 // Declarations of classes and global methods
 32 class HepRotation;                                 37 class HepRotation;
 33 inline HepRotation inverseOf ( const HepRotati     38 inline HepRotation inverseOf ( const HepRotation & r );
 34 inline HepRotation operator * (const HepRotati     39 inline HepRotation operator * (const HepRotationX & rx, const HepRotation & r);
 35 inline HepRotation operator * (const HepRotati     40 inline HepRotation operator * (const HepRotationY & ry, const HepRotation & r);
 36 inline HepRotation operator * (const HepRotati     41 inline HepRotation operator * (const HepRotationZ & rz, const HepRotation & r);
 37                                                    42 
 38 /**                                                43 /**
 39  * @author                                         44  * @author
 40  * @ingroup vector                                 45  * @ingroup vector
 41  */                                                46  */
 42 class HepRotation {                                47 class HepRotation {
 43                                                    48 
 44 public:                                            49 public:
 45                                                    50 
 46   // ----------  Constructors and Assignment:      51   // ----------  Constructors and Assignment:
 47                                                    52 
 48   inline HepRotation();                            53   inline HepRotation();
 49   // Default constructor. Gives a unit matrix.     54   // Default constructor. Gives a unit matrix.
 50                                                    55 
 51   inline HepRotation(const HepRotation & m);   <<  56   inline HepRotation(const HepRotation  & m);
 52   inline HepRotation(HepRotation && m) = defau <<  57   // Copy constructor.
 53   // Copy and move constructors.               << 
 54                                                    58 
 55   inline HepRotation(const HepRotationX & m);      59   inline HepRotation(const HepRotationX & m);
 56   inline HepRotation(const HepRotationY & m);      60   inline HepRotation(const HepRotationY & m);
 57   inline HepRotation(const HepRotationZ & m);      61   inline HepRotation(const HepRotationZ & m);
 58   // Construct from specialized rotation.          62   // Construct from specialized rotation.
 59                                                    63 
 60   HepRotation & set( const Hep3Vector & axis,      64   HepRotation & set( const Hep3Vector & axis, double delta );
 61   HepRotation      ( const Hep3Vector & axis,      65   HepRotation      ( const Hep3Vector & axis, double delta );
 62   // Construct from axis and angle.                66   // Construct from axis and angle.
 63                                                    67 
 64   HepRotation & set( const HepAxisAngle & ax )     68   HepRotation & set( const HepAxisAngle & ax );
 65   HepRotation      ( const HepAxisAngle & ax )     69   HepRotation      ( const HepAxisAngle & ax );
 66   // Construct from AxisAngle structure.           70   // Construct from AxisAngle structure.
 67                                                    71 
 68   HepRotation & set( double phi, double theta,     72   HepRotation & set( double phi, double theta, double psi );
 69   HepRotation      ( double phi, double theta,     73   HepRotation      ( double phi, double theta, double psi );
 70   // Construct from three Euler angles (in rad     74   // Construct from three Euler angles (in radians).
 71                                                    75 
 72   HepRotation & set( const HepEulerAngles & e      76   HepRotation & set( const HepEulerAngles & e );
 73   HepRotation      ( const HepEulerAngles & e      77   HepRotation      ( const HepEulerAngles & e );
 74   // Construct from EulerAngles structure.         78   // Construct from EulerAngles structure.
 75                                                    79 
 76   HepRotation ( const Hep3Vector & colX,           80   HepRotation ( const Hep3Vector & colX,
 77                 const Hep3Vector & colY,           81                 const Hep3Vector & colY,
 78                 const Hep3Vector & colZ );         82                 const Hep3Vector & colZ );
 79   // Construct from three *orthogonal* unit ve     83   // Construct from three *orthogonal* unit vector columns.
 80     // NOTE:                                       84     // NOTE:  
 81     //       This constructor, and the two set     85     //       This constructor, and the two set methods below, 
 82   //   will check that the columns (or rows) f     86   //   will check that the columns (or rows) form an orthonormal 
 83   //   matrix, and will adjust values so that      87   //   matrix, and will adjust values so that this relation is 
 84   //   as exact as possible.                       88   //   as exact as possible.
 85                                                    89 
 86   HepRotation & set( const Hep3Vector & colX,      90   HepRotation & set( const Hep3Vector & colX,
 87                              const Hep3Vector      91                              const Hep3Vector & colY,
 88                              const Hep3Vector      92                              const Hep3Vector & colZ );
 89   //   supply three *orthogonal* unit vectors      93   //   supply three *orthogonal* unit vectors for the columns.
 90                                                    94 
 91   HepRotation & setRows( const Hep3Vector & ro     95   HepRotation & setRows( const Hep3Vector & rowX,
 92                                  const Hep3Vec     96                                  const Hep3Vector & rowY,
 93                                  const Hep3Vec     97                                  const Hep3Vector & rowZ );
 94   //   supply three *orthogonal* unit vectors      98   //   supply three *orthogonal* unit vectors for the rows.
 95                                                    99 
 96   inline HepRotation & set(const HepRotationX     100   inline HepRotation & set(const HepRotationX & r);
 97   inline HepRotation & set(const HepRotationY     101   inline HepRotation & set(const HepRotationY & r);
 98   inline HepRotation & set(const HepRotationZ     102   inline HepRotation & set(const HepRotationZ & r);
 99   // set from specialized rotation.               103   // set from specialized rotation.
100                                                   104 
101   inline  HepRotation & operator = (const HepR    105   inline  HepRotation & operator = (const HepRotation & r);
102   inline  HepRotation & operator = (HepRotatio << 106   // Assignment.
103   // Copy and move assignment operators.       << 
104                                                   107 
105   inline  HepRotation & operator = (const HepR    108   inline  HepRotation & operator = (const HepRotationX & r);
106   inline  HepRotation & operator = (const HepR    109   inline  HepRotation & operator = (const HepRotationY & r);
107   inline  HepRotation & operator = (const HepR    110   inline  HepRotation & operator = (const HepRotationZ & r);
108   // Assignment from specialized rotation.        111   // Assignment from specialized rotation.
109                                                   112 
110   inline HepRotation &set( const HepRep3x3 & m    113   inline HepRotation &set( const HepRep3x3 & m );
111   inline HepRotation     ( const HepRep3x3 & m    114   inline HepRotation     ( const HepRep3x3 & m );
112   // WARNING - NO CHECKING IS DONE!               115   // WARNING - NO CHECKING IS DONE!
113   // Constructon directly from from a 3x3 repr    116   // Constructon directly from from a 3x3 representation,
114   // which is required to be an orthogonal mat    117   // which is required to be an orthogonal matrix.
115                                                   118 
116   inline ~HepRotation();                          119   inline ~HepRotation();
117   // Trivial destructor.                          120   // Trivial destructor.
118                                                   121 
119   // ----------  Accessors:                       122   // ----------  Accessors:
120                                                   123 
121   inline Hep3Vector colX() const;                 124   inline Hep3Vector colX() const;
122   inline Hep3Vector colY() const;                 125   inline Hep3Vector colY() const;
123   inline Hep3Vector colZ() const;                 126   inline Hep3Vector colZ() const;
124   // orthogonal unit-length column vectors        127   // orthogonal unit-length column vectors
125                                                   128 
126   inline Hep3Vector rowX() const;                 129   inline Hep3Vector rowX() const;
127   inline Hep3Vector rowY() const;                 130   inline Hep3Vector rowY() const;
128   inline Hep3Vector rowZ() const;                 131   inline Hep3Vector rowZ() const;
129   // orthogonal unit-length row vectors           132   // orthogonal unit-length row vectors
130                                                   133                                 
131   inline double xx() const;                       134   inline double xx() const;
132   inline double xy() const;                       135   inline double xy() const;
133   inline double xz() const;                       136   inline double xz() const;
134   inline double yx() const;                       137   inline double yx() const;
135   inline double yy() const;                       138   inline double yy() const;
136   inline double yz() const;                       139   inline double yz() const;
137   inline double zx() const;                       140   inline double zx() const;
138   inline double zy() const;                       141   inline double zy() const;
139   inline double zz() const;                       142   inline double zz() const;
140   // Elements of the rotation matrix (Geant4).    143   // Elements of the rotation matrix (Geant4).
141                                                   144 
142   inline HepRep3x3 rep3x3() const;                145   inline HepRep3x3 rep3x3() const;
143   //   3x3 representation:                        146   //   3x3 representation:
144                                                   147 
145   // ------------  Subscripting:                  148   // ------------  Subscripting:
146                                                   149 
147   class HepRotation_row {                         150   class HepRotation_row {
148   public:                                         151   public:
149     inline HepRotation_row(const HepRotation &    152     inline HepRotation_row(const HepRotation &, int);
150     inline double operator [] (int) const;        153     inline double operator [] (int) const;
151   private:                                        154   private:
152     const HepRotation & rr;                       155     const HepRotation & rr;
153     int ii;                                       156     int ii;
154   };                                              157   };
155   // Helper class for implemention of C-style     158   // Helper class for implemention of C-style subscripting r[i][j] 
156                                                   159 
157   inline const HepRotation_row operator [] (in    160   inline const HepRotation_row operator [] (int) const; 
158   // Returns object of the helper class for C-    161   // Returns object of the helper class for C-style subscripting r[i][j]
159   // i and j range from 0 to 2.                   162   // i and j range from 0 to 2.  
160                                                   163 
161   double operator () (int, int) const;            164   double operator () (int, int) const;
162   // Fortran-style subscripting: returns (i,j)    165   // Fortran-style subscripting: returns (i,j) element of the rotation matrix.
163   // Note:  i and j still range from 0 to 2.      166   // Note:  i and j still range from 0 to 2.      [Rotation.cc]
164                                                   167 
165   // ------------  Euler angles:                  168   // ------------  Euler angles:
166   inline  double getPhi  () const;                169   inline  double getPhi  () const;
167   inline  double getTheta() const;                170   inline  double getTheta() const;
168   inline  double getPsi  () const;                171   inline  double getPsi  () const;
169   double    phi  () const;                        172   double    phi  () const;
170   double    theta() const;                        173   double    theta() const;
171   double    psi  () const;                        174   double    psi  () const;
172   HepEulerAngles eulerAngles() const;             175   HepEulerAngles eulerAngles() const;
173                                                   176 
174   // ------------  axis & angle of rotation:      177   // ------------  axis & angle of rotation:
175   inline  double  getDelta() const;               178   inline  double  getDelta() const;
176   inline  Hep3Vector getAxis () const;            179   inline  Hep3Vector getAxis () const;
177   double     delta() const;                       180   double     delta() const;
178   Hep3Vector    axis () const;                    181   Hep3Vector    axis () const;
179   HepAxisAngle  axisAngle() const;                182   HepAxisAngle  axisAngle() const;
180   void getAngleAxis(double & delta, Hep3Vector    183   void getAngleAxis(double & delta, Hep3Vector & axis) const;
181   // Returns the rotation angle and rotation a    184   // Returns the rotation angle and rotation axis (Geant4).   [Rotation.cc]
182                                                   185 
183   // ------------- Angles of rotated axes         186   // ------------- Angles of rotated axes
184   double phiX() const;                            187   double phiX() const;
185   double phiY() const;                            188   double phiY() const;
186   double phiZ() const;                            189   double phiZ() const;
187   double thetaX() const;                          190   double thetaX() const;
188   double thetaY() const;                          191   double thetaY() const;
189   double thetaZ() const;                          192   double thetaZ() const;
190   // Return angles (RADS) made by rotated axes    193   // Return angles (RADS) made by rotated axes against original axes (Geant4).
191   //                [Rotation.cc]                 194   //                [Rotation.cc]
192                                                   195 
193   // ----------  Other accessors treating pure    196   // ----------  Other accessors treating pure rotation as a 4-rotation
194                                                   197 
195   inline HepLorentzVector col1() const;           198   inline HepLorentzVector col1() const;
196   inline HepLorentzVector col2() const;           199   inline HepLorentzVector col2() const;
197   inline HepLorentzVector col3() const;           200   inline HepLorentzVector col3() const;
198   //  orthosymplectic 4-vector columns - T com    201   //  orthosymplectic 4-vector columns - T component will be zero
199                                                   202 
200   inline HepLorentzVector col4() const;           203   inline HepLorentzVector col4() const;
201   // Will be (0,0,0,1) for this pure Rotation.    204   // Will be (0,0,0,1) for this pure Rotation.
202                                                   205 
203   inline HepLorentzVector row1() const;           206   inline HepLorentzVector row1() const;
204   inline HepLorentzVector row2() const;           207   inline HepLorentzVector row2() const;
205   inline HepLorentzVector row3() const;           208   inline HepLorentzVector row3() const;
206   //  orthosymplectic 4-vector rows - T compon    209   //  orthosymplectic 4-vector rows - T component will be zero
207                                                   210 
208   inline HepLorentzVector row4() const;           211   inline HepLorentzVector row4() const;
209   // Will be (0,0,0,1) for this pure Rotation.    212   // Will be (0,0,0,1) for this pure Rotation.
210                                                   213 
211   inline double xt() const;                       214   inline double xt() const;
212   inline double yt() const;                       215   inline double yt() const;
213   inline double zt() const;                       216   inline double zt() const;
214   inline double tx() const;                       217   inline double tx() const;
215   inline double ty() const;                       218   inline double ty() const;
216   inline double tz() const;                       219   inline double tz() const;
217   // Will be zero for this pure Rotation          220   // Will be zero for this pure Rotation
218                                                   221 
219   inline double tt() const;                       222   inline double tt() const;
220   // Will be one for this pure Rotation           223   // Will be one for this pure Rotation
221                                                   224 
222   inline HepRep4x4 rep4x4() const;                225   inline HepRep4x4 rep4x4() const;
223   //   4x4 representation.                        226   //   4x4 representation.
224                                                   227 
225   // ---------   Mutators                         228   // ---------   Mutators 
226                                                   229 
227   void setPhi (double phi);                       230   void setPhi (double phi);
228   // change Euler angle phi, leaving theta and    231   // change Euler angle phi, leaving theta and psi unchanged.
229                                                   232 
230   void setTheta (double theta);                   233   void setTheta (double theta);
231   // change Euler angle theta, leaving phi and    234   // change Euler angle theta, leaving phi and psi unchanged.
232                                                   235 
233   void setPsi (double psi);                       236   void setPsi (double psi);
234   // change Euler angle psi, leaving theta and    237   // change Euler angle psi, leaving theta and phi unchanged.
235                                                   238 
236   void setAxis (const Hep3Vector & axis);         239   void setAxis (const Hep3Vector & axis);
237   // change rotation axis, leaving delta uncha    240   // change rotation axis, leaving delta unchanged.
238                                                   241 
239   void setDelta (double delta);                   242   void setDelta (double delta);
240   // change angle of rotation, leaving rotatio    243   // change angle of rotation, leaving rotation axis unchanged.
241                                                   244 
242   // ----------  Decomposition:                   245   // ----------  Decomposition:
243                                                   246 
244   void decompose (HepAxisAngle & rotation, Hep    247   void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
245   void decompose (Hep3Vector & boost, HepAxisA    248   void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
246   // These are trivial, as the boost vector is    249   // These are trivial, as the boost vector is 0.   [RotationP.cc]
247                                                   250 
248   // ----------  Comparisons:                     251   // ----------  Comparisons: 
249                                                   252   
250   bool isIdentity() const;                        253   bool isIdentity() const;        
251   // Returns true if the identity matrix (Gean    254   // Returns true if the identity matrix (Geant4).    [Rotation.cc] 
252                                                   255 
253   int compare( const HepRotation & r  ) const;    256   int compare( const HepRotation & r  ) const;
254   // Dictionary-order comparison, in order zz,    257   // Dictionary-order comparison, in order zz, zy, zx, yz, ... xx
255   // Used in operator<, >, <=, >=                 258   // Used in operator<, >, <=, >= 
256                                                   259 
257   inline bool operator== ( const HepRotation &    260   inline bool operator== ( const HepRotation & r ) const;
258   inline bool operator!= ( const HepRotation &    261   inline bool operator!= ( const HepRotation & r ) const;
259   inline bool operator<  ( const HepRotation &    262   inline bool operator<  ( const HepRotation & r ) const;
260   inline bool operator>  ( const HepRotation &    263   inline bool operator>  ( const HepRotation & r ) const;
261   inline bool operator<= ( const HepRotation &    264   inline bool operator<= ( const HepRotation & r ) const;
262   inline bool operator>= ( const HepRotation &    265   inline bool operator>= ( const HepRotation & r ) const;
263                                                   266   
264   double distance2( const HepRotation &  r  )     267   double distance2( const HepRotation &  r  ) const; 
265   // 3 - Tr ( this/r ) -- This works with Rota    268   // 3 - Tr ( this/r ) -- This works with RotationX, Y or Z also
266                                                   269 
267   double howNear( const HepRotation & r ) cons    270   double howNear( const HepRotation & r ) const;
268   bool isNear( const HepRotation & r,             271   bool isNear( const HepRotation & r,
269              double epsilon=Hep4RotationInterf    272              double epsilon=Hep4RotationInterface::tolerance) const;
270                                                   273 
271   double distance2( const HepBoost           &    274   double distance2( const HepBoost           & lt  ) const; 
272   // 3 - Tr ( this ) + |b|^2 / (1-|b|^2)          275   // 3 - Tr ( this ) + |b|^2 / (1-|b|^2) 
273   double distance2( const HepLorentzRotation &    276   double distance2( const HepLorentzRotation & lt  ) const; 
274   // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) whe    277   // 3 - Tr ( this/r ) + |b|^2 / (1-|b|^2) where b is the boost vector of lt
275                                                   278 
276   double howNear( const HepBoost           & l    279   double howNear( const HepBoost           & lt ) const;
277   double howNear( const HepLorentzRotation & l    280   double howNear( const HepLorentzRotation & lt ) const;
278   bool isNear( const HepBoost           & lt,     281   bool isNear( const HepBoost           & lt, 
279              double epsilon=Hep4RotationInterf    282              double epsilon=Hep4RotationInterface::tolerance) const;
280   bool isNear( const HepLorentzRotation & lt,     283   bool isNear( const HepLorentzRotation & lt,
281              double epsilon=Hep4RotationInterf    284              double epsilon=Hep4RotationInterface::tolerance) const;
282                                                   285 
283   // ----------  Properties:                      286   // ----------  Properties:
284                                                   287 
285   double norm2() const;                           288   double norm2() const; 
286   // distance2 (IDENTITY), which is 3 - Tr ( *    289   // distance2 (IDENTITY), which is 3 - Tr ( *this )
287                                                   290 
288   void rectify();                                 291   void rectify();
289   // non-const but logically moot correction f    292   // non-const but logically moot correction for accumulated roundoff errors
290   // rectify averages the matrix with the tran    293   // rectify averages the matrix with the transpose of its actual
291   // inverse (absent accumulated roundoff erro    294   // inverse (absent accumulated roundoff errors, the transpose IS
292   // the inverse)); this removes to first orde    295   // the inverse)); this removes to first order those errors.
293   // Then it formally extracts axis and delta,    296   // Then it formally extracts axis and delta, and forms a true
294   // HepRotation with those values of axis and    297   // HepRotation with those values of axis and delta.
295                                                   298 
296   // ---------- Application:                      299   // ---------- Application:
297                                                   300 
298   inline Hep3Vector operator() (const Hep3Vect    301   inline Hep3Vector operator() (const Hep3Vector & p) const;
299   // Rotate a Hep3Vector.                         302   // Rotate a Hep3Vector.         
300                                                   303 
301   inline  Hep3Vector operator * (const Hep3Vec    304   inline  Hep3Vector operator * (const Hep3Vector & p) const;
302   // Multiplication with a Hep3Vector.            305   // Multiplication with a Hep3Vector.
303                                                   306 
304   inline HepLorentzVector operator()( const He    307   inline HepLorentzVector operator()( const HepLorentzVector & w ) const;
305   // Rotate (the space part of) a HepLorentzVe    308   // Rotate (the space part of) a HepLorentzVector.   
306                                                   309 
307   inline  HepLorentzVector operator* ( const H    310   inline  HepLorentzVector operator* ( const HepLorentzVector & w ) const;
308   // Multiplication with a HepLorentzVector.      311   // Multiplication with a HepLorentzVector.
309                                                   312 
310   // ---------- Operations in the group of Rot    313   // ---------- Operations in the group of Rotations
311                                                   314 
312   inline HepRotation operator * (const HepRota    315   inline HepRotation operator * (const HepRotation & r) const;
313   // Product of two rotations (this) * r - mat    316   // Product of two rotations (this) * r - matrix multiplication  
314                                                   317 
315   inline HepRotation operator * (const HepRota    318   inline HepRotation operator * (const HepRotationX & rx) const; 
316   inline HepRotation operator * (const HepRota    319   inline HepRotation operator * (const HepRotationY & ry) const;
317   inline HepRotation operator * (const HepRota    320   inline HepRotation operator * (const HepRotationZ & rz) const;
318   // Product of two rotations (this) * r - fas    321   // Product of two rotations (this) * r - faster when specialized type 
319                                                   322 
320   inline  HepRotation & operator *= (const Hep    323   inline  HepRotation & operator *= (const HepRotation & r);
321   inline  HepRotation & transform   (const Hep    324   inline  HepRotation & transform   (const HepRotation & r);
322   // Matrix multiplication.                       325   // Matrix multiplication.
323   // Note a *= b; <=> a = a * b; while a.trans    326   // Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a;
324                                                   327 
325   inline  HepRotation & operator *= (const Hep    328   inline  HepRotation & operator *= (const HepRotationX & r);
326   inline  HepRotation & operator *= (const Hep    329   inline  HepRotation & operator *= (const HepRotationY & r);
327   inline  HepRotation & operator *= (const Hep    330   inline  HepRotation & operator *= (const HepRotationZ & r);
328   inline  HepRotation & transform   (const Hep    331   inline  HepRotation & transform   (const HepRotationX & r);
329   inline  HepRotation & transform   (const Hep    332   inline  HepRotation & transform   (const HepRotationY & r);
330   inline  HepRotation & transform   (const Hep    333   inline  HepRotation & transform   (const HepRotationZ & r);
331   // Matrix multiplication by specialized matr    334   // Matrix multiplication by specialized matrices
332                                                   335 
333   HepRotation & rotateX(double delta);            336   HepRotation & rotateX(double delta);
334   // Rotation around the x-axis; equivalent to    337   // Rotation around the x-axis; equivalent to R = RotationX(delta) * R
335                                                   338 
336   HepRotation & rotateY(double delta);            339   HepRotation & rotateY(double delta);
337   // Rotation around the y-axis; equivalent to    340   // Rotation around the y-axis; equivalent to R = RotationY(delta) * R
338                                                   341 
339   HepRotation & rotateZ(double delta);            342   HepRotation & rotateZ(double delta);
340   // Rotation around the z-axis; equivalent to    343   // Rotation around the z-axis; equivalent to R = RotationZ(delta) * R
341                                                   344 
342          HepRotation & rotate(double delta, co    345          HepRotation & rotate(double delta, const Hep3Vector & axis);
343   inline HepRotation & rotate(double delta, co    346   inline HepRotation & rotate(double delta, const Hep3Vector * axis);
344   // Rotation around a specified vector.          347   // Rotation around a specified vector.  
345   // r.rotate(d,a) is equivalent to r = Rotati    348   // r.rotate(d,a) is equivalent to r = Rotation(d,a) * r
346                                                   349 
347   HepRotation & rotateAxes(const Hep3Vector &     350   HepRotation & rotateAxes(const Hep3Vector & newX,
348                            const Hep3Vector &     351                            const Hep3Vector & newY,
349                            const Hep3Vector &     352                            const Hep3Vector & newZ);
350   // Rotation of local axes defined by 3 ortho    353   // Rotation of local axes defined by 3 orthonormal vectors (Geant4).
351   // Equivalent to r = Rotation (newX, newY, n    354   // Equivalent to r = Rotation (newX, newY, newZ) * r
352                                                   355 
353   inline HepRotation inverse() const;             356   inline HepRotation inverse() const;
354   // Returns the inverse.                         357   // Returns the inverse.
355                                                   358 
356   inline HepRotation & invert();                  359   inline HepRotation & invert();
357   // Inverts the Rotation matrix.                 360   // Inverts the Rotation matrix.
358                                                   361 
359   // ---------- I/O:                              362   // ---------- I/O: 
360                                                   363 
361   std::ostream & print( std::ostream & os ) co    364   std::ostream & print( std::ostream & os ) const;
362   // Aligned six-digit-accurate output of the     365   // Aligned six-digit-accurate output of the  rotation matrix. [RotationIO.cc]
363                                                   366 
364   // ---------- Identity Rotation:                367   // ---------- Identity Rotation:
365                                                   368 
366   DLL_API static const HepRotation IDENTITY;      369   DLL_API static const HepRotation IDENTITY;
367                                                   370 
368   // ---------- Tolerance                         371   // ---------- Tolerance
369                                                   372 
370   static inline double getTolerance();            373   static inline double getTolerance();
371   static inline double setTolerance(double tol    374   static inline double setTolerance(double tol); 
372                                                   375 
373 protected:                                        376 protected:
374                                                   377 
375   inline HepRotation(double mxx, double mxy, d    378   inline HepRotation(double mxx, double mxy, double mxz, 
376          double myx, double myy, double myz,      379          double myx, double myy, double myz,
377          double mzx, double mzy, double mzz);     380          double mzx, double mzy, double mzz);
378   // Protected constructor.                       381   // Protected constructor.  
379   // DOES NOT CHECK FOR VALIDITY AS A ROTATION    382   // DOES NOT CHECK FOR VALIDITY AS A ROTATION.
380                                                   383 
381   friend HepRotation operator* (const HepRotat    384   friend HepRotation operator* (const HepRotationX & rx, const HepRotation & r);
382   friend HepRotation operator* (const HepRotat    385   friend HepRotation operator* (const HepRotationY & ry, const HepRotation & r);
383   friend HepRotation operator* (const HepRotat    386   friend HepRotation operator* (const HepRotationZ & rz, const HepRotation & r);
384                                                   387 
385   double rxx, rxy, rxz,                           388   double rxx, rxy, rxz, 
386       ryx, ryy, ryz,                              389       ryx, ryy, ryz, 
387       rzx, rzy, rzz;                              390       rzx, rzy, rzz;
388   // The matrix elements.                         391   // The matrix elements.
389                                                   392 
390 private:                                          393 private:
391   bool                                            394   bool 
392        setCols ( const Hep3Vector & u1, // Vec    395        setCols ( const Hep3Vector & u1, // Vectors assume to be of unit length 
393                  const Hep3Vector & u2,           396                  const Hep3Vector & u2,
394                  const Hep3Vector & u3,           397                  const Hep3Vector & u3,
395                  double u1u2,                     398                  double u1u2,
396                  Hep3Vector & v1,   // Returne    399                  Hep3Vector & v1,   // Returned vectors
397                  Hep3Vector & v2,                 400                  Hep3Vector & v2,
398                  Hep3Vector & v3 ) const;         401                  Hep3Vector & v3 ) const;
399   void setArbitrarily (const Hep3Vector & colX    402   void setArbitrarily (const Hep3Vector & colX, // assumed to be of unit length
400                       Hep3Vector & v1,            403                       Hep3Vector & v1,
401                       Hep3Vector & v2,            404                       Hep3Vector & v2,
402                       Hep3Vector & v3) const;     405                       Hep3Vector & v3) const;
403 };  // HepRotation                                406 };  // HepRotation
404                                                   407 
405 inline                                            408 inline   
406 std::ostream & operator <<                        409 std::ostream & operator << 
407   ( std::ostream & os, const HepRotation & r )    410   ( std::ostream & os, const HepRotation & r ) {return r.print(os);}
408                                                   411 
409 }  // namespace CLHEP                             412 }  // namespace CLHEP
410                                                   413 
411 #include "CLHEP/Vector/Rotation.icc"              414 #include "CLHEP/Vector/Rotation.icc"
412                                                   415 
413 #endif /* HEP_ROTATION_H */                       416 #endif /* HEP_ROTATION_H */
414                                                   417 
415                                                   418