source: trunk/source/geometry/solids/specific/include/G4PolyhedraSide.hh@ 840

Last change on this file since 840 was 831, checked in by garnier, 17 years ago

import all except CVS

File size: 7.4 KB
RevLine 
[831]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: G4PolyhedraSide.hh,v 1.9 2007/05/11 13:54:28 gcosmo Exp $
28// GEANT4 tag $Name: $
29//
30//
31// --------------------------------------------------------------------
32// GEANT 4 class header file
33//
34//
35// G4PolyhedraSide
36//
37// Class description:
38//
39// Class implementing a face that represents one segmented side
40// of a polyhedra:
41//
42// G4PolyhedraSide( const G4PolyhedraSideRZ *prevRZ,
43// const G4PolyhedraSideRZ *tail,
44// const G4PolyhedraSideRZ *head,
45// const G4PolyhedraSideRZ *nextRZ,
46// G4int numSide,
47// G4double phiStart, G4double phiTotal,
48// G4bool phiIsOpen, G4bool isAllBehind=false )
49//
50// Values for r1,z1 and r2,z2 should be specified in clockwise
51// order in (r,z).
52
53// Author:
54// David C. Williams (davidw@scipp.ucsc.edu)
55// --------------------------------------------------------------------
56
57#ifndef G4PolyhedraSide_hh
58#define G4PolyhedraSide_hh
59
60#include "G4VCSGface.hh"
61
62class G4IntersectingCone;
63
64struct G4PolyhedraSideRZ
65{
66 G4double r, z; // start of vector
67};
68
69class G4PolyhedraSide : public G4VCSGface
70{
71
72 public:
73
74 G4PolyhedraSide( const G4PolyhedraSideRZ *prevRZ,
75 const G4PolyhedraSideRZ *tail,
76 const G4PolyhedraSideRZ *head,
77 const G4PolyhedraSideRZ *nextRZ,
78 G4int numSide,
79 G4double phiStart, G4double phiTotal,
80 G4bool phiIsOpen, G4bool isAllBehind=false );
81 virtual ~G4PolyhedraSide();
82
83 G4PolyhedraSide( const G4PolyhedraSide &source );
84 G4PolyhedraSide& operator=( const G4PolyhedraSide &source );
85
86 G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
87 G4bool outgoing, G4double surfTolerance,
88 G4double &distance, G4double &distFromSurface,
89 G4ThreeVector &normal, G4bool &allBehind );
90
91 G4double Distance( const G4ThreeVector &p, G4bool outgoing );
92
93 EInside Inside( const G4ThreeVector &p, G4double tolerance,
94 G4double *bestDistance );
95
96 G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
97
98 G4double Extent( const G4ThreeVector axis );
99
100 void CalculateExtent( const EAxis axis,
101 const G4VoxelLimits &voxelLimit,
102 const G4AffineTransform &tranform,
103 G4SolidExtentList &extentList );
104
105 G4VCSGface *Clone() { return new G4PolyhedraSide( *this ); }
106
107 public: // without description
108
109 G4PolyhedraSide(__void__&);
110 // Fake default constructor for usage restricted to direct object
111 // persistency for clients requiring preallocation of memory for
112 // persistifiable objects.
113
114 protected:
115
116 //
117 // A couple internal data structures
118 //
119 struct sG4PolyhedraSideVec; // Secret recipe for allowing
120 friend struct sG4PolyhedraSideVec; // protected nested structures
121
122 typedef struct sG4PolyhedraSideEdge
123 {
124 G4ThreeVector normal; // Unit normal to this edge
125 G4ThreeVector corner[2]; // The two corners of this phi edge
126 G4ThreeVector cornNorm[2]; // The normals of these corners
127 } G4PolyhedraSideEdge;
128
129 typedef struct sG4PolyhedraSideVec
130 {
131 G4ThreeVector normal, // Normal (point out of the shape)
132 center, // Point in center of side
133 surfPhi, // Unit vector on surface pointing along phi
134 surfRZ; // Unit vector on surface pointing along R/Z
135 G4PolyhedraSideEdge *edges[2]; // The phi boundary edges to this side
136 // [0]=low phi [1]=high phi
137 G4ThreeVector edgeNorm[2]; // RZ edge normals [i] at {r[i],z[i]}
138 } G4PolyhedraSideVec;
139
140 G4bool IntersectSidePlane( const G4ThreeVector &p, const G4ThreeVector &v,
141 const G4PolyhedraSideVec vec,
142 G4double normSign,
143 G4double surfTolerance,
144 G4double &distance,
145 G4double &distFromSurface );
146
147 G4int LineHitsSegments( const G4ThreeVector &p,
148 const G4ThreeVector &v,
149 G4int *i1, G4int *i2 );
150
151 G4int ClosestPhiSegment( G4double phi );
152
153 G4int PhiSegment( G4double phi );
154
155 G4double DistanceToOneSide( const G4ThreeVector &p,
156 const G4PolyhedraSideVec &vec,
157 G4double *normDist );
158
159 G4double DistanceAway( const G4ThreeVector &p,
160 const G4PolyhedraSideVec &vec,
161 G4double *normDist );
162
163 void CopyStuff( const G4PolyhedraSide &source );
164
165 protected:
166
167 G4int numSide; // Number sides
168 G4double r[2], z[2]; // r, z parameters, in specified order
169 G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
170 deltaPhi, // Delta phi (0 to 2pi), if phiIsOpen
171 endPhi; // End phi (>startPhi), if phiIsOpen
172 G4bool phiIsOpen; // True if there is a phi slice
173 G4bool allBehind; // True if the entire solid is "behind" this face
174
175 G4IntersectingCone *cone; // Our intersecting cone
176
177 G4PolyhedraSideVec *vecs; // Vector set for each facet of our face
178 G4PolyhedraSideEdge *edges; // The edges belong to vecs
179 G4double lenRZ, // RZ length of each side
180 lenPhi[2]; // Phi dimensions of each side
181 G4double edgeNorm; // Normal in RZ/Phi space to each side
182
183 private:
184
185 G4double kCarTolerance; // Geometrical surface thickness
186};
187
188#endif
Note: See TracBrowser for help on using the repository browser.