File indexing completed on 2025-01-18 09:54:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef HEP_ROTATION_H
0022 #define HEP_ROTATION_H
0023
0024 #include "CLHEP/Vector/defs.h"
0025 #include "CLHEP/Vector/RotationInterfaces.h"
0026 #include "CLHEP/Vector/RotationX.h"
0027 #include "CLHEP/Vector/RotationY.h"
0028 #include "CLHEP/Vector/RotationZ.h"
0029 #include "CLHEP/Vector/LorentzVector.h"
0030
0031 namespace CLHEP {
0032
0033
0034 class HepRotation;
0035 inline HepRotation inverseOf ( const HepRotation & r );
0036 inline HepRotation operator * (const HepRotationX & rx, const HepRotation & r);
0037 inline HepRotation operator * (const HepRotationY & ry, const HepRotation & r);
0038 inline HepRotation operator * (const HepRotationZ & rz, const HepRotation & r);
0039
0040
0041
0042
0043
0044 class HepRotation {
0045
0046 public:
0047
0048
0049
0050 inline HepRotation();
0051
0052
0053 inline HepRotation(const HepRotation & m);
0054 inline HepRotation(HepRotation && m) = default;
0055
0056
0057 inline HepRotation(const HepRotationX & m);
0058 inline HepRotation(const HepRotationY & m);
0059 inline HepRotation(const HepRotationZ & m);
0060
0061
0062 HepRotation & set( const Hep3Vector & axis, double delta );
0063 HepRotation ( const Hep3Vector & axis, double delta );
0064
0065
0066 HepRotation & set( const HepAxisAngle & ax );
0067 HepRotation ( const HepAxisAngle & ax );
0068
0069
0070 HepRotation & set( double phi, double theta, double psi );
0071 HepRotation ( double phi, double theta, double psi );
0072
0073
0074 HepRotation & set( const HepEulerAngles & e );
0075 HepRotation ( const HepEulerAngles & e );
0076
0077
0078 HepRotation ( const Hep3Vector & colX,
0079 const Hep3Vector & colY,
0080 const Hep3Vector & colZ );
0081
0082
0083
0084
0085
0086
0087
0088 HepRotation & set( const Hep3Vector & colX,
0089 const Hep3Vector & colY,
0090 const Hep3Vector & colZ );
0091
0092
0093 HepRotation & setRows( const Hep3Vector & rowX,
0094 const Hep3Vector & rowY,
0095 const Hep3Vector & rowZ );
0096
0097
0098 inline HepRotation & set(const HepRotationX & r);
0099 inline HepRotation & set(const HepRotationY & r);
0100 inline HepRotation & set(const HepRotationZ & r);
0101
0102
0103 inline HepRotation & operator = (const HepRotation & r);
0104 inline HepRotation & operator = (HepRotation && r) = default;
0105
0106
0107 inline HepRotation & operator = (const HepRotationX & r);
0108 inline HepRotation & operator = (const HepRotationY & r);
0109 inline HepRotation & operator = (const HepRotationZ & r);
0110
0111
0112 inline HepRotation &set( const HepRep3x3 & m );
0113 inline HepRotation ( const HepRep3x3 & m );
0114
0115
0116
0117
0118 inline ~HepRotation();
0119
0120
0121
0122
0123 inline Hep3Vector colX() const;
0124 inline Hep3Vector colY() const;
0125 inline Hep3Vector colZ() const;
0126
0127
0128 inline Hep3Vector rowX() const;
0129 inline Hep3Vector rowY() const;
0130 inline Hep3Vector rowZ() const;
0131
0132
0133 inline double xx() const;
0134 inline double xy() const;
0135 inline double xz() const;
0136 inline double yx() const;
0137 inline double yy() const;
0138 inline double yz() const;
0139 inline double zx() const;
0140 inline double zy() const;
0141 inline double zz() const;
0142
0143
0144 inline HepRep3x3 rep3x3() const;
0145
0146
0147
0148
0149 class HepRotation_row {
0150 public:
0151 inline HepRotation_row(const HepRotation &, int);
0152 inline double operator [] (int) const;
0153 private:
0154 const HepRotation & rr;
0155 int ii;
0156 };
0157
0158
0159 inline const HepRotation_row operator [] (int) const;
0160
0161
0162
0163 double operator () (int, int) const;
0164
0165
0166
0167
0168 inline double getPhi () const;
0169 inline double getTheta() const;
0170 inline double getPsi () const;
0171 double phi () const;
0172 double theta() const;
0173 double psi () const;
0174 HepEulerAngles eulerAngles() const;
0175
0176
0177 inline double getDelta() const;
0178 inline Hep3Vector getAxis () const;
0179 double delta() const;
0180 Hep3Vector axis () const;
0181 HepAxisAngle axisAngle() const;
0182 void getAngleAxis(double & delta, Hep3Vector & axis) const;
0183
0184
0185
0186 double phiX() const;
0187 double phiY() const;
0188 double phiZ() const;
0189 double thetaX() const;
0190 double thetaY() const;
0191 double thetaZ() const;
0192
0193
0194
0195
0196
0197 inline HepLorentzVector col1() const;
0198 inline HepLorentzVector col2() const;
0199 inline HepLorentzVector col3() const;
0200
0201
0202 inline HepLorentzVector col4() const;
0203
0204
0205 inline HepLorentzVector row1() const;
0206 inline HepLorentzVector row2() const;
0207 inline HepLorentzVector row3() const;
0208
0209
0210 inline HepLorentzVector row4() const;
0211
0212
0213 inline double xt() const;
0214 inline double yt() const;
0215 inline double zt() const;
0216 inline double tx() const;
0217 inline double ty() const;
0218 inline double tz() const;
0219
0220
0221 inline double tt() const;
0222
0223
0224 inline HepRep4x4 rep4x4() const;
0225
0226
0227
0228
0229 void setPhi (double phi);
0230
0231
0232 void setTheta (double theta);
0233
0234
0235 void setPsi (double psi);
0236
0237
0238 void setAxis (const Hep3Vector & axis);
0239
0240
0241 void setDelta (double delta);
0242
0243
0244
0245
0246 void decompose (HepAxisAngle & rotation, Hep3Vector & boost) const;
0247 void decompose (Hep3Vector & boost, HepAxisAngle & rotation) const;
0248
0249
0250
0251
0252 bool isIdentity() const;
0253
0254
0255 int compare( const HepRotation & r ) const;
0256
0257
0258
0259 inline bool operator== ( const HepRotation & r ) const;
0260 inline bool operator!= ( const HepRotation & r ) const;
0261 inline bool operator< ( const HepRotation & r ) const;
0262 inline bool operator> ( const HepRotation & r ) const;
0263 inline bool operator<= ( const HepRotation & r ) const;
0264 inline bool operator>= ( const HepRotation & r ) const;
0265
0266 double distance2( const HepRotation & r ) const;
0267
0268
0269 double howNear( const HepRotation & r ) const;
0270 bool isNear( const HepRotation & r,
0271 double epsilon=Hep4RotationInterface::tolerance) const;
0272
0273 double distance2( const HepBoost & lt ) const;
0274
0275 double distance2( const HepLorentzRotation & lt ) const;
0276
0277
0278 double howNear( const HepBoost & lt ) const;
0279 double howNear( const HepLorentzRotation & lt ) const;
0280 bool isNear( const HepBoost & lt,
0281 double epsilon=Hep4RotationInterface::tolerance) const;
0282 bool isNear( const HepLorentzRotation & lt,
0283 double epsilon=Hep4RotationInterface::tolerance) const;
0284
0285
0286
0287 double norm2() const;
0288
0289
0290 void rectify();
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300 inline Hep3Vector operator() (const Hep3Vector & p) const;
0301
0302
0303 inline Hep3Vector operator * (const Hep3Vector & p) const;
0304
0305
0306 inline HepLorentzVector operator()( const HepLorentzVector & w ) const;
0307
0308
0309 inline HepLorentzVector operator* ( const HepLorentzVector & w ) const;
0310
0311
0312
0313
0314 inline HepRotation operator * (const HepRotation & r) const;
0315
0316
0317 inline HepRotation operator * (const HepRotationX & rx) const;
0318 inline HepRotation operator * (const HepRotationY & ry) const;
0319 inline HepRotation operator * (const HepRotationZ & rz) const;
0320
0321
0322 inline HepRotation & operator *= (const HepRotation & r);
0323 inline HepRotation & transform (const HepRotation & r);
0324
0325
0326
0327 inline HepRotation & operator *= (const HepRotationX & r);
0328 inline HepRotation & operator *= (const HepRotationY & r);
0329 inline HepRotation & operator *= (const HepRotationZ & r);
0330 inline HepRotation & transform (const HepRotationX & r);
0331 inline HepRotation & transform (const HepRotationY & r);
0332 inline HepRotation & transform (const HepRotationZ & r);
0333
0334
0335 HepRotation & rotateX(double delta);
0336
0337
0338 HepRotation & rotateY(double delta);
0339
0340
0341 HepRotation & rotateZ(double delta);
0342
0343
0344 HepRotation & rotate(double delta, const Hep3Vector & axis);
0345 inline HepRotation & rotate(double delta, const Hep3Vector * axis);
0346
0347
0348
0349 HepRotation & rotateAxes(const Hep3Vector & newX,
0350 const Hep3Vector & newY,
0351 const Hep3Vector & newZ);
0352
0353
0354
0355 inline HepRotation inverse() const;
0356
0357
0358 inline HepRotation & invert();
0359
0360
0361
0362
0363 std::ostream & print( std::ostream & os ) const;
0364
0365
0366
0367
0368 static const HepRotation IDENTITY;
0369
0370
0371
0372 static inline double getTolerance();
0373 static inline double setTolerance(double tol);
0374
0375 protected:
0376
0377 inline HepRotation(double mxx, double mxy, double mxz,
0378 double myx, double myy, double myz,
0379 double mzx, double mzy, double mzz);
0380
0381
0382
0383 friend HepRotation operator* (const HepRotationX & rx, const HepRotation & r);
0384 friend HepRotation operator* (const HepRotationY & ry, const HepRotation & r);
0385 friend HepRotation operator* (const HepRotationZ & rz, const HepRotation & r);
0386
0387 double rxx, rxy, rxz,
0388 ryx, ryy, ryz,
0389 rzx, rzy, rzz;
0390
0391
0392 private:
0393 bool
0394 setCols ( const Hep3Vector & u1,
0395 const Hep3Vector & u2,
0396 const Hep3Vector & u3,
0397 double u1u2,
0398 Hep3Vector & v1,
0399 Hep3Vector & v2,
0400 Hep3Vector & v3 ) const;
0401 void setArbitrarily (const Hep3Vector & colX,
0402 Hep3Vector & v1,
0403 Hep3Vector & v2,
0404 Hep3Vector & v3) const;
0405 };
0406
0407 inline
0408 std::ostream & operator <<
0409 ( std::ostream & os, const HepRotation & r ) {return r.print(os);}
0410
0411 }
0412
0413 #include "CLHEP/Vector/Rotation.icc"
0414
0415 #ifdef ENABLE_BACKWARDS_COMPATIBILITY
0416
0417 using namespace CLHEP;
0418 #endif
0419
0420 #endif
0421