Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BREPSolidPCone.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 G4BREPSolidPCone
31 //
32 // Class description:
33 //
34 // The polyconical solid G4BREPSolidPCone is a shape defined by a set of
35 // inner and outer conical or cylindrical surface sections and two planes
36 // perpendicular to the Z axis. Each conical surface is defined by its
37 // radius at two different planes perpendicular to the Z-axis. Inner and
38 // outer conical surfaces are defined using common Z planes:
39 //
40 // G4BREPSolidPCone( const G4String& name,
41 // G4double start_angle,
42 // G4double opening_angle,
43 // G4int num_z_planes,
44 // G4double z_start,
45 // G4double z_values[],
46 // G4double RMIN[],
47 // G4double RMAX[] )
48 
49 // Authors: J.Sulkimo, P.Urban.
50 // Revisions by: L.Broglia, S.Giani, G.Cosmo.
51 // ----------------------------------------------------------------------
52 #ifndef __G4BREPSolidPCone
53 #define __G4BREPSolidPCone
54 
55 #include "G4BREPSolid.hh"
56 
58 {
59 
60  public: // with description
61 
63  G4double start_angle,
64  G4double opening_angle,
65  G4int num_z_planes, // sections
66  G4double z_start,
67  G4double z_values[],
68  G4double RMIN[],
69  G4double RMAX[] );
70  // Constructor defining the polycone through its
71  // conical/cylindrical surfaces.
72 
74  // Destructor.
75 
76  void Initialize();
77  // Calculates the bounding box.
78 
79  EInside Inside(register const G4ThreeVector& Pt) const;
80  // Determines if the point Pt is inside, outside or on the surface
81  // of the solid.
82 
84  // Calculates the normal of the surface at a point on the surface
85  // The sense of the normal depends on the sense of the surface.
86 
87  G4double DistanceToIn(const G4ThreeVector&) const;
88  // Calculates the shortest distance ("safety") from a point
89  // outside the solid to any boundary of this solid.
90  // Return 0 if the point is already inside.
91 
92  G4double DistanceToIn(register const G4ThreeVector& Pt,
93  register const G4ThreeVector& V) const;
94  // Calculates the distance from a point Pt outside the solid
95  // to the solid's boundary along a specified direction vector V.
96  // Note: Intersections with boundaries less than the tolerance must
97  // be ignored if the direction is away from the boundary.
98 
99  G4double DistanceToOut(register const G4ThreeVector& Pt,
100  register const G4ThreeVector& V,
101  const G4bool calcNorm=false,
102  G4bool *validNorm=0, G4ThreeVector *n=0) const;
103  // Calculates the distance from a point inside the solid to the solid`s
104  // boundary along a specified direction vector.
105  // Return 0 if the point is already outside.
106  // Note: If the shortest distance to a boundary is less than the
107  // tolerance, it is ignored. This allows for a point within a
108  // tolerant boundary to leave immediately.
109 
110  G4double DistanceToOut(const G4ThreeVector&) const;
111  // Calculates the shortest distance ("safety") from a point inside the
112  // solid to any boundary of this solid.
113  // Return 0 if the point is already outside.
114 
115 public:
116 
117  void Reset() const;
118  // Resets all distance attributes.
119 
120  G4Polyhedron* CreatePolyhedron () const;
121  // Creates a G4Polyhedron
122 
123  G4VSolid* Clone() const;
124  // Returns a pointer of a dynamically allocated copy of the solid.
125 
126  std::ostream& StreamInfo(std::ostream& os) const;
127  // Streams solid contents to output stream.
128 
129 public: // without description
130 
131  G4BREPSolidPCone(__void__&);
132  // Fake default constructor for usage restricted to direct object
133  // persistency for clients requiring preallocation of memory for
134  // persistifiable objects.
135 
138  // Copy constructor and assignment operator.
139 
140 private:
141 
142  void InitializePCone();
143 
144  G4Surface* ComputePlanarSurface( G4double r1, G4double r2,
145  G4ThreeVector& origin,
146  G4ThreeVector& planeAxis,
147  G4ThreeVector& planeDirection,
148  G4int surfSense );
149  // For a given radius values compute a planar surface
150 
151  // The following is only utilised in storing the shape parameters for
152  // use in visualising this shape. J.A. Feb 24, 1997
153  // R. Chytracek, Nov 2002, Update to new IO dumping mechanism
154 
155  struct G4BREPPConeParams
156  {
157  G4double start_angle;
158  G4double opening_angle;
159  G4int num_z_planes;
160  G4double z_start;
161  G4double* z_values;
162  G4double* RMIN;
163  G4double* RMAX;
164  } constructorParams;
165 };
166 
167 #endif