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: G4PolyconeSide.hh,v 1.12 2008/05/15 11:41:58 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // -------------------------------------------------------------------- |
---|
32 | // GEANT 4 class header file |
---|
33 | // |
---|
34 | // |
---|
35 | // G4PolyconeSide |
---|
36 | // |
---|
37 | // Class description: |
---|
38 | // |
---|
39 | // Class implmenting a face that represents one conical side |
---|
40 | // of a polycone: |
---|
41 | // |
---|
42 | // G4PolyconeSide( const G4PolyconeSideRZ *prevRZ, |
---|
43 | // const G4PolyconeSideRZ *tail, |
---|
44 | // const G4PolyconeSideRZ *head, |
---|
45 | // const G4PolyconeSideRZ *nextRZ, |
---|
46 | // G4double phiStart, G4double deltaPhi, |
---|
47 | // G4bool phiIsOpen, G4bool isAllBehind=false ) |
---|
48 | // |
---|
49 | // Values for r1,z1 and r2,z2 should be specified in clockwise |
---|
50 | // order in (r,z). |
---|
51 | |
---|
52 | // Author: |
---|
53 | // David C. Williams (davidw@scipp.ucsc.edu) |
---|
54 | // -------------------------------------------------------------------- |
---|
55 | |
---|
56 | #ifndef G4PolyconeSide_hh |
---|
57 | #define G4PolyconeSide_hh |
---|
58 | |
---|
59 | #include "G4VCSGface.hh" |
---|
60 | |
---|
61 | class G4IntersectingCone; |
---|
62 | |
---|
63 | struct G4PolyconeSideRZ |
---|
64 | { |
---|
65 | G4double r, z; // start of vector |
---|
66 | }; |
---|
67 | |
---|
68 | class G4PolyconeSide : public G4VCSGface |
---|
69 | { |
---|
70 | public: |
---|
71 | |
---|
72 | G4PolyconeSide( const G4PolyconeSideRZ *prevRZ, |
---|
73 | const G4PolyconeSideRZ *tail, |
---|
74 | const G4PolyconeSideRZ *head, |
---|
75 | const G4PolyconeSideRZ *nextRZ, |
---|
76 | G4double phiStart, G4double deltaPhi, |
---|
77 | G4bool phiIsOpen, G4bool isAllBehind=false ); |
---|
78 | virtual ~G4PolyconeSide(); |
---|
79 | |
---|
80 | G4PolyconeSide( const G4PolyconeSide &source ); |
---|
81 | G4PolyconeSide& operator=( const G4PolyconeSide &source ); |
---|
82 | |
---|
83 | G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v, |
---|
84 | G4bool outgoing, G4double surfTolerance, |
---|
85 | G4double &distance, G4double &distFromSurface, |
---|
86 | G4ThreeVector &normal, G4bool &isAllBehind ); |
---|
87 | |
---|
88 | G4double Distance( const G4ThreeVector &p, G4bool outgoing ); |
---|
89 | |
---|
90 | EInside Inside( const G4ThreeVector &p, G4double tolerance, |
---|
91 | G4double *bestDistance ); |
---|
92 | |
---|
93 | G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance ); |
---|
94 | |
---|
95 | G4double Extent( const G4ThreeVector axis ); |
---|
96 | |
---|
97 | void CalculateExtent( const EAxis axis, |
---|
98 | const G4VoxelLimits &voxelLimit, |
---|
99 | const G4AffineTransform &tranform, |
---|
100 | G4SolidExtentList &extentList ); |
---|
101 | |
---|
102 | G4VCSGface *Clone() { return new G4PolyconeSide( *this ); } |
---|
103 | |
---|
104 | G4double SurfaceArea(); |
---|
105 | G4ThreeVector GetPointOnFace(); |
---|
106 | |
---|
107 | public: // without description |
---|
108 | |
---|
109 | G4PolyconeSide(__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 | G4double r[2], z[2]; // r, z parameters, in specified order |
---|
117 | G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen |
---|
118 | deltaPhi; // Delta phi (0 to 2pi), if phiIsOpen |
---|
119 | G4bool phiIsOpen; // True if there is a phi slice |
---|
120 | G4bool allBehind; // True if the entire solid is "behind" this face |
---|
121 | |
---|
122 | G4IntersectingCone *cone; // Our intersecting utility class |
---|
123 | |
---|
124 | G4double rNorm, zNorm; // Normal to surface in r,z space |
---|
125 | G4double rS, zS; // Unit vector along surface in r,z space |
---|
126 | G4double length; // Length of face in r,z space |
---|
127 | G4double prevRS, |
---|
128 | prevZS; // Unit vector along previous polyconeSide |
---|
129 | G4double nextRS, |
---|
130 | nextZS; // Unit vector along next polyconeSide |
---|
131 | |
---|
132 | G4double rNormEdge[2], |
---|
133 | zNormEdge[2]; // Normal to edges |
---|
134 | |
---|
135 | G4int ncorners; |
---|
136 | G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen) |
---|
137 | |
---|
138 | G4double DistanceAway( const G4ThreeVector &p, G4bool opposite, |
---|
139 | G4double &distOutside2, G4double *rzNorm=0 ); |
---|
140 | |
---|
141 | G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign, |
---|
142 | const G4ThreeVector &p, |
---|
143 | const G4ThreeVector &v, G4ThreeVector &normal ); |
---|
144 | |
---|
145 | void CopyStuff( const G4PolyconeSide &source ); |
---|
146 | |
---|
147 | static void FindLineIntersect( G4double x1, G4double y1, |
---|
148 | G4double tx1, G4double ty1, |
---|
149 | G4double x2, G4double y2, |
---|
150 | G4double tx2, G4double ty2, |
---|
151 | G4double &x, G4double &y ); |
---|
152 | private: |
---|
153 | |
---|
154 | G4double kCarTolerance; // Geometrical surface thickness |
---|
155 | G4double fSurfaceArea; // Used for surface calculation |
---|
156 | }; |
---|
157 | |
---|
158 | #endif |
---|