00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef HEP_ROTATION_H
00022 #define HEP_ROTATION_H
00023
00024 #ifdef GNUPRAGMA
00025 #pragma interface
00026 #endif
00027
00028 #include "CLHEP/Vector/RotationInterfaces.h"
00029 #include "CLHEP/Vector/RotationX.h"
00030 #include "CLHEP/Vector/RotationY.h"
00031 #include "CLHEP/Vector/RotationZ.h"
00032 #include "CLHEP/Vector/LorentzVector.h"
00033
00034 #ifdef HEP_NO_INLINE_IN_DECLARATION
00035 #define inline
00036 #endif
00037
00038
00039 class HepRotation;
00040 inline HepRotation inverseOf ( const HepRotation & r );
00041 inline HepRotation operator * (const HepRotationX & rx, const HepRotation & r);
00042 inline HepRotation operator * (const HepRotationY & ry, const HepRotation & r);
00043 inline HepRotation operator * (const HepRotationZ & rz, const HepRotation & r);
00044
00049 class HepRotation {
00050
00051 public:
00052
00053
00054
00055 inline HepRotation();
00056
00057
00058 inline HepRotation(const HepRotation & m);
00059
00060
00061 inline HepRotation(const HepRotationX & m);
00062 inline HepRotation(const HepRotationY & m);
00063 inline HepRotation(const HepRotationZ & m);
00064
00065
00066 HepRotation & set( const Hep3Vector & axis, double delta );
00067 HepRotation ( const Hep3Vector & axis, double delta );
00068
00069
00070 HepRotation & set( const HepAxisAngle & ax );
00071 HepRotation ( const HepAxisAngle & ax );
00072
00073
00074 HepRotation & set( double phi, double theta, double psi );
00075 HepRotation ( double phi, double theta, double psi );
00076
00077
00078 HepRotation & set( const HepEulerAngles & e );
00079 HepRotation ( const HepEulerAngles & e );
00080
00081
00082 HepRotation ( const Hep3Vector & colX,
00083 const Hep3Vector & colY,
00084 const Hep3Vector & colZ );
00085
00086
00087
00088
00089
00090
00091
00092 HepRotation & set( const Hep3Vector & colX,
00093 const Hep3Vector & colY,
00094 const Hep3Vector & colZ );
00095
00096
00097 HepRotation & setRows( const Hep3Vector & rowX,
00098 const Hep3Vector & rowY,
00099 const Hep3Vector & rowZ );
00100
00101
00102 inline HepRotation & set(const HepRotationX & r);
00103 inline HepRotation & set(const HepRotationY & r);
00104 inline HepRotation & set(const HepRotationZ & r);
00105
00106
00107 inline HepRotation & operator = (const HepRotation & r);
00108
00109
00110 inline HepRotation & operator = (const HepRotationX & r);
00111 inline HepRotation & operator = (const HepRotationY & r);
00112 inline HepRotation & operator = (const HepRotationZ & r);
00113
00114
00115 inline HepRotation &set( const HepRep3x3 & m );
00116 inline HepRotation ( const HepRep3x3 & m );
00117
00118
00119
00120
00121 inline ~HepRotation();
00122
00123
00124
00125
00126 inline Hep3Vector colX() const;
00127 inline Hep3Vector colY() const;
00128 inline Hep3Vector colZ() const;
00129
00130
00131 inline Hep3Vector rowX() const;
00132 inline Hep3Vector rowY() const;
00133 inline Hep3Vector rowZ() const;
00134
00135
00136 inline double xx() const;
00137 inline double xy() const;
00138 inline double xz() const;
00139 inline double yx() const;
00140 inline double yy() const;
00141 inline double yz() const;
00142 inline double zx() const;
00143 inline double zy() const;
00144 inline double zz() const;
00145
00146
00147 inline HepRep3x3 rep3x3() const;
00148
00149
00150
00151
00152 class HepRotation_row {
00153 public:
00154 inline HepRotation_row(const HepRotation &, int);
00155 inline double operator [] (int) const;
00156 private:
00157 const HepRotation & rr;
00158 int ii;
00159 };
00160
00161
00162 inline const HepRotation_row operator [] (int) const;
00163
00164
00165
00166 double operator () (int, int) const;
00167
00168
00169
00170
00171 inline double getPhi () const;
00172 inline double getTheta() const;
00173 inline double getPsi () const;
00174 double phi () const;
00175 double theta() const;
00176 double psi () const;
00177 HepEulerAngles eulerAngles() const;
00178
00179
00180 inline double getDelta() const;
00181 inline Hep3Vector getAxis () const;
00182 double delta() const;
00183 Hep3Vector axis () const;
00184 HepAxisAngle axisAngle() const;
00185 void getAngleAxis(double & delta, Hep3Vector & axis) const;
00186
00187
00188
00189 double phiX() const;
00190 double phiY() const;
00191 double phiZ() const;
00192 double thetaX() const;
00193 double thetaY() const;
00194 double thetaZ() const;
00195
00196
00197
00198
00199
00200 inline HepLorentzVector col1() const;
00201 inline HepLorentzVector col2() const;
00202 inline HepLorentzVector col3() const;
00203
00204
00205 inline HepLorentzVector col4() const;
00206
00207
00208 inline HepLorentzVector row1() const;
00209 inline HepLorentzVector row2() const;
00210 inline HepLorentzVector row3() const;
00211
00212
00213 inline HepLorentzVector row4() const;
00214
00215
00216 inline double xt() const;
00217 inline double yt() const;
00218 inline double zt() const;
00219 inline double tx() const;
00220 inline double ty() const;
00221 inline double tz() const;
00222
00223
00224 inline double tt() const;
00225
00226
00227 inline HepRep4x4 rep4x4() const;
00228
00229
00230
00231
00232 void setPhi (double phi);
00233
00234
00235 void setTheta (double theta);
00236
00237
00238 void setPsi (double psi);
00239
00240
00241 void setAxis (const Hep3Vector & axis);
00242
00243
00244 void setDelta (double delta);
00245
00246
00247
00248
00249 void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
00250 void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
00251
00252
00253
00254
00255 bool isIdentity() const;
00256
00257
00258 int compare( const HepRotation & r ) const;
00259
00260
00261
00262 inline bool operator== ( const HepRotation & r ) const;
00263 inline bool operator!= ( const HepRotation & r ) const;
00264 inline bool operator< ( const HepRotation & r ) const;
00265 inline bool operator> ( const HepRotation & r ) const;
00266 inline bool operator<= ( const HepRotation & r ) const;
00267 inline bool operator>= ( const HepRotation & r ) const;
00268
00269 double distance2( const HepRotation & r ) const;
00270
00271
00272 double howNear( const HepRotation & r ) const;
00273 bool isNear( const HepRotation & r,
00274 double epsilon=Hep4RotationInterface::tolerance) const;
00275
00276 double distance2( const HepBoost & lt ) const;
00277
00278 double distance2( const HepLorentzRotation & lt ) const;
00279
00280
00281 double howNear( const HepBoost & lt ) const;
00282 double howNear( const HepLorentzRotation & lt ) const;
00283 bool isNear( const HepBoost & lt,
00284 double epsilon=Hep4RotationInterface::tolerance) const;
00285 bool isNear( const HepLorentzRotation & lt,
00286 double epsilon=Hep4RotationInterface::tolerance) const;
00287
00288
00289
00290 double norm2() const;
00291
00292
00293 void rectify();
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303 inline Hep3Vector operator() (const Hep3Vector & p) const;
00304
00305
00306 inline Hep3Vector operator * (const Hep3Vector & p) const;
00307
00308
00309 inline HepLorentzVector operator()( const HepLorentzVector & w ) const;
00310
00311
00312 inline HepLorentzVector operator* ( const HepLorentzVector & w ) const;
00313
00314
00315
00316
00317 inline HepRotation operator * (const HepRotation & r) const;
00318
00319
00320 inline HepRotation operator * (const HepRotationX & rx) const;
00321 inline HepRotation operator * (const HepRotationY & ry) const;
00322 inline HepRotation operator * (const HepRotationZ & rz) const;
00323
00324
00325 inline HepRotation & operator *= (const HepRotation & r);
00326 inline HepRotation & transform (const HepRotation & r);
00327
00328
00329
00330 inline HepRotation & operator *= (const HepRotationX & r);
00331 inline HepRotation & operator *= (const HepRotationY & r);
00332 inline HepRotation & operator *= (const HepRotationZ & r);
00333 inline HepRotation & transform (const HepRotationX & r);
00334 inline HepRotation & transform (const HepRotationY & r);
00335 inline HepRotation & transform (const HepRotationZ & r);
00336
00337
00338 HepRotation & rotateX(double delta);
00339
00340
00341 HepRotation & rotateY(double delta);
00342
00343
00344 HepRotation & rotateZ(double delta);
00345
00346
00347 HepRotation & rotate(double delta, const Hep3Vector & axis);
00348 inline HepRotation & rotate(double delta, const Hep3Vector * axis);
00349
00350
00351
00352 HepRotation & rotateAxes(const Hep3Vector & newX,
00353 const Hep3Vector & newY,
00354 const Hep3Vector & newZ);
00355
00356
00357
00358 inline HepRotation inverse() const;
00359
00360
00361 inline HepRotation & invert();
00362
00363
00364
00365
00366 HepStd::ostream & print( HepStd::ostream & os ) const;
00367
00368
00369
00370
00371 static const HepRotation IDENTITY;
00372
00373
00374
00375 static inline double getTolerance();
00376 static inline double setTolerance(double tol);
00377
00378 protected:
00379
00380 inline HepRotation(double mxx, double mxy, double mxz,
00381 double myx, double myy, double myz,
00382 double mzx, double mzy, double mzz);
00383
00384
00385
00386 friend HepRotation operator* (const HepRotationX & rx, const HepRotation & r);
00387 friend HepRotation operator* (const HepRotationY & ry, const HepRotation & r);
00388 friend HepRotation operator* (const HepRotationZ & rz, const HepRotation & r);
00389
00390 double rxx, rxy, rxz,
00391 ryx, ryy, ryz,
00392 rzx, rzy, rzz;
00393
00394
00395 private:
00396 bool
00397 setCols ( const Hep3Vector & u1,
00398 const Hep3Vector & u2,
00399 const Hep3Vector & u3,
00400 double u1u2,
00401 Hep3Vector & v1,
00402 Hep3Vector & v2,
00403 Hep3Vector & v3 ) const;
00404 void setArbitrarily (const Hep3Vector & colX,
00405 Hep3Vector & v1,
00406 Hep3Vector & v2,
00407 Hep3Vector & v3) const;
00408 };
00409
00410 inline
00411 HepStd::ostream & operator <<
00412 ( HepStd::ostream & os, const HepRotation & r ) {return r.print(os);}
00413
00414 #
00415 #ifdef HEP_NO_INLINE_IN_DECLARATION
00416 #undef inline
00417 #endif
00418
00419 #ifdef HEP_SHORT_NAMES
00420 typedef HepRotation Rotation;
00421 #endif
00422
00423 #ifndef HEP_DEBUG_INLINE
00424 #include "CLHEP/Vector/Rotation.icc"
00425 #endif
00426
00427 #endif
00428