source: trunk/source/geometry/solids/CSG/include/G4Tubs.hh@ 861

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

geant4.8.2 beta

File size: 6.5 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: G4Tubs.hh,v 1.17 2007/05/18 07:38:00 gcosmo Exp $
28// GEANT4 tag $Name: HEAD $
29//
30//
31// --------------------------------------------------------------------
32// GEANT 4 class header file
33//
34//
35// G4Tubs
36//
37// Class description:
38//
39// A tube or tube segment with curved sides parallel to
40// the z-axis. The tube has a specified half-length along
41// the z axis, about which it is centred, and a given
42// minimum and maximum radius. A minimum radius of 0
43// signifies a filled tube /cylinder. The tube segment is
44// specified by starting and delta angles for phi, with 0
45// being the +x axis, PI/2 the +y axis.
46// A delta angle of 2PI signifies a complete, unsegmented
47// tube/cylinder.
48//
49// Member Data:
50//
51// fRMin Inner radius
52// fRMax Outer radius
53// fDz half length in z
54//
55// fSPhi The starting phi angle in radians,
56// adjusted such that fSPhi+fDPhi<=2PI, fSPhi>-2PI
57//
58// fDPhi Delta angle of the segment.
59
60// History:
61// 10.08.95 P.Kent: General cleanup, use G4VSolid extent helper functions
62// to CalculateExtent()
63// 23.01.94 P.Kent: Converted to `tolerant' geometry
64// 19.07.96 J.Allison: G4GraphicsScene - see G4Box
65// 22.07.96 J.Allison: Changed SendPolyhedronTo to CreatePolyhedron
66// --------------------------------------------------------------------
67
68#ifndef G4TUBS_HH
69#define G4TUBS_HH
70
71#include "G4CSGSolid.hh"
72
73class G4Tubs : public G4CSGSolid
74{
75 public: // with description
76
77 G4Tubs( const G4String& pName,
78 G4double pRMin,
79 G4double pRMax,
80 G4double pDz,
81 G4double pSPhi,
82 G4double pDPhi );
83 //
84 // Constructs a tubs with the given name and dimensions
85
86 virtual ~G4Tubs();
87 //
88 // Destructor
89
90 // Accessors
91
92 inline G4double GetInnerRadius () const;
93 inline G4double GetOuterRadius () const;
94 inline G4double GetZHalfLength () const;
95 inline G4double GetStartPhiAngle () const;
96 inline G4double GetDeltaPhiAngle () const;
97
98 // Modifiers
99
100 inline void SetInnerRadius (G4double newRMin);
101 inline void SetOuterRadius (G4double newRMax);
102 inline void SetZHalfLength (G4double newDz);
103 inline void SetStartPhiAngle (G4double newSPhi);
104 inline void SetDeltaPhiAngle (G4double newDPhi);
105
106 // 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, const G4ThreeVector& v) const;
125 G4double DistanceToIn(const G4ThreeVector& p) const;
126 G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
127 const G4bool calcNorm=G4bool(false),
128 G4bool *validNorm=0, G4ThreeVector *n=0) const;
129 G4double DistanceToOut(const G4ThreeVector& p) const;
130
131 G4GeometryType GetEntityType() const;
132
133 G4ThreeVector GetPointOnSurface() const;
134
135 std::ostream& StreamInfo( std::ostream& os ) const;
136
137 // Visualisation functions
138
139 void DescribeYourselfTo ( G4VGraphicsScene& scene ) const;
140 G4Polyhedron* CreatePolyhedron () const;
141 G4NURBS* CreateNURBS () const;
142
143 public: // without description
144
145 G4Tubs(__void__&);
146 // Fake default constructor for usage restricted to direct object
147 // persistency for clients requiring preallocation of memory for
148 // persistifiable objects.
149
150 // Older names for access functions
151
152 inline G4double GetRMin() const;
153 inline G4double GetRMax() const;
154 inline G4double GetDz () const;
155 inline G4double GetSPhi() const;
156 inline G4double GetDPhi() const;
157
158 protected:
159
160 G4ThreeVectorList*
161 CreateRotatedVertices( const G4AffineTransform& pTransform ) const;
162 //
163 // Creates the List of transformed vertices in the format required
164 // for G4VSolid:: ClipCrossSection and ClipBetweenSections
165
166 G4double fRMin,fRMax,fDz,fSPhi,fDPhi;
167
168 // Used by distanceToOut
169
170 enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
171
172 // used by normal
173
174 enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
175
176 private:
177
178 G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
179 // Algorithm for SurfaceNormal() following the original
180 // specification for points not on the surface
181
182 private:
183
184 G4double kRadTolerance, kAngTolerance;
185 // Radial and angular tolerances
186};
187
188#include "G4Tubs.icc"
189
190#endif
Note: See TracBrowser for help on using the repository browser.