Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4SubtractionSolid.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// G4SubtractionSolid
27//
28// Class description:
29//
30// Class for description of subtraction of two solids: A - B.
31
32// Author: Vladimir Grichine (CERN), 14.10.1998 - First implementation
33// --------------------------------------------------------------------
34#ifndef G4SUBTRACTIONSOLID_HH
35#define G4SUBTRACTIONSOLID_HH
36
37#include "G4BooleanSolid.hh"
38#include "G4VSolid.hh"
39
40#include "G4RotationMatrix.hh"
41#include "G4ThreeVector.hh"
42#include "G4Transform3D.hh"
43#include "G4AffineTransform.hh"
44
45/**
46 * @brief G4SubtractionSolid is a solid describing the Boolean subtraction
47 * of two solids.
48 */
49
51{
52 public:
53
54 /**
55 * Constructor of a Boolean subtraction between two solids with no
56 * displacement.
57 * @param[in] pName The name of the Boolean composition.
58 * @param[in] pSolidA Pointer to the first reference solid.
59 * @param[in] pSolidB Pointer to the second solid to form the composition.
60 */
61 G4SubtractionSolid( const G4String& pName,
62 G4VSolid* pSolidA ,
63 G4VSolid* pSolidB ) ;
64
65 /**
66 * Constructor of a Boolean subtraction between two solids with rotation
67 * and translation, used to transform the coordinate system of the second
68 * solid to the coordinate system of the first solid.
69 * @param[in] pName The name of the Boolean composition.
70 * @param[in] pSolidA Pointer to the first reference solid.
71 * @param[in] pSolidB Pointer to the second solid to form the composition.
72 * @param[in] rotMatrix Pointer to the rotation vector.
73 * @param[in] transVector The translation vector.
74 */
75 G4SubtractionSolid( const G4String& pName,
76 G4VSolid* pSolidA ,
77 G4VSolid* pSolidB ,
78 G4RotationMatrix* rotMatrix,
79 const G4ThreeVector& transVector ) ;
80
81 /**
82 * Constructor of a Boolean subtraction between two solids with a
83 * transformation that moves the second solid from its desired position
84 * to its standard position.
85 * @param[in] pName The name of the Boolean composition.
86 * @param[in] pSolidA Pointer to the first reference solid.
87 * @param[in] pSolidB Pointer to the second solid to form the composition.
88 * @param[in] transform The composed 3D transformation.
89 */
90 G4SubtractionSolid( const G4String& pName,
91 G4VSolid* pSolidA ,
92 G4VSolid* pSolidB ,
93 const G4Transform3D& transform ) ;
94
95 /**
96 * Default destructor.
97 */
98 ~G4SubtractionSolid() override = default ;
99
100 /**
101 * Fake default constructor for usage restricted to direct object
102 * persistency for clients requiring preallocation of memory for
103 * persistifiable objects.
104 */
105 G4SubtractionSolid(__void__&);
106
107 /**
108 * Copy constructor and assignment operator.
109 */
112
113 /**
114 * Returns the type ID, "G4SubtractionSolid" of the solid.
115 */
116 G4GeometryType GetEntityType() const override ;
117
118 /**
119 * Makes a clone of the object for use in multi-treading.
120 * @returns A pointer to the new cloned allocated solid.
121 */
122 G4VSolid* Clone() const override;
123
124 /**
125 * Computes the bounding limits of the solid.
126 * @param[out] pMin The minimum bounding limit point.
127 * @param[out] pMax The maximum bounding limit point.
128 */
129 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
130
131 /**
132 * Calculates the minimum and maximum extent of the solid, when under the
133 * specified transform, and within the specified limits.
134 * @param[in] pAxis The axis along which compute the extent.
135 * @param[in] pVoxelLimit The limiting space dictated by voxels.
136 * @param[in] pTransform The internal transformation applied to the solid.
137 * @param[out] pMin The minimum extent value.
138 * @param[out] pMax The maximum extent value.
139 * @returns True if the solid is intersected by the extent region.
140 */
141 G4bool CalculateExtent( const EAxis pAxis,
142 const G4VoxelLimits& pVoxelLimit,
143 const G4AffineTransform& pTransform,
144 G4double& pMin, G4double& pMax) const override ;
145
146 /**
147 * Returns if the given point "p" is inside or not the solid.
148 */
149 EInside Inside( const G4ThreeVector& p ) const override ;
150
151 /**
152 * Returns the outwards pointing unit normal of the shape for the
153 * surface closest to the point at offset "p".
154 */
155 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override ;
156
157 /**
158 * Returns the distance along the normalised vector "v" to the shape,
159 * from the point at offset "p". If there is no intersection, return
160 * kInfinity. The first intersection resulting from leaving a
161 * surface/volume is discarded. Hence, it is tolerant of points on
162 * the surface of the shape.
163 */
165 const G4ThreeVector& v ) const override ;
166
167 /**
168 * Calculates the safety distance to the nearest surface of a shape from
169 * an outside point. The distance can be an underestimate.
170 */
171 G4double DistanceToIn( const G4ThreeVector& p) const override ;
172
173 /**
174 * Returns the distance along the normalised vector "v" to the shape,
175 * from a point at an offset "p" inside or on the surface of the shape.
176 * Intersections with surfaces, when the point is < Tolerance/2 from a
177 * surface must be ignored. Must be called as solid.DistanceToOut(p,v)
178 * or by specifying all the parameters.
179 * @param[in] p The reference point in space.
180 * @param[in] v The normalised direction.
181 * @param[in] calcNorm Flag to enable the normal computation or not.
182 * @param[out] validNorm Set to true if the solid lies entirely behind
183 * or on the exiting surface (calcNorm must be true, otherwise
184 * it is unused).
185 * @param[out] n The exiting outwards normal vector (undefined Magnitude).
186 * (calcNorm must be true, otherwise it is unused).
187 * @returns The distance value to exit the volume.
188 */
190 const G4ThreeVector& v,
191 const G4bool calcNorm = false,
192 G4bool* validNorm = nullptr,
193 G4ThreeVector* n = nullptr ) const override ;
194
195 /**
196 * Calculates the safety distance to the nearest surface of a shape from
197 * an inside point "p". The distance can be an underestimate.
198 */
199 G4double DistanceToOut( const G4ThreeVector& p ) const override ;
200
201 /**
202 * Throws an exception as paramterisations are not allowed for these solids.
203 */
205 const G4int n,
206 const G4VPhysicalVolume* pRep ) override ;
207
208 /**
209 * Methods for creating graphical representations (i.e. for visualisation).
210 */
211 void DescribeYourselfTo ( G4VGraphicsScene& scene ) const override ;
212 G4Polyhedron* CreatePolyhedron () const override ;
213
214 /**
215 * Returns an estimate of the capacity of the Boolean composition.
216 */
217 G4double GetCubicVolume() final;
218};
219
220#endif
CLHEP::HepRotation G4RotationMatrix
CLHEP::Hep3Vector G4ThreeVector
HepGeom::Transform3D G4Transform3D
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4String G4GeometryType
Definition G4VSolid.hh:70
G4AffineTransform is a class for geometric affine transformations. It supports efficient arbitrary ro...
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
G4double GetCubicVolume() final
G4VSolid * Clone() const override
G4SubtractionSolid & operator=(const G4SubtractionSolid &rhs)
EInside Inside(const G4ThreeVector &p) const override
G4GeometryType GetEntityType() const override
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const override
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
G4SubtractionSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
G4SubtractionSolid(const G4SubtractionSolid &rhs)
~G4SubtractionSolid() override=default
G4Polyhedron * CreatePolyhedron() const override
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid(const G4String &name)
Definition G4VSolid.cc:59
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67