Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EllipticalTube.hh
Go to the documentation of this file.
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: G4EllipticalTube.hh 67011 2013-01-29 16:17:41Z gcosmo $
28 //
29 // --------------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 // G4EllipticalTube
33 //
34 // Class description:
35 //
36 // Declaration of a CSG volume representing a tube with elliptical
37 // cross section (geant3 solid 'ELTU'):
38 //
39 // G4EllipticalTube( const G4String& name,
40 // G4double Dx,
41 // G4double Dy,
42 // G4double Dz )
43 //
44 // The equation of the surface in x/y is 1.0 = (x/dx)**2 + (y/dy)**2
45 
46 // Author:
47 // David C. Williams (davidw@scipp.ucsc.edu)
48 // --------------------------------------------------------------------
49 
50 #ifndef G4EllipticalTube_hh
51 #define G4EllipticalTube_hh
52 
53 #include "G4VSolid.hh"
54 
55 class G4EllipticalTube : public G4VSolid
56 {
57  public: // with description
58 
60  G4double theDx,
61  G4double theDy,
62  G4double theDz );
63 
64  virtual ~G4EllipticalTube();
65 
66  // Standard solid methods
67 
68  G4bool CalculateExtent( const EAxis pAxis,
69  const G4VoxelLimits& pVoxelLimit,
70  const G4AffineTransform& pTransform,
71  G4double& pmin, G4double& pmax ) const;
72 
73  EInside Inside( const G4ThreeVector& p ) const;
74 
75  G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
76 
78  const G4ThreeVector& v ) const;
79  G4double DistanceToIn( const G4ThreeVector& p ) const;
81  const G4ThreeVector& v,
82  const G4bool calcNorm=false,
83  G4bool *validNorm=0,
84  G4ThreeVector *n=0 ) const;
85  G4double DistanceToOut( const G4ThreeVector& p ) const;
86 
88 
89  G4VSolid* Clone() const;
90 
91  std::ostream& StreamInfo(std::ostream& os) const;
92 
95 
97 
98  // Visualisation methods
99 
101  G4Polyhedron* GetPolyhedron () const;
102  void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
103  G4VisExtent GetExtent() const;
104 
105  // Accessors
106 
107  inline G4double GetDx() const;
108  inline G4double GetDy() const;
109  inline G4double GetDz() const;
110 
111  inline void SetDx( const G4double newDx );
112  inline void SetDy( const G4double newDy );
113  inline void SetDz( const G4double newDz );
114 
115  public: // without description
116 
117  G4EllipticalTube(__void__&);
118  // Fake default constructor for usage restricted to direct object
119  // persistency for clients requiring preallocation of memory for
120  // persistifiable objects.
121 
124  // Copy constructor and assignment operator.
125 
126  protected: // without description
127 
129 
130  // Utility
131 
132  inline G4double CheckXY( const G4double x,
133  const G4double y,
134  const G4double toler ) const;
135  inline G4double CheckXY( const G4double x, const G4double y ) const;
136 
137  G4int IntersectXY( const G4ThreeVector &p,
138  const G4ThreeVector &v, G4double s[2] ) const;
139 
140  private:
141 
142  G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
143  // Algorithm for SurfaceNormal() following the original
144  // specification for points not on the surface.
145 
146  G4double fCubicVolume;
147  G4double fSurfaceArea;
148  mutable G4Polyhedron* fpPolyhedron;
149 
150 };
151 
152 #include "G4EllipticalTube.icc"
153 
154 #endif