source: trunk/source/geometry/solids/CSG/include/G4Cons.hh@ 883

Last change on this file since 883 was 850, checked in by garnier, 17 years ago

geant4.8.2 beta

File size: 7.0 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: G4Cons.hh,v 1.18 2007/05/18 07:38:00 gcosmo Exp $
28// GEANT4 tag $Name: HEAD $
29//
30//
31// --------------------------------------------------------------------
32// GEANT 4 class header file
33//
34// G4Cons
35//
36// Class description:
37//
38// A G4Cons is, in the general case, a Phi segment of a cone, with
39// half-length fDz, inner and outer radii specified at -fDz and +fDz.
40// The Phi segment is described by a starting fSPhi angle, and the
41// +fDPhi delta angle for the shape.
42// If the delta angle is >=2*pi, the shape is treated as continuous
43// in Phi
44//
45// Member Data:
46//
47// fRmin1 inside radius at -fDz
48// fRmin2 inside radius at +fDz
49// fRmax1 outside radius at -fDz
50// fRmax2 outside radius at +fDz
51// fDz half length in z
52//
53// fSPhi starting angle of the segment in radians
54// fDPhi delta angle of the segment in radians
55//
56// Note:
57// Internally fSPhi & fDPhi are adjusted so that fDPhi<=2PI,
58// and fDPhi+fSPhi<=2PI. This enables simpler comparisons to be
59// made with (say) Phi of a point.
60
61// History:
62// 19.3.94 P.Kent: Old C++ code converted to tolerant geometry
63// 13.9.96 V.Grichine: Final modifications to commit
64// --------------------------------------------------------------------
65
66#ifndef G4Cons_HH
67#define G4Cons_HH
68
69#include "G4CSGSolid.hh"
70
71class G4Cons : public G4CSGSolid
72{
73 public: // with description
74
75 G4Cons(const G4String& pName,
76 G4double pRmin1, G4double pRmax1,
77 G4double pRmin2, G4double pRmax2,
78 G4double pDz,
79 G4double pSPhi, G4double pDPhi);
80
81 virtual ~G4Cons() ;
82
83 // Accessors
84
85 inline G4double GetInnerRadiusMinusZ() const;
86 inline G4double GetOuterRadiusMinusZ() const;
87 inline G4double GetInnerRadiusPlusZ() const;
88 inline G4double GetOuterRadiusPlusZ() const;
89
90 inline G4double GetZHalfLength() const;
91
92 inline G4double GetStartPhiAngle () const;
93 inline G4double GetDeltaPhiAngle () const;
94
95 // Modifiers
96
97 inline void SetInnerRadiusMinusZ( G4double Rmin1 );
98 inline void SetOuterRadiusMinusZ( G4double Rmax1 );
99 inline void SetInnerRadiusPlusZ ( G4double Rmin2 );
100 inline void SetOuterRadiusPlusZ ( G4double Rmax2 );
101
102 inline void SetZHalfLength ( G4double newDz );
103 inline void SetStartPhiAngle ( G4double newSPhi);
104 inline void SetDeltaPhiAngle ( G4double newDPhi);
105
106 // Other methods for solid
107
108 inline G4double GetCubicVolume();
109 inline G4double GetSurfaceArea();
110
111 void ComputeDimensions(G4VPVParameterisation* p,
112 const G4int n,
113 const G4VPhysicalVolume* pRep);
114
115 G4bool CalculateExtent(const EAxis pAxis,
116 const G4VoxelLimits& pVoxelLimit,
117 const G4AffineTransform& pTransform,
118 G4double& pmin, G4double& pmax) const;
119
120 EInside Inside(const G4ThreeVector& p) const;
121
122 G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
123
124 G4double DistanceToIn(const G4ThreeVector& p,
125 const G4ThreeVector& v) const;
126 G4double DistanceToIn(const G4ThreeVector& p) const;
127 G4double DistanceToOut(const G4ThreeVector& p,
128 const G4ThreeVector& v,
129 const G4bool calcNorm=G4bool(false),
130 G4bool *validNorm=0,
131 G4ThreeVector *n=0) const;
132 G4double DistanceToOut(const G4ThreeVector& p) const;
133
134 G4GeometryType GetEntityType() const;
135
136 G4ThreeVector GetPointOnSurface() const;
137
138 std::ostream& StreamInfo(std::ostream& os) const;
139
140 // Visualisation functions
141
142 void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
143 G4Polyhedron* CreatePolyhedron() const;
144 G4NURBS* CreateNURBS() const;
145
146 public: // without description
147
148 G4Cons(__void__&);
149 // Fake default constructor for usage restricted to direct object
150 // persistency for clients requiring preallocation of memory for
151 // persistifiable objects.
152
153 // Old access functions
154
155 inline G4double GetRmin1() const;
156 inline G4double GetRmax1() const;
157 inline G4double GetRmin2() const;
158 inline G4double GetRmax2() const;
159
160 inline G4double GetDz() const;
161
162 inline G4double GetSPhi() const;
163 inline G4double GetDPhi() const;
164
165 protected:
166
167 G4ThreeVectorList*
168 CreateRotatedVertices(const G4AffineTransform& pTransform) const;
169
170 // Used by distanceToOut
171
172 enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
173
174 // used by normal
175
176 enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
177
178 private:
179
180 G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
181 // Algorithm for SurfaceNormal() following the original
182 // specification for points not on the surface
183
184 private:
185
186 G4double kRadTolerance, kAngTolerance;
187
188 G4double fRmin1,fRmin2,
189 fRmax1,fRmax2,
190 fDz,
191 fSPhi,fDPhi;
192};
193
194#include "G4Cons.icc"
195
196#endif
Note: See TracBrowser for help on using the repository browser.