Geant4  10.00.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 76263 2013-11-08 11:41:52Z 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 
78 class G4ReduciblePolygon;
79 
80 class G4Polyhedra : public G4VCSGfaceted
81 {
82  public: // with description
83 
84  G4Polyhedra( const G4String& name,
85  G4double phiStart, // initial phi starting angle
86  G4double phiTotal, // total phi angle
87  G4int numSide, // number sides
88  G4int numZPlanes, // number of z planes
89  const G4double zPlane[], // position of z planes
90  const G4double rInner[], // tangent distance to inner surface
91  const G4double rOuter[] ); // tangent distance to outer surface
92 
93  G4Polyhedra( const G4String& name,
94  G4double phiStart, // initial phi starting angle
95  G4double phiTotal, // total phi angle
96  G4int numSide, // number sides
97  G4int numRZ, // number corners in r,z space
98  const G4double r[], // r coordinate of these corners
99  const G4double z[] ); // z coordinate of these corners
100 
101  virtual ~G4Polyhedra();
102 
103  // Methods for solid
104 
105  EInside Inside( const G4ThreeVector &p ) const;
107  const G4ThreeVector &v ) const;
108  G4double DistanceToIn( const G4ThreeVector &p ) const;
109 
111  const G4int n,
112  const G4VPhysicalVolume* pRep);
113 
115 
116  G4VSolid* Clone() const;
117 
119 
120  std::ostream& StreamInfo( std::ostream& os ) const;
121 
123 
124  G4bool Reset();
125 
126  // Accessors
127 
128  inline G4int GetNumSide() const;
129  inline G4double GetStartPhi() const;
130  inline G4double GetEndPhi() const;
131  inline G4bool IsOpen() const;
132  inline G4bool IsGeneric() const;
133  inline G4int GetNumRZCorner() const;
134  inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
135 
137  // Returns internal scaled parameters.
138  inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
139  // Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
140  // be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
141  // if not already scaled.
142 
143  public: // without description
144 
145  G4Polyhedra(__void__&);
146  // Fake default constructor for usage restricted to direct object
147  // persistency for clients requiring preallocation of memory for
148  // persistifiable objects.
149 
150  G4Polyhedra( const G4Polyhedra &source );
151  const G4Polyhedra &operator=( const G4Polyhedra &source );
152  // Copy constructor and assignment operator.
153 
154  protected: // without description
155 
157  // Sets internal parameters for the generic constructor.
158 
159  void Create( G4double phiStart, // initial phi starting angle
160  G4double phiTotal, // total phi angle
161  G4int numSide, // number sides
162  G4ReduciblePolygon *rz ); // rz coordinates
163  // Generates the shape and is called by each constructor, after the
164  // conversion of the arguments
165 
166  void CopyStuff( const G4Polyhedra &source );
167  void DeleteStuff();
168 
169  // Methods for generation of random points on surface
170 
172  G4ThreeVector p2, G4ThreeVector p3) const;
174  G4ThreeVector p2) const;
176 
177  protected: // without description
178 
179  G4int numSide; // Number of sides
180  G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
181  G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
182  G4bool phiIsOpen; // true if there is a phi segment
183  G4bool genericPgon; // true if created through the 2nd generic constructor
184  G4int numCorner; // number RZ points
185  G4PolyhedraSideRZ *corners; // our corners
186  G4PolyhedraHistorical *original_parameters; // original input parameters
187 
189 
190 };
191 
192 #include "G4Polyhedra.icc"
193 
194 #endif
195 
196 #endif
void CopyStuff(const G4Polyhedra &source)
Definition: G4Polyhedra.cc:421
virtual ~G4Polyhedra()
Definition: G4Polyhedra.cc:379
G4ThreeVector GetPointOnSurfaceCorners() const
CLHEP::Hep3Vector G4ThreeVector
G4GeometryType GetEntityType() const
Definition: G4Polyhedra.cc:568
G4double z
Definition: TRTMaterials.hh:39
G4PolyhedraHistorical * original_parameters
Definition: G4Polyhedra.hh:186
G4String name
Definition: TRTMaterials.hh:40
G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3) const
Definition: G4Polyhedra.cc:639
G4bool genericPgon
Definition: G4Polyhedra.hh:183
G4PolyhedraSideRZ * corners
Definition: G4Polyhedra.hh:185
const G4Polyhedra & operator=(const G4Polyhedra &source)
Definition: G4Polyhedra.cc:401
G4bool Reset()
Definition: G4Polyhedra.cc:467
G4double GetEndPhi() const
int G4int
Definition: G4Types.hh:78
void Create(G4double phiStart, G4double phiTotal, G4int numSide, G4ReduciblePolygon *rz)
Definition: G4Polyhedra.cc:193
G4ThreeVector GetPointOnSurface() const
Definition: G4Polyhedra.cc:688
G4double endPhi
Definition: G4Polyhedra.hh:181
G4int GetNumRZCorner() const
G4EnclosingCylinder * enclosingCylinder
Definition: G4Polyhedra.hh:188
G4int GetNumSide() const
G4int numCorner
Definition: G4Polyhedra.hh:184
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4Polyhedra.cc:557
bool G4bool
Definition: G4Types.hh:79
G4double startPhi
Definition: G4Polyhedra.hh:180
const G4int n
G4bool IsOpen() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
Definition: G4Polyhedra.cc:529
EInside Inside(const G4ThreeVector &p) const
Definition: G4Polyhedra.cc:509
G4bool IsGeneric() const
G4Polyhedron * CreatePolyhedron() const
Definition: G4Polyhedra.cc:905
EInside
Definition: geomdefs.hh:58
void DeleteStuff()
G4PolyhedraHistorical * GetOriginalParameters() const
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:671
G4bool phiIsOpen
Definition: G4Polyhedra.hh:182
std::ostream & StreamInfo(std::ostream &os) const
Definition: G4Polyhedra.cc:586
G4VSolid * Clone() const
Definition: G4Polyhedra.cc:577
G4Polyhedra(const G4String &name, G4double phiStart, G4double phiTotal, G4int numSide, G4int numZPlanes, const G4double zPlane[], const G4double rInner[], const G4double rOuter[])
Definition: G4Polyhedra.cc:80