Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BREPSolidPolyhedra.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//
27// $Id$
28//
29// ----------------------------------------------------------------------
30// Class G4BREPSolidPolyhedra
31//
32// Class description:
33//
34// The polygonal solid G4BREPSolidPolyhedra is a shape defined by an inner
35// and outer polygonal surface and two planes perpendicular to the Z axis.
36// Each polygonal surface is created by linking a series of polygons created
37// at different planes perpendicular to the Z-axis. All these polygons all
38// have the same number of sides (sides) and are defined at the same Z planes
39// for both inner and outer polygonal surfaces.
40//
41// G4BREPSolidPolyhedra( const G4String& name,
42// G4double phi1,
43// G4double dphi,
44// G4int sides,
45// G4int num_z_planes,
46// G4double z_start,
47// G4double z_values[],
48// G4double RMIN[],
49// G4double RMAX[] )
50
51// Authors: J.Sulkimo, P.Urban.
52// Revisions by: L.Broglia, S.Giani, G.Cosmo.
53// ----------------------------------------------------------------------
54#ifndef __G4BREPPOLYHEDRA
55#define __G4BREPPOLYHEDRA
56
57#include "G4BREPSolid.hh"
58
60{
61public: // with description
62
63 G4BREPSolidPolyhedra( const G4String& name,
64 G4double phi1,
65 G4double dphi,
66 G4int sides,
67 G4int num_z_planes,
68 G4double z_start,
69 G4double z_values[],
70 G4double RMIN[],
71 G4double RMAX[] );
72 // Constructor defining the polyhedra through its
73 // polygonal surfaces and planes.
74
76 // Destructor.
77
78 void Initialize();
79 // Calculates the bounding box.
80
81 EInside Inside(register const G4ThreeVector& Pt) const;
82 // Determines if the point Pt is inside, outside or on the surface
83 // of the solid.
84
86 // Calculates the normal of the surface at a point on the surface
87 // The sense of the normal depends on the sense of the surface.
88
90 // Calculates the shortest distance ("safety") from a point
91 // outside the solid to any boundary of this solid.
92 // Return 0 if the point is already inside.
93
94 G4double DistanceToIn(register const G4ThreeVector& Pt,
95 register const G4ThreeVector& V) const;
96 // Calculates the distance from a point Pt outside the solid
97 // to the solid's boundary along a specified direction vector V.
98 // Note: Intersections with boundaries less than the tolerance must
99 // be ignored if the direction is away from the boundary.
100
101 G4double DistanceToOut(register const G4ThreeVector& Pt,
102 register const G4ThreeVector& V,
103 const G4bool calcNorm=false,
104 G4bool *validNorm=0, G4ThreeVector *n=0) const;
105 // Calculates the distance from a point inside the solid to the solid`s
106 // boundary along a specified direction vector.
107 // Return 0 if the point is already outside.
108 // Note: If the shortest distance to a boundary is less than the
109 // tolerance, it is ignored. This allows for a point within a
110 // tolerant boundary to leave immediately.
111
113 // Calculates the shortest distance ("safety") from a point inside the
114 // solid to any boundary of this solid.
115 // Return 0 if the point is already outside.
116
117 G4VSolid* Clone() const;
118 // Returns a pointer of a dynamically allocated copy of the solid.
119
120 std::ostream& StreamInfo(std::ostream& os) const;
121 // Streams solid contents to output stream.
122
123public:
124
126 // Creates a G4Polyhedron
127
128 void Reset() const;
129 // Resets all distance attributes.
130
131public: // without description
132
133 G4BREPSolidPolyhedra(__void__&);
134 // Fake default constructor for usage restricted to direct object
135 // persistency for clients requiring preallocation of memory for
136 // persistifiable objects.
137
140 // Copy constructor and assignment operator.
141
142private:
143
144 typedef enum _SF {
145 EInverse = 0,
146 ENormal = 1
147 } ESurfaceSense;
148
149 void InitializePolyhedra();
150
151 G4Surface* CreateTrapezoidalSurface( G4double r1, G4double r2,
152 const G4Point3D& origin, G4double zDistance,
153 G4Vector3D& xAxis, G4double partAngle,
154 ESurfaceSense sense );
155
156 G4Surface* CreateTriangularSurface( G4double r1, G4double r2,
157 const G4Point3D& origin, G4double zDistance,
158 G4Vector3D& xAxis, G4double partAngle,
159 ESurfaceSense sense );
160
161 G4Surface* ComputePlanarSurface( G4double r1, G4double r2,
162 const G4Point3D& origin, G4Vector3D& xAxis,
163 G4int sides, G4double partAngle,
164 ESurfaceSense sense );
165
166 // The following is only utilised in storing the shape parameters for
167 // use in visualising this shape. J.A. Feb 24, 1997
168 //
169 // R. Chytracek, Nov 2002, Update to new IO dumping mechanism
170
171 struct G4BREPPolyhedraParams
172 {
173 G4double start_angle;
174 G4double opening_angle;
175 G4int sides;
176 G4int num_z_planes;
177 G4double z_start;
178 G4double* z_values;
179 G4double* RMIN;
180 G4double* RMAX;
181 } constructorParams;
182
183};
184
185#endif
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
G4ThreeVector SurfaceNormal(const G4ThreeVector &) const
G4Polyhedron * CreatePolyhedron() const
std::ostream & StreamInfo(std::ostream &os) const
G4BREPSolidPolyhedra & operator=(const G4BREPSolidPolyhedra &rhs)
EInside Inside(register const G4ThreeVector &Pt) const
G4double DistanceToIn(const G4ThreeVector &) const
G4double DistanceToOut(register const G4ThreeVector &Pt, register const G4ThreeVector &V, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
EInside
Definition: geomdefs.hh:58