Geometrical transformation package.
All geometrical transformations handled by the modeller are provided as a
built-in package. This was designed to minimize memory requirements and
optimize performance of point/vector master-to-local and local-to-master
computation. We need to have in mind that a transformation in TGeo has 2
major use-cases. The first one is for defining the placement of a volume
with respect to its container reference frame. This frame will be called
'master' and the frame of the positioned volume - 'local'. If T is a
transformation used for positioning volume daughters, then:
MASTER = T * LOCAL
Therefore a local-to-master conversion will be performed by using T, while
a master-to-local by using its inverse. The second use case is the computation
of the global transformation of a given object in the geometry. Since the
geometry is built as 'volumes-inside-volumes', this global transformation
represent the pile-up of all local transformations in the corresponding
branch. The conversion from the global reference frame and the given object
is also called master-to-local, but it is handled by the manager class.
A general homogenous transformation is defined as a 4x4 matrix embeeding
a rotation, a translation and a scale. The advantage of this description
is that each basic transformation can be represented as a homogenous matrix,
composition being performed as simple matrix multiplication.
Rotation: Inverse rotation:
r11 r12 r13 0 r11 r21 r31 0
r21 r22 r23 0 r12 r22 r32 0
r31 r32 r33 0 r13 r23 r33 0
0 0 0 1 0 0 0 1
Translation: Inverse translation:
1 0 0 tx 1 0 0 -tx
0 1 0 ty 0 1 0 -ty
0 0 1 tz 0 0 1 -tz
0 0 0 1 0 0 0 1
Scale: Inverse scale:
sx 0 0 0 1/sx 0 0 0
0 sy 0 0 0 1/sy 0 0
0 0 sz 0 0 0 1/sz 0
0 0 0 1 0 0 0 1
where: rij are the 3x3 rotation matrix components,
tx, ty, tz are the translation components
sx, sy, sz are arbitrary scale constants on the eacks axis,
The disadvantage in using this approach is that computation for 4x4 matrices
is expensive. Even combining two translation would become a multiplication
of their corresponding matrices, which is quite an undesired effect. On the
other hand, it is not a good idea to store a translation as a block of 16
numbers. We have therefore chosen to implement each basic transformation type
as a class deriving from the same basic abstract class and handling its specific
data and point/vector transformation algorithms.

If no name was supplied in the ctor, the type of transformation is checked.
A letter will be prepended to the name :
t - translation
r - rotation
s - scale
c - combi (translation + rotation)
g - general (tr+rot+scale)
The index of the transformation in gGeoManager list of transformations will
be appended.