Warning, file /include/root/TRotation.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_TRotation
0012 #define ROOT_TRotation
0013
0014 #include "TObject.h"
0015
0016 #include "TVector3.h"
0017
0018 class TQuaternion;
0019
0020 class TRotation : public TObject {
0021
0022 public:
0023
0024 class TRotationRow {
0025 public:
0026 inline TRotationRow(const TRotation &, int);
0027 inline TRotationRow(const TRotationRow &);
0028 inline TRotationRow & operator=(const TRotationRow &);
0029 inline Double_t operator [] (int) const;
0030 private:
0031 const TRotation * fRR;
0032
0033 int fII;
0034 };
0035
0036
0037 TRotation();
0038
0039
0040 TRotation(const TRotation &);
0041 TRotation(const TQuaternion &);
0042
0043
0044 ~TRotation() override {}
0045
0046 inline Double_t XX() const;
0047 inline Double_t XY() const;
0048 inline Double_t XZ() const;
0049 inline Double_t YX() const;
0050 inline Double_t YY() const;
0051 inline Double_t YZ() const;
0052 inline Double_t ZX() const;
0053 inline Double_t ZY() const;
0054 inline Double_t ZZ() const;
0055
0056
0057 inline TRotationRow operator [] (int) const;
0058
0059
0060 Double_t operator () (int, int) const;
0061
0062
0063 inline TRotation & operator = (const TRotation &);
0064
0065
0066 inline Bool_t operator == (const TRotation &) const;
0067 inline Bool_t operator != (const TRotation &) const;
0068
0069
0070 inline Bool_t IsIdentity() const;
0071
0072
0073 inline TVector3 operator * (const TVector3 &) const;
0074
0075
0076 TRotation operator * (const TRotation &) const;
0077 inline TRotation & operator *= (const TRotation &);
0078 inline TRotation & Transform(const TRotation &);
0079
0080
0081
0082 inline TRotation Inverse() const;
0083
0084
0085 inline TRotation & Invert();
0086
0087
0088 TRotation & RotateX(Double_t);
0089
0090
0091 TRotation & RotateY(Double_t);
0092
0093
0094 TRotation & RotateZ(Double_t);
0095
0096
0097 TRotation & Rotate(Double_t, const TVector3 &);
0098 inline TRotation & Rotate(Double_t, const TVector3 *);
0099
0100
0101 TRotation & RotateAxes(const TVector3 & newX,
0102 const TVector3 & newY,
0103 const TVector3 & newZ);
0104
0105
0106 Double_t PhiX() const;
0107 Double_t PhiY() const;
0108 Double_t PhiZ() const;
0109 Double_t ThetaX() const;
0110 Double_t ThetaY() const;
0111 Double_t ThetaZ() const;
0112
0113
0114 void AngleAxis(Double_t &, TVector3 &) const;
0115
0116
0117 inline TRotation & SetToIdentity();
0118
0119
0120 TRotation & SetXEulerAngles(Double_t phi, Double_t theta, Double_t psi);
0121 void SetXPhi(Double_t);
0122 void SetXTheta(Double_t);
0123 void SetXPsi(Double_t);
0124
0125
0126
0127
0128
0129
0130 TRotation & RotateXEulerAngles(Double_t phi, Double_t theta, Double_t psi);
0131
0132
0133
0134 Double_t GetXPhi(void) const;
0135 Double_t GetXTheta(void) const;
0136 Double_t GetXPsi(void) const;
0137
0138
0139
0140 TRotation & SetYEulerAngles(Double_t phi, Double_t theta, Double_t psi);
0141 void SetYPhi(Double_t);
0142 void SetYTheta(Double_t);
0143 void SetYPsi(Double_t);
0144
0145
0146
0147
0148
0149
0150 TRotation & RotateYEulerAngles(Double_t phi, Double_t theta, Double_t psi);
0151
0152
0153
0154 Double_t GetYPhi(void) const;
0155 Double_t GetYTheta(void) const;
0156 Double_t GetYPsi(void) const;
0157
0158
0159
0160 TRotation & SetXAxis(const TVector3& axis);
0161 TRotation & SetXAxis(const TVector3& axis, const TVector3& xyPlane);
0162 TRotation & SetYAxis(const TVector3& axis);
0163 TRotation & SetYAxis(const TVector3& axis, const TVector3& yzPlane);
0164 TRotation & SetZAxis(const TVector3& axis);
0165 TRotation & SetZAxis(const TVector3& axis, const TVector3& zxPlane);
0166
0167
0168
0169
0170 void MakeBasis(TVector3& xAxis, TVector3& yAxis, TVector3& zAxis) const;
0171
0172
0173
0174
0175
0176 protected:
0177
0178 TRotation(Double_t, Double_t, Double_t, Double_t, Double_t,
0179 Double_t, Double_t, Double_t, Double_t);
0180
0181
0182 Double_t fxx, fxy, fxz, fyx, fyy, fyz, fzx, fzy, fzz;
0183
0184
0185 ClassDefOverride(TRotation,1)
0186
0187 };
0188
0189
0190 inline Double_t TRotation::XX() const { return fxx; }
0191 inline Double_t TRotation::XY() const { return fxy; }
0192 inline Double_t TRotation::XZ() const { return fxz; }
0193 inline Double_t TRotation::YX() const { return fyx; }
0194 inline Double_t TRotation::YY() const { return fyy; }
0195 inline Double_t TRotation::YZ() const { return fyz; }
0196 inline Double_t TRotation::ZX() const { return fzx; }
0197 inline Double_t TRotation::ZY() const { return fzy; }
0198 inline Double_t TRotation::ZZ() const { return fzz; }
0199
0200 inline TRotation::TRotationRow::TRotationRow
0201 (const TRotation & r, int i) : fRR(&r), fII(i) {}
0202
0203 inline TRotation::TRotationRow::TRotationRow
0204 (const TRotationRow & rr) : fRR(rr.fRR), fII(rr.fII) {}
0205
0206 inline TRotation::TRotationRow & TRotation::TRotationRow::operator = (const TRotation::TRotationRow & rr) {
0207 fRR = rr.fRR;
0208 fII = rr.fII;
0209 return *this;
0210 }
0211
0212 inline Double_t TRotation::TRotationRow::operator [] (int jj) const {
0213 return fRR->operator()(fII,jj);
0214 }
0215
0216 inline TRotation::TRotationRow TRotation::operator [] (int i) const {
0217 return TRotationRow(*this, i);
0218 }
0219
0220 inline TRotation & TRotation::operator = (const TRotation & m) {
0221 fxx = m.fxx;
0222 fxy = m.fxy;
0223 fxz = m.fxz;
0224 fyx = m.fyx;
0225 fyy = m.fyy;
0226 fyz = m.fyz;
0227 fzx = m.fzx;
0228 fzy = m.fzy;
0229 fzz = m.fzz;
0230 return *this;
0231 }
0232
0233 inline Bool_t TRotation::operator == (const TRotation& m) const {
0234 return (fxx == m.fxx && fxy == m.fxy && fxz == m.fxz &&
0235 fyx == m.fyx && fyy == m.fyy && fyz == m.fyz &&
0236 fzx == m.fzx && fzy == m.fzy && fzz == m.fzz) ? kTRUE : kFALSE;
0237 }
0238
0239 inline Bool_t TRotation::operator != (const TRotation &m) const {
0240 return (fxx != m.fxx || fxy != m.fxy || fxz != m.fxz ||
0241 fyx != m.fyx || fyy != m.fyy || fyz != m.fyz ||
0242 fzx != m.fzx || fzy != m.fzy || fzz != m.fzz) ? kTRUE : kFALSE;
0243 }
0244
0245 inline Bool_t TRotation::IsIdentity() const {
0246 return (fxx == 1.0 && fxy == 0.0 && fxz == 0.0 &&
0247 fyx == 0.0 && fyy == 1.0 && fyz == 0.0 &&
0248 fzx == 0.0 && fzy == 0.0 && fzz == 1.0) ? kTRUE : kFALSE;
0249 }
0250
0251 inline TRotation & TRotation::SetToIdentity() {
0252 fxx = fyy = fzz = 1.0;
0253 fxy = fxz = fyx = fyz = fzx = fzy = 0.0;
0254 return *this;
0255 }
0256
0257 inline TVector3 TRotation::operator * (const TVector3 & p) const {
0258 return TVector3(fxx*p.X() + fxy*p.Y() + fxz*p.Z(),
0259 fyx*p.X() + fyy*p.Y() + fyz*p.Z(),
0260 fzx*p.X() + fzy*p.Y() + fzz*p.Z());
0261 }
0262
0263 inline TRotation & TRotation::operator *= (const TRotation & m) {
0264 return *this = operator * (m);
0265 }
0266
0267 inline TRotation & TRotation::Transform(const TRotation & m) {
0268 return *this = m.operator * (*this);
0269 }
0270
0271 inline TRotation TRotation::Inverse() const {
0272 return TRotation(fxx, fyx, fzx, fxy, fyy, fzy, fxz, fyz, fzz);
0273 }
0274
0275 inline TRotation & TRotation::Invert() {
0276 return *this=Inverse();
0277 }
0278
0279 inline TRotation & TRotation::Rotate(Double_t psi, const TVector3 * p) {
0280 return Rotate(psi, *p);
0281 }
0282
0283
0284
0285 #endif