Geant4  10.02.p01
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 80048 2014-03-31 12:47:09Z 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 #ifndef G4Polyhedra_hh
62 #define G4Polyhedra_hh
63 
64 #if defined(G4GEOM_USE_USOLIDS)
65 #define G4GEOM_USE_UPOLYHEDRA 1
66 #endif
67 
68 #if defined(G4GEOM_USE_UPOLYHEDRA)
69  #define G4UPolyhedra G4Polyhedra
70  #include "G4UPolyhedra.hh"
71 #else
72 
73 #include "G4VCSGfaceted.hh"
74 #include "G4PolyhedraSide.hh"
75 #include "G4PolyhedraHistorical.hh"
76 #include "G4Polyhedron.hh"
77 
79 class G4ReduciblePolygon;
80 
81 class G4Polyhedra : public G4VCSGfaceted
82 {
83  public: // with description
84 
85  G4Polyhedra( const G4String& name,
86  G4double phiStart, // initial phi starting angle
87  G4double phiTotal, // total phi angle
88  G4int numSide, // number sides
89  G4int numZPlanes, // number of z planes
90  const G4double zPlane[], // position of z planes
91  const G4double rInner[], // tangent distance to inner surface
92  const G4double rOuter[] ); // tangent distance to outer surface
93 
94  G4Polyhedra( const G4String& name,
95  G4double phiStart, // initial phi starting angle
96  G4double phiTotal, // total phi angle
97  G4int numSide, // number sides
98  G4int numRZ, // number corners in r,z space
99  const G4double r[], // r coordinate of these corners
100  const G4double z[] ); // z coordinate of these corners
101 
102  virtual ~G4Polyhedra();
103 
104  // Methods for solid
105 
106  EInside Inside( const G4ThreeVector &p ) const;
108  const G4ThreeVector &v ) const;
109  G4double DistanceToIn( const G4ThreeVector &p ) const;
110 
112  const G4int n,
113  const G4VPhysicalVolume* pRep);
114 
116 
117  G4VSolid* Clone() const;
118 
120 
121  std::ostream& StreamInfo( std::ostream& os ) const;
122 
124 
125  G4bool Reset();
126 
127  // Accessors
128 
129  inline G4int GetNumSide() const;
130  inline G4double GetStartPhi() const;
131  inline G4double GetEndPhi() const;
132  inline G4bool IsOpen() const;
133  inline G4bool IsGeneric() const;
134  inline G4int GetNumRZCorner() const;
135  inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
136 
138  // Returns internal scaled parameters.
139  inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
140  // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
141  // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
142  // if not already scaled.
143 
144  public: // without description
145 
146  G4Polyhedra(__void__&);
147  // Fake default constructor for usage restricted to direct object
148  // persistency for clients requiring preallocation of memory for
149  // persistifiable objects.
150 
151  G4Polyhedra( const G4Polyhedra &source );
152  G4Polyhedra &operator=( const G4Polyhedra &source );
153  // Copy constructor and assignment operator.
154 
155  protected: // without description
156 
158  // Sets internal parameters for the generic constructor.
159 
160  void Create( G4double phiStart, // initial phi starting angle
161  G4double phiTotal, // total phi angle
162  G4int numSide, // number sides
163  G4ReduciblePolygon *rz ); // rz coordinates
164  // Generates the shape and is called by each constructor, after the
165  // conversion of the arguments
166 
167  void CopyStuff( const G4Polyhedra &source );
168  void DeleteStuff();
169 
170  // Methods for generation of random points on surface
171 
173  G4ThreeVector p2, G4ThreeVector p3) const;
175  G4ThreeVector p2) const;
177 
178  protected: // without description
179 
180  G4int numSide; // Number of sides
181  G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
182  G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
183  G4bool phiIsOpen; // true if there is a phi segment
184  G4bool genericPgon; // true if created through the 2nd generic constructor
185  G4int numCorner; // number RZ points
186  G4PolyhedraSideRZ *corners; // our corners
187  G4PolyhedraHistorical *original_parameters; // original input parameters
188 
190 
191 };
192 
193 #include "G4Polyhedra.icc"
194 
195 #endif
196 
197 #endif
void CopyStuff(const G4Polyhedra &source)
Definition: G4Polyhedra.cc:431
virtual ~G4Polyhedra()
Definition: G4Polyhedra.cc:389
G4ThreeVector GetPointOnSurfaceCorners() const
CLHEP::Hep3Vector G4ThreeVector
G4GeometryType GetEntityType() const
Definition: G4Polyhedra.cc:581
G4double z
Definition: TRTMaterials.hh:39
G4PolyhedraHistorical * original_parameters
Definition: G4Polyhedra.hh:187
G4String name
Definition: TRTMaterials.hh:40
G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3) const
Definition: G4Polyhedra.cc:653
G4bool genericPgon
Definition: G4Polyhedra.hh:184
G4PolyhedraSideRZ * corners
Definition: G4Polyhedra.hh:186
G4bool Reset()
Definition: G4Polyhedra.cc:480
G4double GetEndPhi() const
int G4int
Definition: G4Types.hh:78
void Create(G4double phiStart, G4double phiTotal, G4int numSide, G4ReduciblePolygon *rz)
Definition: G4Polyhedra.cc:201
G4ThreeVector GetPointOnSurface() const
Definition: G4Polyhedra.cc:702
G4double endPhi
Definition: G4Polyhedra.hh:182
G4int GetNumRZCorner() const
G4EnclosingCylinder * enclosingCylinder
Definition: G4Polyhedra.hh:189
G4int GetNumSide() const
G4int numCorner
Definition: G4Polyhedra.hh:185
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Polyhedra.cc:570
bool G4bool
Definition: G4Types.hh:79
G4double startPhi
Definition: G4Polyhedra.hh:181
const G4int n
G4bool IsOpen() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Polyhedra.cc:542
EInside Inside(const G4ThreeVector &p) const
Definition: G4Polyhedra.cc:522
G4bool IsGeneric() const
G4Polyhedron * CreatePolyhedron() const
Definition: G4Polyhedra.cc:919
EInside
Definition: geomdefs.hh:58
void DeleteStuff()
G4PolyhedraHistorical * GetOriginalParameters() const
G4Polyhedra & operator=(const G4Polyhedra &source)
Definition: G4Polyhedra.cc:411
G4double GetStartPhi() const
G4PolyhedraSideRZ GetCorner(const G4int index) const
double G4double
Definition: G4Types.hh:76
void SetOriginalParameters(G4PolyhedraHistorical *pars)
G4ThreeVector GetPointOnTriangle(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2) const
Definition: G4Polyhedra.cc:685
G4bool phiIsOpen
Definition: G4Polyhedra.hh:183
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Polyhedra.cc:599
G4VSolid * Clone() const
Definition: G4Polyhedra.cc:590
G4Polyhedra(const G4String &name, G4double phiStart, G4double phiTotal, G4int numSide, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
Definition: G4Polyhedra.cc:79