source: trunk/source/geometry/solids/BREPS/include/G4BREPSolidPolyhedra.hh@ 1350

Last change on this file since 1350 was 1337, checked in by garnier, 15 years ago

tag geant4.9.4 beta 1 + modifs locales

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