Geant4
11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ScaleTransform.hh
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
// G4ScaleTransform
27
//
28
// Class description:
29
//
30
// A class for geometric scaling transformations.
31
// Supports efficient arbitrary transformation of points, vectors and
32
// normals and the computation of compound & inverse transformations.
33
//
34
// Interfaces to the CLHEP class G4ThreeVector
35
//
36
// For member function descriptions, see comments by declarations. For
37
// additional clarification, also check the `const' declarations for
38
// functions & their parameters.
39
//
40
// Member data:
41
//
42
// G4ThreeVector fScale; // scale transformation
43
// G4ThreeVector fIScale; // inverse scale (avoid divisions)
44
// G4double flFactor; // factor for conversion to local frame
45
// G4double fgFactor; // factor for conversion to global frame
46
47
// Author: Gabriele Cosmo (CERN), 18.02.2016 - Initial version
48
// Evgueni Tcherniaev (CERN), 11.03.2016 - Added normals transforms
49
// --------------------------------------------------------------------
50
#ifndef G4SCALETRANSFORM_HH
51
#define G4SCALETRANSFORM_HH
52
53
#include "
G4Types.hh
"
54
#include "
G4ThreeVector.hh
"
55
#include "
G4Transform3D.hh
"
56
57
/**
58
* @brief G4ScaleTransform is a class for geometric scaling transformations.
59
* It supports efficient arbitrary transformation of points, vectors and
60
* normals and the computation of compound and inverse transformations.
61
*/
62
63
class
G4ScaleTransform
64
{
65
public
:
66
67
/**
68
* Default Constructor.
69
*/
70
inline
G4ScaleTransform
();
71
72
/**
73
* Constructor with scale parameters on each axis.
74
* @param[in] sx Scaling in X.
75
* @param[in] sy Scaling in Y.
76
* @param[in] sz Scaling in Z.
77
*/
78
inline
G4ScaleTransform
(
G4double
sx,
G4double
sy,
G4double
sz);
79
80
/**
81
* Constructor taking a 3-vector.
82
* @param[in] scale Scaling transformation.
83
*/
84
inline
G4ScaleTransform
(
const
G4ThreeVector
& scale);
85
86
/**
87
* Constructor taking a Scale3D.
88
* @param[in] scale Scaling transformation.
89
*/
90
inline
G4ScaleTransform
(
const
G4Scale3D
& scale);
91
92
/**
93
* Copy constructor and assignment operator.
94
*/
95
inline
G4ScaleTransform
(
const
G4ScaleTransform
& right);
96
inline
G4ScaleTransform
&
operator=
(
const
G4ScaleTransform
& right);
97
98
/**
99
* Updates the backed-up inverse scale and special conversion factors
100
* based on the values of the scale. Needed at initialisation and
101
* whenever the scale has changed value.
102
*/
103
inline
void
Init
();
104
105
/**
106
* Accessors returning a reference to the scale and inverse scale
107
* transformations.
108
*/
109
inline
const
G4ThreeVector
&
GetScale
()
const
;
110
inline
const
G4ThreeVector
&
GetInvScale
()
const
;
111
112
/**
113
* Modifiers for the scale transformation.
114
*/
115
inline
void
SetScale
(
const
G4ThreeVector
& scale);
116
inline
void
SetScale
(
const
G4Scale3D
& scale);
117
inline
void
SetScale
(
G4double
sx,
G4double
sy,
G4double
sz);
118
119
/**
120
* Methods to transform a point from global to local frame.
121
*/
122
inline
void
Transform
(
const
G4ThreeVector
& global,
123
G4ThreeVector
&
local
)
const
;
124
inline
G4ThreeVector
Transform
(
const
G4ThreeVector
& global)
const
;
125
126
/**
127
* Methods to transform a point from local to global frame.
128
*/
129
inline
void
InverseTransform
(
const
G4ThreeVector
&
local
,
130
G4ThreeVector
& global)
const
;
131
inline
G4ThreeVector
InverseTransform
(
const
G4ThreeVector
&
local
)
const
;
132
133
/**
134
* Methods to transform a normal from global to local frame.
135
*/
136
inline
void
TransformNormal
(
const
G4ThreeVector
& global,
137
G4ThreeVector
&
local
)
const
;
138
inline
G4ThreeVector
TransformNormal
(
const
G4ThreeVector
& global)
const
;
139
140
/**
141
* Methods to transform a normal from local to global frame.
142
*/
143
inline
void
InverseTransformNormal
(
const
G4ThreeVector
&
local
,
144
G4ThreeVector
& global)
const
;
145
inline
G4ThreeVector
InverseTransformNormal
(
const
G4ThreeVector
&
local
)
const
;
146
147
/**
148
* Transforms a distance 'dist' along a given direction 'dir'
149
* from global to local frame.
150
*/
151
inline
G4double
TransformDistance
(
G4double
dist,
152
const
G4ThreeVector
& dir)
const
;
153
154
/**
155
* Transforms a 'safety' distance from global to local frame (conservative).
156
*/
157
inline
G4double
TransformDistance
(
G4double
safety)
const
;
158
159
/**
160
* Transforms a distance 'dist' along a given direction 'dir'
161
* from local to global frame.
162
*/
163
inline
G4double
InverseTransformDistance
(
G4double
dist,
164
const
G4ThreeVector
& dir)
const
;
165
166
/**
167
* Transforms a 'safety' distance from local to global frame (conservative).
168
*/
169
inline
G4double
InverseTransformDistance
(
G4double
safety)
const
;
170
171
private
:
172
173
G4ThreeVector
fScale;
// scale transformation
174
G4ThreeVector
fIScale;
// inverse scale (avoid divisions)
175
176
/** Conversion factors to local/global frames. */
177
G4double
flFactor = 1.0, fgFactor = 1.0;
178
};
179
180
std::ostream&
operator<<
(std::ostream& os,
const
G4ScaleTransform
& scale);
181
182
#include "G4ScaleTransform.icc"
183
184
#endif
operator<<
std::ostream & operator<<(std::ostream &os, const G4ScaleTransform &scale)
G4ThreeVector.hh
G4ThreeVector
CLHEP::Hep3Vector G4ThreeVector
Definition
G4ThreeVector.hh:36
G4Transform3D.hh
G4Scale3D
HepGeom::Scale3D G4Scale3D
Definition
G4Transform3D.hh:50
G4Types.hh
G4double
double G4double
Definition
G4Types.hh:83
G4ScaleTransform
G4ScaleTransform is a class for geometric scaling transformations. It supports efficient arbitrary tr...
Definition
G4ScaleTransform.hh:64
G4ScaleTransform::SetScale
void SetScale(const G4Scale3D &scale)
G4ScaleTransform::TransformNormal
void TransformNormal(const G4ThreeVector &global, G4ThreeVector &local) const
G4ScaleTransform::TransformDistance
G4double TransformDistance(G4double safety) const
G4ScaleTransform::SetScale
void SetScale(G4double sx, G4double sy, G4double sz)
G4ScaleTransform::Init
void Init()
G4ScaleTransform::InverseTransformNormal
void InverseTransformNormal(const G4ThreeVector &local, G4ThreeVector &global) const
G4ScaleTransform::G4ScaleTransform
G4ScaleTransform(const G4ThreeVector &scale)
G4ScaleTransform::G4ScaleTransform
G4ScaleTransform(const G4ScaleTransform &right)
G4ScaleTransform::TransformNormal
G4ThreeVector TransformNormal(const G4ThreeVector &global) const
G4ScaleTransform::Transform
G4ThreeVector Transform(const G4ThreeVector &global) const
G4ScaleTransform::G4ScaleTransform
G4ScaleTransform(G4double sx, G4double sy, G4double sz)
G4ScaleTransform::InverseTransform
void InverseTransform(const G4ThreeVector &local, G4ThreeVector &global) const
G4ScaleTransform::GetInvScale
const G4ThreeVector & GetInvScale() const
G4ScaleTransform::TransformDistance
G4double TransformDistance(G4double dist, const G4ThreeVector &dir) const
G4ScaleTransform::GetScale
const G4ThreeVector & GetScale() const
G4ScaleTransform::G4ScaleTransform
G4ScaleTransform()
G4ScaleTransform::InverseTransformDistance
G4double InverseTransformDistance(G4double safety) const
G4ScaleTransform::operator=
G4ScaleTransform & operator=(const G4ScaleTransform &right)
G4ScaleTransform::G4ScaleTransform
G4ScaleTransform(const G4Scale3D &scale)
G4ScaleTransform::Transform
void Transform(const G4ThreeVector &global, G4ThreeVector &local) const
G4ScaleTransform::InverseTransform
G4ThreeVector InverseTransform(const G4ThreeVector &local) const
G4ScaleTransform::SetScale
void SetScale(const G4ThreeVector &scale)
G4ScaleTransform::InverseTransformNormal
G4ThreeVector InverseTransformNormal(const G4ThreeVector &local) const
G4ScaleTransform::InverseTransformDistance
G4double InverseTransformDistance(G4double dist, const G4ThreeVector &dir) const
local
#define local
Definition
gzguts.h:113
geant4-v11.4.0
source
geometry
management
include
G4ScaleTransform.hh
Generated by
1.16.1