Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Polyhedra.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: G4Polyhedra.hh 67011 2013-01-29 16:17:41Z gcosmo $
28 //
29 //
30 // --------------------------------------------------------------------
31 // GEANT 4 class header file
32 //
33 //
34 // G4Polyhedra.hh
35 //
36 // Class description:
37 //
38 // Class implementing a CSG-like type "PGON" Geant 3.21 volume,
39 // inherited from class G4VCSGfaceted:
40 //
41 // G4Polyhedra( const G4String& name,
42 // G4double phiStart, - initial phi starting angle
43 // G4double phiTotal, - total phi angle
44 // G4int numSide, - number sides
45 // G4int numZPlanes, - number of z planes
46 // const G4double zPlane[], - position of z planes
47 // const G4double rInner[], - tangent distance to inner surface
48 // const G4double rOuter[] ) - tangent distance to outer surface
49 //
50 // G4Polyhedra( const G4String& name,
51 // G4double phiStart, - initial phi starting angle
52 // G4double phiTotal, - total phi angle
53 // G4int numSide, - number sides
54 // G4int numRZ, - number corners in r,z space
55 // const G4double r[], - r coordinate of these corners
56 // const G4double z[] ) - z coordinate of these corners
57 
58 // Author:
59 // David C. Williams (davidw@scipp.ucsc.edu)
60 // --------------------------------------------------------------------
61 
62 #ifndef G4Polyhedra_hh
63 #define G4Polyhedra_hh
64 
65 #include "G4VCSGfaceted.hh"
66 #include "G4PolyhedraSide.hh"
67 
69 class G4ReduciblePolygon;
71 {
72  public:
73 
78 
86 };
87 
88 class G4Polyhedra : public G4VCSGfaceted
89 {
90  public: // with description
91 
92  G4Polyhedra( const G4String& name,
93  G4double phiStart, // initial phi starting angle
94  G4double phiTotal, // total phi angle
95  G4int numSide, // number sides
96  G4int numZPlanes, // number of z planes
97  const G4double zPlane[], // position of z planes
98  const G4double rInner[], // tangent distance to inner surface
99  const G4double rOuter[] ); // tangent distance to outer surface
100 
101  G4Polyhedra( const G4String& name,
102  G4double phiStart, // initial phi starting angle
103  G4double phiTotal, // total phi angle
104  G4int numSide, // number sides
105  G4int numRZ, // number corners in r,z space
106  const G4double r[], // r coordinate of these corners
107  const G4double z[] ); // z coordinate of these corners
108 
109  virtual ~G4Polyhedra();
110 
111  // Methods for solid
112 
113  EInside Inside( const G4ThreeVector &p ) const;
115  const G4ThreeVector &v ) const;
116  G4double DistanceToIn( const G4ThreeVector &p ) const;
117 
119  const G4int n,
120  const G4VPhysicalVolume* pRep);
121 
123 
124  G4VSolid* Clone() const;
125 
127 
128  std::ostream& StreamInfo( std::ostream& os ) const;
129 
131  G4NURBS* CreateNURBS() const;
132 
133  G4bool Reset();
134 
135  // Accessors
136 
137  inline G4int GetNumSide() const;
138  inline G4double GetStartPhi() const;
139  inline G4double GetEndPhi() const;
140  inline G4bool IsOpen() const;
141  inline G4bool IsGeneric() const;
142  inline G4int GetNumRZCorner() const;
143  inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
144 
146  // Returns internal scaled parameters.
147  inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
148  // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
149  // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
150  // if not already scaled.
151 
152  public: // without description
153 
154  G4Polyhedra(__void__&);
155  // Fake default constructor for usage restricted to direct object
156  // persistency for clients requiring preallocation of memory for
157  // persistifiable objects.
158 
159  G4Polyhedra( const G4Polyhedra &source );
160  const G4Polyhedra &operator=( const G4Polyhedra &source );
161  // Copy constructor and assignment operator.
162 
163  protected: // without description
164 
165  inline void SetOriginalParameters();
166  // Sets internal parameters for the generic constructor.
167 
168  void Create( G4double phiStart, // initial phi starting angle
169  G4double phiTotal, // total phi angle
170  G4int numSide, // number sides
171  G4ReduciblePolygon *rz ); // rz coordinates
172  // Generates the shape and is called by each constructor, after the
173  // conversion of the arguments
174 
175  void CopyStuff( const G4Polyhedra &source );
176  void DeleteStuff();
177 
178  // Methods for generation of random points on surface
179 
181  G4ThreeVector p2, G4ThreeVector p3) const;
183  G4ThreeVector p2) const;
185 
186  protected: // without description
187 
188  G4int numSide; // Number of sides
189  G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
190  G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
191  G4bool phiIsOpen; // true if there is a phi segment
192  G4bool genericPgon; // true if created through the 2nd generic constructor
193  G4int numCorner; // number RZ points
194  G4PolyhedraSideRZ *corners; // our corners
195  G4PolyhedraHistorical *original_parameters; // original input parameters
196 
198 
199 };
200 
201 #include "G4Polyhedra.icc"
202 
203 #endif