Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VCSGfaceted.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// G4VCSGfaceted
27//
28// Class description:
29//
30// Virtual class defining CSG-like type shape that is built entirely
31// of G4CSGface faces.
32
33// Author: David C. Williams (UCSC), 1998 - Created
34// --------------------------------------------------------------------
35#ifndef G4VCSGFACETED_HH
36#define G4VCSGFACETED_HH 1
37
38#include "G4VSolid.hh"
39
40class G4VCSGface;
41class G4VisExtent;
42
43/**
44 * @brief G4VCSGfaceted is a virtual class defining a CSG-like type shape
45 * that is built entirely of G4CSGface faces.
46 */
47
48class G4VCSGfaceted : public G4VSolid
49{
50 public:
51
52 /**
53 * Constructor taking a 'name'.
54 */
55 G4VCSGfaceted( const G4String& name );
56
57 /**
58 * Destructor.
59 */
60 ~G4VCSGfaceted() override;
61
62 /**
63 * Copy constructor and assignment operator.
64 */
65 G4VCSGfaceted( const G4VCSGfaceted& source );
66 G4VCSGfaceted& operator=( const G4VCSGfaceted& source );
67
68 /**
69 * Calculates the minimum and maximum extent of the solid, when under the
70 * specified transform, and within the specified limits.
71 * @param[in] pAxis The axis along which compute the extent.
72 * @param[in] pVoxelLimit The limiting space dictated by voxels.
73 * @param[in] pTransform The internal transformation applied to the solid.
74 * @param[out] pMin The minimum extent value.
75 * @param[out] pMax The maximum extent value.
76 * @returns True if the solid is intersected by the extent region.
77 */
78 G4bool CalculateExtent( const EAxis pAxis,
79 const G4VoxelLimits& pVoxelLimit,
80 const G4AffineTransform& pTransform,
81 G4double& pmin, G4double& pmax) const override;
82
83 /**
84 * Concrete implementations of the expected query interfaces for
85 * solids, as defined in G4VSolid.
86 */
87 EInside Inside( const G4ThreeVector& p ) const override;
88 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
90 const G4ThreeVector& v ) const override;
91 G4double DistanceToIn( const G4ThreeVector& p ) const override;
93 const G4ThreeVector& v,
94 const G4bool calcNorm = false,
95 G4bool* validNorm = nullptr,
96 G4ThreeVector* n = nullptr ) const override;
97 G4double DistanceToOut( const G4ThreeVector& p ) const override;
98
99 /**
100 * Returns the type ID, "G4CSGfaceted" of the solid.
101 */
102 G4GeometryType GetEntityType() const override;
103
104 /**
105 * Streams the object contents to an output stream.
106 */
107 std::ostream& StreamInfo(std::ostream& os) const override;
108
109 /**
110 * Returns a pointer to a generated polyhedron used for visualisation.
111 */
112 G4Polyhedron* CreatePolyhedron() const override = 0;
113
114 /**
115 * Methods for creating graphical representations (i.e. for visualisation).
116 */
117 void DescribeYourselfTo( G4VGraphicsScene& scene ) const override;
118 G4VisExtent GetExtent() const override;
119 G4Polyhedron* GetPolyhedron () const override;
120
121 /**
122 * Accessors and modifiers for capacity and area computation.
123 */
126 void SetCubVolStatistics(G4int st);
127 void SetCubVolEpsilon(G4double ep);
128 G4int GetAreaStatistics() const;
130 void SetAreaStatistics(G4int st);
131 void SetAreaAccuracy(G4double ep);
132
133 /**
134 * Returning an estimation of the solid volume (capacity) and
135 * surface area, in internal units. Caches the computed value
136 * once computed the first time.
137 */
138 G4double GetCubicVolume() override;
139 G4double GetSurfaceArea() override;
140
141 /**
142 * Fake default constructor for usage restricted to direct object
143 * persistency for clients requiring preallocation of memory for
144 * persistifiable objects.
145 */
146 G4VCSGfaceted(__void__&);
147
148 protected:
149
150 /**
151 * Protected method used in DistanceToIn() and DistanceToOut().
152 */
153 virtual G4double DistanceTo( const G4ThreeVector& p,
154 const G4bool outgoing ) const;
155
156 /**
157 * Returns a random point located on the surface of the solid
158 * in case of generic Polycone or generic Polyhedra.
159 */
161
162 /**
163 * Copy parameters from other solid or reset them.
164 * Used in copy constructor and assignment operator.
165 */
166 void CopyStuff( const G4VCSGfaceted& source );
167 void DeleteStuff();
168
169 protected:
170
172 G4VCSGface **faces = nullptr;
175 mutable G4bool fRebuildPolyhedron = false;
176 mutable G4Polyhedron* fpPolyhedron = nullptr;
177
178 private:
179
180 /** Statistics, error accuracy for volume estimation. */
181 G4int fStatistics;
182 G4double fCubVolEpsilon;
183 G4double fAreaAccuracy;
184};
185
186#endif
CLHEP::Hep3Vector G4ThreeVector
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...
G4VCSGface is virtual base class, representing one side (or face) of a CSG-like solid....
void CopyStuff(const G4VCSGfaceted &source)
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
G4double GetCubVolEpsilon() const
G4Polyhedron * GetPolyhedron() const override
G4VCSGfaceted & operator=(const G4VCSGfaceted &source)
G4double fCubicVolume
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
G4int GetCubVolStatistics() const
void SetAreaStatistics(G4int st)
EInside Inside(const G4ThreeVector &p) const override
G4double GetSurfaceArea() override
G4VisExtent GetExtent() const override
G4VCSGface ** faces
void SetAreaAccuracy(G4double ep)
~G4VCSGfaceted() override
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
G4VCSGfaceted(const G4String &name)
G4Polyhedron * fpPolyhedron
G4bool fRebuildPolyhedron
G4Polyhedron * CreatePolyhedron() const override=0
G4double GetCubicVolume() override
G4int GetAreaStatistics() const
std::ostream & StreamInfo(std::ostream &os) const override
G4double GetAreaAccuracy() const
G4double fSurfaceArea
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
G4ThreeVector GetPointOnSurfaceGeneric() const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
virtual G4double DistanceTo(const G4ThreeVector &p, const G4bool outgoing) const
void SetCubVolEpsilon(G4double ep)
void SetCubVolStatistics(G4int st)
G4GeometryType GetEntityType() const override
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