7Transformations classes are grouped in Rotations (in 3 dimensions), Lorentz transformations and Poincarre transformations, which are Translation/Rotation combinations. Each group has several members which may model physically equivalent trasformations but with different internal representations.
8All the classes are non-template and use double precision as the scalar type The following types of transformation classes are defined:
9
10* 3D Rotations:
11 * ROOT::Math::Rotation3D, rotation described by a 3x3 matrix of doubles
12 * ROOT::Math::EulerAngles rotation described by the three Euler angles (phi, theta and psi) following the GoldStein [definition](http://mathworld.wolfram.com/EulerAngles.html).
13 * ROOT::Math::RotationZYX rotation described by three angles defining a rotation first along the Z axis, then along the rotated Y' axis and then along the rotated X'' axis.
14 * ROOT::Math::AxisAngle, rotation described by a vector (axis) and an angle
15 * ROOT::Math::Quaternion, rotation described by a quaternion (4 numbers)
16 * ROOT::Math::RotationX, specialized rotation along the X axis
17 * ROOT::Math::RotationY, specialized rotation along the Y axis
18 * ROOT::Math::RotationZ, specialized rotation along the Z axis
19* 3D Transformations (Rotations + Translations)
20 * ROOT::Math::Translation3D, (only translation) described by a 3D Vector
21 * ROOT::Math::Transform3D, (rotations and then translation) described by a 3x4 matrix (12 numbers)
22* Lorentz Rotations and Boost
23 * ROOT::Math::LorentzRotation , 4D rotation (3D rotation plus a boost) described by a 4x4 matrix
24 * ROOT::Math::Boost, a Lorentz boost in an arbitrary direction and described by a 4x4 symmetrix matrix (10 numbers)
25 * ROOT::Math::BoostX, a boost in the X axis direction
26 * ROOT::Math::BoostY, a boost in the Y axis direction
27 * ROOT::Math::BoostZ, a boost in the Z axis direction
28
29#### Constructors
30
31All rotations and transformations are default constructible (giving the identity transformation). All rotations are constructible taking a number of scalar argumnts matching the number (and order of components)
32
33<pre>Rotation3D rI; // create a summy rotation (Identity matrix)
34RotationX rX(M_PI); // create a rotationX with an angle PI
35EulerAngles rE(phi, theta, psi); // create a Euler rotation with phi,theta,psi angles
36XYZVector u(ux,uy,uz);
37AxisAngle rA(u, delta); // create a rotation based on direction u with delta angle
38</pre>
39
40In addition, all rotations and transformations (other than the axial rotations) and transformations are constructible from (begin,end) iterators or from pointers whicih behave like iterators.
41
42<pre>double data[9];
43Rotation3D r(data, data+9); // create a rotation from a rotation matrix
44std::vector <double>w(12);
45Transform3D t(w.begin(),w.end()); // create a Transform3D from the content of a std::vector</double> </pre>
46
47All rotations, except the axial rotations, are constructible and assigned from any other type of rotation (including the axial):
48
49<pre>Rotation3D r(ROOT::Math::RotationX(PI)); // create a rotation 3D from a rotation along X axis of angle PI
50EulerAngles r2(r); // construct an Euler Rotation from A Rotation3D
51AxisAngle r3; r3 = r2; // assign an Axis Rotation from an Euler Rotation;
52</pre>
53
54Transform3D (rotation + translation) can be constructed from a rotation and a translation vector
55
56<pre>Rotation3D r; XYZVector v;
57Transform3D t1(r,v); // construct from rotation and then translation
58Transform3D t2(v,r); // construct inverse from first translation then rotation
59Transform3D t3(r); // construct from only a rotation (zero translation)
60Transform3D t4(v); // construct from only translation (identity rotation)
61</pre>
62
63#### Operations
64
65All transformations can be applied to vector and points using the _operator *_ or using the _operator()_
66
67<pre>XYZVector v1(...);
68Rotation3D r(...);
69XYZVector v2 = r*v1; // rotate vector v1 using r
70v2 = r(v1) // equivalent
71</pre>
72
73Transformations can be combined using the operator * . Note that the rotations are not commutative ans therefore the order is important
74
75<pre>Rotation3D r1(...);
76Rotation3D r2(...);
77Rotation3D r3 = r2*r1; // obtain a combine rotation r3 by applying first r1 then r2
78</pre>
79
80We can combine rotations of different types, like Rotation3D with any other type of rotations. The product of two different axial rotations return a Rotation3D:
81
82<pre>RotationX rx(1.);
83RotationY ry(2.);
84Rotation3D r = ry * rx; // rotation along X and then Y axis
85</pre>
86
87It is also possible to invert all the transformation or return the inverse of a transformation
88
89<pre>Rotation3D r1(...);
90 r1.Invert(); // invert the rotation modifying its content
91Rotation3D r2 =r1.Inverse(); // return the inverse in a new rotation class
92</pre>
93
94We have used rotation as examples, but all these operations can be applied to all the transformation classes. Rotation3D, Transform3D and Translation3D classes can all be combined via the _operator *_.
95
96<pre>Rotation3D r(AxisAngle(phi,ux,uy,uz)); // rotation of an angle phi around u.
97Translation3D d(dx,dy,dz); // translation of a vector d
98Transform3D t1 = d * r; // transformation obtained applying first the rotation
99Transform3D t2 = r * d; // transformation obtained applying first the translation
100</pre>
101
102#### Set/GetComponents methods
103
104Common methods to all the transformations are the Get and SetComponents. They can be used to retrieve all the scalar values on which the trasformation is based. They can be used with a signature based iterators or by using any foreign matrix which implements the _operator(i,j)_ or a different signatures depending on the transformation type.
105
106<pre>RotationX rx; rx.SetComponents(1.) // set agle of the X rotation
107double d[9] = {........}
108Rotation3D r; r.SetComponents(d,d+9); // set 9 components of 3D rotation
109double d[16];
110LorentzRotation lr;
111lr.GetComponents( d, d+16); // get 16 components of a LorentzRotation
112TMatrixD(3,4) m;
113Transform3D t; t.GetComponens(m); // fill matrix of size 3x4 with components of the transform3D t
114</pre>
115
116For more detailed documentation on all methods see the reference doc for the specific transformation class.