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
64{
65 public:
66
67 /**
68 * Default Constructor.
69 */
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 */
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);
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 */
130 G4ThreeVector& global) 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 */
144 G4ThreeVector& global) const;
146
147 /**
148 * Transforms a distance 'dist' along a given direction 'dir'
149 * from global to local frame.
150 */
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 */
164 const G4ThreeVector& dir) const;
165
166 /**
167 * Transforms a 'safety' distance from local to global frame (conservative).
168 */
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
180std::ostream& operator<<(std::ostream& os, const G4ScaleTransform& scale);
181
182#include "G4ScaleTransform.icc"
183
184#endif
std::ostream & operator<<(std::ostream &os, const G4ScaleTransform &scale)
CLHEP::Hep3Vector G4ThreeVector
HepGeom::Scale3D G4Scale3D
double G4double
Definition G4Types.hh:83
G4ScaleTransform is a class for geometric scaling transformations. It supports efficient arbitrary tr...
void SetScale(const G4Scale3D &scale)
void TransformNormal(const G4ThreeVector &global, G4ThreeVector &local) const
G4double TransformDistance(G4double safety) const
void SetScale(G4double sx, G4double sy, G4double sz)
void InverseTransformNormal(const G4ThreeVector &local, G4ThreeVector &global) const
G4ScaleTransform(const G4ThreeVector &scale)
G4ScaleTransform(const G4ScaleTransform &right)
G4ThreeVector TransformNormal(const G4ThreeVector &global) const
G4ThreeVector Transform(const G4ThreeVector &global) const
G4ScaleTransform(G4double sx, G4double sy, G4double sz)
void InverseTransform(const G4ThreeVector &local, G4ThreeVector &global) const
const G4ThreeVector & GetInvScale() const
G4double TransformDistance(G4double dist, const G4ThreeVector &dir) const
const G4ThreeVector & GetScale() const
G4double InverseTransformDistance(G4double safety) const
G4ScaleTransform & operator=(const G4ScaleTransform &right)
G4ScaleTransform(const G4Scale3D &scale)
void Transform(const G4ThreeVector &global, G4ThreeVector &local) const
G4ThreeVector InverseTransform(const G4ThreeVector &local) const
void SetScale(const G4ThreeVector &scale)
G4ThreeVector InverseTransformNormal(const G4ThreeVector &local) const
G4double InverseTransformDistance(G4double dist, const G4ThreeVector &dir) const
#define local
Definition gzguts.h:113