[831] | 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,v 1.18 2006/10/20 13:45:20 gcosmo Exp $ |
---|
[1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[831] | 29 | // |
---|
| 30 | // -------------------------------------------------------------------- |
---|
| 31 | // GEANT 4 class header file |
---|
| 32 | // |
---|
| 33 | // G4EllipticalTube |
---|
| 34 | // |
---|
| 35 | // Class description: |
---|
| 36 | // |
---|
| 37 | // Declaration of a CSG volume representing a tube with elliptical |
---|
| 38 | // cross section (geant3 solid 'ELTU'): |
---|
| 39 | // |
---|
| 40 | // G4EllipticalTube( const G4String& name, |
---|
| 41 | // G4double Dx, |
---|
| 42 | // G4double Dy, |
---|
| 43 | // G4double Dz ) |
---|
| 44 | // |
---|
| 45 | // The equation of the surface in x/y is 1.0 = (x/dx)**2 + (y/dy)**2 |
---|
| 46 | |
---|
| 47 | // Author: |
---|
| 48 | // David C. Williams (davidw@scipp.ucsc.edu) |
---|
| 49 | // -------------------------------------------------------------------- |
---|
| 50 | |
---|
| 51 | #ifndef G4EllipticalTube_hh |
---|
| 52 | #define G4EllipticalTube_hh |
---|
| 53 | |
---|
| 54 | #include "G4VSolid.hh" |
---|
| 55 | |
---|
| 56 | class G4EllipticalTube : public G4VSolid |
---|
| 57 | { |
---|
| 58 | public: // with description |
---|
| 59 | |
---|
| 60 | G4EllipticalTube( const G4String &name, |
---|
| 61 | G4double theDx, |
---|
| 62 | G4double theDy, |
---|
| 63 | G4double theDz ); |
---|
| 64 | |
---|
| 65 | virtual ~G4EllipticalTube(); |
---|
| 66 | |
---|
| 67 | // Standard solid methods |
---|
| 68 | |
---|
| 69 | G4bool CalculateExtent( const EAxis pAxis, |
---|
| 70 | const G4VoxelLimits& pVoxelLimit, |
---|
| 71 | const G4AffineTransform& pTransform, |
---|
| 72 | G4double& pmin, G4double& pmax ) const; |
---|
| 73 | |
---|
| 74 | EInside Inside( const G4ThreeVector& p ) const; |
---|
| 75 | |
---|
| 76 | G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const; |
---|
| 77 | |
---|
| 78 | G4double DistanceToIn( const G4ThreeVector& p, |
---|
| 79 | const G4ThreeVector& v ) const; |
---|
| 80 | G4double DistanceToIn( const G4ThreeVector& p ) const; |
---|
| 81 | G4double DistanceToOut( const G4ThreeVector& p, |
---|
| 82 | const G4ThreeVector& v, |
---|
| 83 | const G4bool calcNorm=false, |
---|
| 84 | G4bool *validNorm=0, |
---|
| 85 | G4ThreeVector *n=0 ) const; |
---|
| 86 | G4double DistanceToOut( const G4ThreeVector& p ) const; |
---|
| 87 | |
---|
| 88 | G4GeometryType GetEntityType() const; |
---|
| 89 | |
---|
| 90 | std::ostream& StreamInfo(std::ostream& os) const; |
---|
| 91 | |
---|
| 92 | G4double GetCubicVolume(); |
---|
| 93 | G4double GetSurfaceArea(); |
---|
| 94 | |
---|
| 95 | G4ThreeVector GetPointOnSurface() const; |
---|
| 96 | |
---|
| 97 | // Visualisation methods |
---|
| 98 | |
---|
| 99 | G4Polyhedron* CreatePolyhedron() const; |
---|
| 100 | G4Polyhedron* GetPolyhedron () const; |
---|
| 101 | void DescribeYourselfTo( G4VGraphicsScene& scene ) const; |
---|
| 102 | G4VisExtent GetExtent() const; |
---|
| 103 | |
---|
| 104 | // Accessors |
---|
| 105 | |
---|
| 106 | inline G4double GetDx() const; |
---|
| 107 | inline G4double GetDy() const; |
---|
| 108 | inline G4double GetDz() const; |
---|
| 109 | |
---|
| 110 | inline void SetDx( const G4double newDx ); |
---|
| 111 | inline void SetDy( const G4double newDy ); |
---|
| 112 | inline void SetDz( const G4double newDz ); |
---|
| 113 | |
---|
| 114 | public: // without description |
---|
| 115 | |
---|
| 116 | G4EllipticalTube(__void__&); |
---|
| 117 | // Fake default constructor for usage restricted to direct object |
---|
| 118 | // persistency for clients requiring preallocation of memory for |
---|
| 119 | // persistifiable objects. |
---|
| 120 | |
---|
| 121 | protected: // without description |
---|
| 122 | |
---|
| 123 | G4double dx, dy, dz; |
---|
| 124 | |
---|
| 125 | // Utility |
---|
| 126 | |
---|
| 127 | inline G4double CheckXY( const G4double x, |
---|
| 128 | const G4double y, |
---|
| 129 | const G4double toler ) const; |
---|
| 130 | inline G4double CheckXY( const G4double x, const G4double y ) const; |
---|
| 131 | |
---|
| 132 | G4int IntersectXY( const G4ThreeVector &p, |
---|
| 133 | const G4ThreeVector &v, G4double s[2] ) const; |
---|
| 134 | |
---|
| 135 | private: |
---|
| 136 | |
---|
| 137 | G4double fCubicVolume; |
---|
| 138 | G4double fSurfaceArea; |
---|
| 139 | mutable G4Polyhedron* fpPolyhedron; |
---|
| 140 | |
---|
| 141 | }; |
---|
| 142 | |
---|
| 143 | #include "G4EllipticalTube.icc" |
---|
| 144 | |
---|
| 145 | #endif |
---|