Logo ROOT   6.19/01
Reference Guide
Rotation3DxAxial.cxx
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Authors: W. Brown, M. Fischler, L. Moneta 2005
3 
5 
9 
10 namespace ROOT {
11 
12 namespace Math {
13 
15  // combination of a Rotation3D with a RotationX
16  Scalar s = rx.SinAngle();
17  Scalar c = rx.CosAngle();
18  return Rotation3D
19  (
20  fM[kXX], fM[kXY]*c + fM[kXZ]*s, fM[kXZ]*c - fM[kXY]*s
21  , fM[kYX], fM[kYY]*c + fM[kYZ]*s, fM[kYZ]*c - fM[kYY]*s
22  , fM[kZX], fM[kZY]*c + fM[kZZ]*s, fM[kZZ]*c - fM[kZY]*s
23  );
24 }
25 
27  // combination of a Rotation3D with a RotationY
28  Scalar s = ry.SinAngle();
29  Scalar c = ry.CosAngle();
30  return Rotation3D
31  (
32  fM[kXX]*c - fM[kXZ]*s, fM[kXY], fM[kXX]*s + fM[kXZ]*c
33  , fM[kYX]*c - fM[kYZ]*s, fM[kYY], fM[kYX]*s + fM[kYZ]*c
34  , fM[kZX]*c - fM[kZZ]*s, fM[kZY], fM[kZX]*s + fM[kZZ]*c
35  );
36 }
37 
38 
40  // combination of a Rotation3D with a RotationZ
41  Scalar s = rz.SinAngle();
42  Scalar c = rz.CosAngle();
43  return Rotation3D
44  (
45  fM[kXX]*c + fM[kXY]*s, fM[kXY]*c - fM[kXX]*s, fM[kXZ]
46  , fM[kYX]*c + fM[kYY]*s, fM[kYY]*c - fM[kYX]*s, fM[kYZ]
47  , fM[kZX]*c + fM[kZY]*s, fM[kZY]*c - fM[kZX]*s, fM[kZZ]
48  );
49 }
50 
51 Rotation3D operator* (RotationX const & r1, Rotation3D const & r2) {
52  // combination of a RotationX with a Rotation3D
53  // TODO -- recode for much better efficiency!
54  return Rotation3D(r1)*r2;
55 }
56 
57 Rotation3D operator* (RotationY const & r1, Rotation3D const & r2) {
58  // combination of a RotationY with a Rotation3D
59  // TODO -- recode for much better efficiency!
60  return Rotation3D(r1)*r2;
61 }
62 
63 Rotation3D operator* (RotationZ const & r1, Rotation3D const & r2) {
64  // combination of a RotationZ with a Rotation3D
65  // TODO -- recode for much better efficiency!
66  return Rotation3D(r1)*r2;
67 }
68 
70 
71 // Rx * Ry
72 Rotation3D operator* (RotationX const & rx, RotationY const & ry) {
73  Scalar sx = rx.SinAngle();
74  Scalar cx = rx.CosAngle();
75  Scalar sy = ry.SinAngle();
76  Scalar cy = ry.CosAngle();
77  return Rotation3D
78  ( cy , 0 , sy ,
79  sx*sy , cx , -sx*cy ,
80  -sy*cx , sx , cx*cy );
81 }
82 
83 // Rx * Rz
84 Rotation3D operator* (RotationX const & rx, RotationZ const & rz) {
85  Scalar sx = rx.SinAngle();
86  Scalar cx = rx.CosAngle();
87  Scalar sz = rz.SinAngle();
88  Scalar cz = rz.CosAngle();
89  return Rotation3D
90  ( cz , -sz , 0 ,
91  cx*sz , cx*cz , -sx ,
92  sx*sz , cz*sx , cx );
93 }
94 
95 // Ry * Rx
96 Rotation3D operator* (RotationY const & ry, RotationX const & rx) {
97  Scalar sx = rx.SinAngle();
98  Scalar cx = rx.CosAngle();
99  Scalar sy = ry.SinAngle();
100  Scalar cy = ry.CosAngle();
101  return Rotation3D
102  ( cy , sx*sy , sy*cx ,
103  0 , cx , -sx ,
104  -sy , cy*sx , cx*cy );
105 }
106 
107 // Ry * Rz
108 Rotation3D operator* (RotationY const & ry, RotationZ const & rz) {
109  Scalar sy = ry.SinAngle();
110  Scalar cy = ry.CosAngle();
111  Scalar sz = rz.SinAngle();
112  Scalar cz = rz.CosAngle();
113  return Rotation3D
114  ( cy*cz ,-cy*sz , sy ,
115  sz , cz , 0 ,
116  -cz*sy , sy*sz , cy );
117 }
118 
119 // Rz * Rx
120 Rotation3D operator* (RotationZ const & rz, RotationX const & rx) {
121  Scalar sx = rx.SinAngle();
122  Scalar cx = rx.CosAngle();
123  Scalar sz = rz.SinAngle();
124  Scalar cz = rz.CosAngle();
125  return Rotation3D
126  ( cz ,-cx*sz , sx*sz ,
127  sz , cx*cz ,-cz*sx ,
128  0 , sx , cx );
129 }
130 
131 // Rz * Ry
132 Rotation3D operator* (RotationZ const & rz, RotationY const & ry) {
133  Scalar sy = ry.SinAngle();
134  Scalar cy = ry.CosAngle();
135  Scalar sz = rz.SinAngle();
136  Scalar cz = rz.CosAngle();
137  return Rotation3D
138  ( cy*cz , -sz , cz*sy ,
139  cy*sz , cz , sy*sz ,
140  -sy , 0 , cy );
141 }
142 
143 
144 
145 
146 } //namespace Math
147 } //namespace ROOT
Scalar SinAngle() const
Sine or Cosine of the rotation angle.
Definition: RotationZ.h:108
VSD Structures.
Definition: StringConv.hxx:21
Rotation class representing a 3D rotation about the Z axis by the angle of rotation.
Definition: RotationZ.h:43
Scalar CosAngle() const
Definition: RotationZ.h:109
Scalar SinAngle() const
Sine or Cosine of the rotation angle.
Definition: RotationY.h:108
Scalar CosAngle() const
Definition: RotationY.h:109
Rotation class representing a 3D rotation about the Y axis by the angle of rotation.
Definition: RotationY.h:43
static constexpr double s
AVector operator*(const AVector &v) const
Overload operator * for rotation on a vector.
Definition: Rotation3D.h:407
Rotation class representing a 3D rotation about the X axis by the angle of rotation.
Definition: RotationX.h:43
Rotation class with the (3D) rotation represented by a 3x3 orthogonal matrix.
Definition: Rotation3D.h:65
Scalar CosAngle() const
Definition: RotationX.h:109
Namespace for new Math classes and functions.
Rotation3D()
Default constructor (identity rotation)
Definition: Rotation3D.cxx:29
#define c(i)
Definition: RSha256.hxx:101
Rotation3D::Scalar Scalar
Scalar SinAngle() const
Sine or Cosine of the rotation angle.
Definition: RotationX.h:108
AxisAngle operator*(RotationX const &r1, AxisAngle const &r2)
Multiplication of an axial rotation by an AxisAngle.