source: trunk/source/geometry/solids/specific/include/G4PolyPhiFace.hh@ 833

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

import all except CVS

File size: 6.8 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: G4PolyPhiFace.hh,v 1.10 2007/05/11 13:54:28 gcosmo Exp $
28// GEANT4 tag $Name: $
29//
30//
31// --------------------------------------------------------------------
32// GEANT 4 class header file
33//
34//
35// G4PolyPhiFace
36//
37// Class description:
38//
39// Definition of a face that bounds a polycone or polyhedra when
40// it has a phi opening:
41//
42// G4PolyPhiFace( const G4ReduciblePolygon *rz,
43// G4double phi,
44// G4double deltaPhi,
45// G4double phiOther )
46//
47// Specifically: a face that lies on a plane that passes through
48// the z axis. It has boundaries that are straight lines of arbitrary
49// length and direction, but with corners aways on the same side of
50// the z axis.
51
52// Author:
53// David C. Williams (davidw@scipp.ucsc.edu)
54// --------------------------------------------------------------------
55
56#ifndef G4PolyPhiFace_hh
57#define G4PolyPhiFace_hh
58
59#include "G4VCSGface.hh"
60
61class G4ReduciblePolygon;
62
63struct G4PolyPhiFaceVertex
64{
65 G4double x, y, r, z; // position
66 G4double rNorm,
67 zNorm; // r/z normal
68 G4ThreeVector norm3D; // 3D normal
69};
70
71struct G4PolyPhiFaceEdge
72{
73 G4PolyPhiFaceEdge(): v0(0), v1(0) {}
74 G4PolyPhiFaceVertex *v0, *v1; // Corners
75 G4double tr, tz, // Unit vector along edge
76 length; // Length of edge
77 G4ThreeVector norm3D; // 3D edge normal vector
78};
79
80class G4PolyPhiFace : public G4VCSGface
81{
82
83 public: // with description
84
85 G4PolyPhiFace( const G4ReduciblePolygon *rz,
86 G4double phi, G4double deltaPhi, G4double phiOther );
87 // Constructor.
88 // Points r,z should be supplied in clockwise order in r,z.
89 // For example:
90 // [1]---------[2] ^ R
91 // | | |
92 // | | +--> z
93 // [0]---------[3]
94
95 virtual ~G4PolyPhiFace();
96 // Destructor. Removes edges and corners.
97
98 G4PolyPhiFace( const G4PolyPhiFace &source );
99 G4PolyPhiFace& operator=( const G4PolyPhiFace &source );
100 // Copy constructor and assgnment operator.
101
102 G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
103 G4bool outgoing, G4double surfTolerance,
104 G4double &distance, G4double &distFromSurface,
105 G4ThreeVector &normal, G4bool &allBehind );
106
107 G4double Distance( const G4ThreeVector &p, G4bool outgoing );
108
109 EInside Inside( const G4ThreeVector &p, G4double tolerance,
110 G4double *bestDistance );
111
112 G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
113
114 G4double Extent( const G4ThreeVector axis );
115
116 void CalculateExtent( const EAxis axis,
117 const G4VoxelLimits &voxelLimit,
118 const G4AffineTransform &tranform,
119 G4SolidExtentList &extentList );
120
121 inline G4VCSGface *Clone();
122 // Allocates on the heap a clone of this face.
123
124 public: // without description
125
126 G4PolyPhiFace(__void__&);
127 // Fake default constructor for usage restricted to direct object
128 // persistency for clients requiring preallocation of memory for
129 // persistifiable objects.
130
131 void Diagnose( G4VSolid *solid );
132 // Throw an exception if something is found inconsistent with
133 // the solid. For debugging purposes only
134
135 protected:
136
137 G4bool InsideEdgesExact( G4double r, G4double z, G4double normSign,
138 const G4ThreeVector &p, const G4ThreeVector &v );
139 // Decide if the point in r,z is inside the edges of our face,
140 // **but** do so consistently with other faces.
141
142 G4bool InsideEdges( G4double r, G4double z );
143 G4bool InsideEdges( G4double r, G4double z, G4double *distRZ2,
144 G4PolyPhiFaceVertex **base3Dnorm=0,
145 G4ThreeVector **head3Dnorm=0 );
146 // Decide if the point in r,z is inside the edges of our face.
147
148 inline G4double ExactZOrder( G4double z,
149 G4double qx, G4double qy, G4double qz,
150 const G4ThreeVector &v,
151 G4double normSign,
152 const G4PolyPhiFaceVertex *vert ) const;
153 // Decide precisely whether a trajectory passes to the left, right,
154 // or exactly passes through the z position of a vertex point in face.
155
156 void CopyStuff( const G4PolyPhiFace &source );
157
158 protected:
159
160 G4int numEdges; // Number of edges
161 G4PolyPhiFaceEdge *edges; // The edges of the face
162 G4PolyPhiFaceVertex *corners; // And the corners
163 G4ThreeVector normal; // Normal unit vector
164 G4ThreeVector radial; // Unit vector along radial direction
165 G4ThreeVector surface; // Point on surface
166 G4double rMin, rMax, // Extent in r
167 zMin, zMax; // Extent in z
168 G4bool allBehind; // True if the polycone/polyhedra
169 // is behind the place of this face
170 G4double kCarTolerance; // Surface thickness
171};
172
173#include "G4PolyPhiFace.icc"
174
175#endif
Note: See TracBrowser for help on using the repository browser.