Geant4
11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AffineTransform.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
// class G4AffineTransform
27
//
28
// Class description:
29
//
30
// A class for geometric affine transformations [see, eg. Foley & Van Dam]
31
// Supports efficient arbitrary rotation & transformation of vectors and the
32
// computation of compound & inverse transformations. A 'rotation flag' is
33
// maintained internally for greater computational efficiency for transforms
34
// that do not involve rotation.
35
//
36
// Interfaces to the CLHEP classes G4ThreeVector & G4RotationMatrix
37
//
38
// For member function descriptions, see comments by declarations. For
39
// additional clarification, also check the `const' declarations for
40
// functions & their parameters.
41
//
42
// Member data:
43
//
44
// G4double rxx,rxy,rxz;
45
// G4double ryx,ryy,ryz; A 3x3 rotation matrix - net rotation
46
// G4double rzx,rzy,rzz;
47
// G4double tx,ty,tz; Net translation
48
49
// Author: Paul R C Kent (CERN), 06.08.1996 - Initial version
50
// E.Tcherniaev (CERN), 19.09.1996, 06.05.2018 - Revised
51
// --------------------------------------------------------------------
52
#ifndef G4AFFINETRANSFORM_HH
53
#define G4AFFINETRANSFORM_HH
54
55
#include "
G4Types.hh
"
56
#include "
G4ThreeVector.hh
"
57
#include "
G4RotationMatrix.hh
"
58
#include "
G4Transform3D.hh
"
59
60
/**
61
* @brief G4AffineTransform is a class for geometric affine transformations.
62
* It supports efficient arbitrary rotation & transformation of vectors and
63
* the computation of compound & inverse transformations. A 'rotation flag'
64
* is maintained internally for greater computational efficiency for transforms
65
* that do not involve rotation.
66
*/
67
68
class
G4AffineTransform
69
{
70
public
:
71
72
/**
73
* Constructor for G4AffineTransform. Initialises components to zero.
74
*/
75
inline
G4AffineTransform
();
76
77
/**
78
* Constructor for Translation only: under t'form, translate point
79
* at origin by 'tlate'.
80
*/
81
inline
G4AffineTransform
(
const
G4ThreeVector
& tlate);
82
83
/**
84
* Constructor for Rotation only: under t'form, rotate by 'rot'.
85
*/
86
inline
G4AffineTransform
(
const
G4RotationMatrix
& rot);
87
88
/**
89
* Constructor for Translation and Rotation: under t'form, rotate
90
* by 'rot' then translate by 'tlate'.
91
*/
92
inline
G4AffineTransform
(
const
G4RotationMatrix
& rot,
93
const
G4ThreeVector
& tlate);
94
95
/**
96
* Alternative Constructor optionally rotating by 'rot' by pointer then
97
* translate by 'tlate' - 'rot' may be null.
98
*/
99
inline
G4AffineTransform
(
const
G4RotationMatrix
* rot,
100
const
G4ThreeVector
& tlate);
101
102
/**
103
* Copy & move constructor.
104
*/
105
inline
G4AffineTransform
(
const
G4AffineTransform
& rhs) =
default
;
106
inline
G4AffineTransform
(
G4AffineTransform
&& rhs) =
default
;
107
108
/**
109
* Assignment & move operators.
110
*/
111
inline
G4AffineTransform
&
operator=
(
const
G4AffineTransform
& rhs);
112
inline
G4AffineTransform
&
operator=
(
G4AffineTransform
&& rhs) =
default
;
113
114
/**
115
* Default Destructor.
116
*/
117
inline
~G4AffineTransform
() =
default
;
118
119
/**
120
* Compound Transforms: tf2=tf2*tf1 equivalent to tf2*=tf1.
121
* @param[in] tf Transformation to combine.
122
* @returns The compound transformation of self*tf.
123
*/
124
inline
G4AffineTransform
operator *
(
const
G4AffineTransform
& tf)
const
;
125
126
/**
127
* [Modifying] compound Transforms: Multiplies self by 'tf'.
128
* @param[in] tf Transformation to combine.
129
* @returns Returns self reference, i.e. A=AB for a*=b.
130
*/
131
inline
G4AffineTransform
&
operator *=
(
const
G4AffineTransform
& tf);
132
133
/**
134
* [Modifying] Product function, for avoiding (potential) temporaries:
135
* c.Product(a,b) equivalent to c=a*b
136
* c.InverseProduct(a*b,b ) equivalent to c=a
137
* Sets self=tf1*tf2.
138
* @param[in] tf1 First transformation operand.
139
* @param[in] tf2 Second transformation operand.
140
* @returns Returns Self reference.
141
*/
142
inline
G4AffineTransform
&
Product
(
const
G4AffineTransform
& tf1,
143
const
G4AffineTransform
& tf2);
144
145
/**
146
* [Modifying] Inverse Product function. Sets self=tf1*(tf2^-1).
147
* @param[in] tf1 First transformation operand.
148
* @param[in] tf2 Second transformation operand.
149
* @returns Returns Self reference.
150
*/
151
inline
G4AffineTransform
&
InverseProduct
(
const
G4AffineTransform
& tf1,
152
const
G4AffineTransform
& tf2);
153
154
/**
155
* Transforms the specified point 'vec'.
156
* @returns vec*rot+tlate.
157
*/
158
inline
G4ThreeVector
TransformPoint
(
const
G4ThreeVector
& vec)
const
;
159
160
/**
161
* Transforms the specified point 'vec' using inverse transformation.
162
* @returns The inverse transformation of the given point.
163
*/
164
inline
G4ThreeVector
InverseTransformPoint
(
const
G4ThreeVector
& vec)
const
;
165
166
/**
167
* Transforms the specified 'axis'.
168
* @returns vec*rot.
169
*/
170
inline
G4ThreeVector
TransformAxis
(
const
G4ThreeVector
&
axis
)
const
;
171
172
/**
173
* Transforms the specified 'axis' using inverse transformation.
174
* @returns The inverse transformation of the given axis.
175
*/
176
inline
G4ThreeVector
InverseTransformAxis
(
const
G4ThreeVector
&
axis
)
const
;
177
178
/**
179
* Transforms the specified point 'vec' (in place): sets vec=vec*rot+tlate.
180
* @param[in,out] vec The point to transform.
181
*/
182
inline
void
ApplyPointTransform
(
G4ThreeVector
& vec)
const
;
183
184
/**
185
* Transforms the specified 'axis' (in place): sets axis=axis*rot.
186
* @param[in,out] axis The axis to transform.
187
*/
188
inline
void
ApplyAxisTransform
(
G4ThreeVector
&
axis
)
const
;
189
190
/**
191
* Returns the inverse of the current transform.
192
*/
193
inline
G4AffineTransform
Inverse
()
const
;
194
195
/**
196
* [Modifying] Sets self=inverse of self.
197
* @returns Self reference.
198
*/
199
inline
G4AffineTransform
&
Invert
();
200
201
/**
202
* [Modifying] Adjust the net translation by the given vector.
203
* @returns Self reference.
204
*/
205
inline
G4AffineTransform
&
operator +=
(
const
G4ThreeVector
& tlate);
206
inline
G4AffineTransform
&
operator -=
(
const
G4ThreeVector
& tlate);
207
208
/**
209
* Equality and inequality operators.
210
*/
211
inline
G4bool
operator ==
(
const
G4AffineTransform
& tf)
const
;
212
inline
G4bool
operator !=
(
const
G4AffineTransform
& tf)
const
;
213
214
/**
215
* Access operator.
216
*/
217
inline
G4double
operator []
(
const
G4int
n)
const
;
218
219
/**
220
* Returns true if transform includes rotation.
221
*/
222
inline
G4bool
IsRotated
()
const
;
223
224
/**
225
* Returns true if transform includes translation.
226
*/
227
inline
G4bool
IsTranslated
()
const
;
228
229
/**
230
* Returns the net rotation matrix.
231
*/
232
inline
G4RotationMatrix
NetRotation
()
const
;
233
234
/**
235
* Returns the inverse net rotation matrix.
236
*/
237
inline
G4RotationMatrix
InverseNetRotation
()
const
;
238
239
/**
240
* Returns the net translation vector.
241
*/
242
inline
G4ThreeVector
NetTranslation
()
const
;
243
244
/**
245
* Returns the inverse net translation vector.
246
*/
247
inline
G4ThreeVector
InverseNetTranslation
()
const
;
248
249
/**
250
* Setters for rotation and translation.
251
*/
252
inline
void
SetNetRotation
(
const
G4RotationMatrix
& rot);
253
inline
void
SetNetTranslation
(
const
G4ThreeVector
& tlate);
254
255
/**
256
* Conversion operator (cast) to G4Transform3D.
257
*/
258
inline
operator
G4Transform3D
()
const
;
259
260
private
:
261
262
/**
263
* Private components Constructor.
264
*/
265
inline
G4AffineTransform
(
266
const
G4double
prxx,
const
G4double
prxy,
const
G4double
prxz,
267
const
G4double
pryx,
const
G4double
pryy,
const
G4double
pryz,
268
const
G4double
przx,
const
G4double
przy,
const
G4double
przz,
269
const
G4double
ptx,
const
G4double
pty,
const
G4double
ptz);
270
271
private
:
272
273
G4double
rxx,rxy,rxz;
274
G4double
ryx,ryy,ryz;
275
G4double
rzx,rzy,rzz;
276
G4double
tx,ty,tz;
277
};
278
279
/**
280
* Streaming operator.
281
*/
282
std::ostream&
operator <<
(std::ostream& os,
const
G4AffineTransform
& transf);
283
284
#include "G4AffineTransform.icc"
285
286
#endif
operator<<
std::ostream & operator<<(std::ostream &os, const G4AffineTransform &transf)
G4RotationMatrix.hh
G4RotationMatrix
CLHEP::HepRotation G4RotationMatrix
Definition
G4RotationMatrix.hh:37
G4ThreeVector.hh
G4ThreeVector
CLHEP::Hep3Vector G4ThreeVector
Definition
G4ThreeVector.hh:36
G4Transform3D.hh
G4Transform3D
HepGeom::Transform3D G4Transform3D
Definition
G4Transform3D.hh:33
G4Types.hh
G4double
double G4double
Definition
G4Types.hh:83
G4bool
bool G4bool
Definition
G4Types.hh:86
G4int
int G4int
Definition
G4Types.hh:85
G4AffineTransform
G4AffineTransform is a class for geometric affine transformations. It supports efficient arbitrary ro...
Definition
G4AffineTransform.hh:69
G4AffineTransform::Product
G4AffineTransform & Product(const G4AffineTransform &tf1, const G4AffineTransform &tf2)
G4AffineTransform::G4AffineTransform
G4AffineTransform()
G4AffineTransform::InverseNetTranslation
G4ThreeVector InverseNetTranslation() const
G4AffineTransform::G4AffineTransform
G4AffineTransform(const G4RotationMatrix &rot, const G4ThreeVector &tlate)
G4AffineTransform::~G4AffineTransform
~G4AffineTransform()=default
G4AffineTransform::IsRotated
G4bool IsRotated() const
G4AffineTransform::Inverse
G4AffineTransform Inverse() const
G4AffineTransform::SetNetRotation
void SetNetRotation(const G4RotationMatrix &rot)
G4AffineTransform::operator=
G4AffineTransform & operator=(G4AffineTransform &&rhs)=default
G4AffineTransform::NetTranslation
G4ThreeVector NetTranslation() const
G4AffineTransform::G4AffineTransform
G4AffineTransform(const G4RotationMatrix *rot, const G4ThreeVector &tlate)
G4AffineTransform::InverseTransformAxis
G4ThreeVector InverseTransformAxis(const G4ThreeVector &axis) const
G4AffineTransform::operator+=
G4AffineTransform & operator+=(const G4ThreeVector &tlate)
G4AffineTransform::operator[]
G4double operator[](const G4int n) const
G4AffineTransform::Invert
G4AffineTransform & Invert()
G4AffineTransform::ApplyAxisTransform
void ApplyAxisTransform(G4ThreeVector &axis) const
G4AffineTransform::IsTranslated
G4bool IsTranslated() const
G4AffineTransform::operator=
G4AffineTransform & operator=(const G4AffineTransform &rhs)
G4AffineTransform::NetRotation
G4RotationMatrix NetRotation() const
G4AffineTransform::G4AffineTransform
G4AffineTransform(const G4AffineTransform &rhs)=default
G4AffineTransform::InverseProduct
G4AffineTransform & InverseProduct(const G4AffineTransform &tf1, const G4AffineTransform &tf2)
G4AffineTransform::TransformPoint
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
G4AffineTransform::operator==
G4bool operator==(const G4AffineTransform &tf) const
G4AffineTransform::TransformAxis
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const
G4AffineTransform::G4AffineTransform
G4AffineTransform(const G4RotationMatrix &rot)
G4AffineTransform::operator-=
G4AffineTransform & operator-=(const G4ThreeVector &tlate)
G4AffineTransform::InverseTransformPoint
G4ThreeVector InverseTransformPoint(const G4ThreeVector &vec) const
G4AffineTransform::operator*
G4AffineTransform operator*(const G4AffineTransform &tf) const
G4AffineTransform::ApplyPointTransform
void ApplyPointTransform(G4ThreeVector &vec) const
G4AffineTransform::G4AffineTransform
G4AffineTransform(const G4ThreeVector &tlate)
G4AffineTransform::operator*=
G4AffineTransform & operator*=(const G4AffineTransform &tf)
G4AffineTransform::G4AffineTransform
G4AffineTransform(G4AffineTransform &&rhs)=default
G4AffineTransform::SetNetTranslation
void SetNetTranslation(const G4ThreeVector &tlate)
G4AffineTransform::operator!=
G4bool operator!=(const G4AffineTransform &tf) const
G4AffineTransform::InverseNetRotation
G4RotationMatrix InverseNetRotation() const
axis
const axis_t axis_to_type< N >::axis
Definition
pugixml.cc:9668
geant4-v11.4.0
source
geometry
management
include
G4AffineTransform.hh
Generated by
1.16.1