[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: G4Trd.hh,v 1.16 2006/10/19 15:33:37 gcosmo Exp $ |
---|
[1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[831] | 29 | // |
---|
| 30 | // |
---|
| 31 | // -------------------------------------------------------------------- |
---|
| 32 | // GEANT 4 class header file |
---|
| 33 | // |
---|
| 34 | // |
---|
| 35 | // G4Trd |
---|
| 36 | // |
---|
| 37 | // Class description: |
---|
| 38 | // |
---|
| 39 | // A G4Trd is a trapezoid with the x and y dimensions varying along z |
---|
| 40 | // functions: |
---|
| 41 | // |
---|
| 42 | // Member Data: |
---|
| 43 | // |
---|
| 44 | // fDx1 Half-length along x at the surface positioned at -dz |
---|
| 45 | // fDx2 Half-length along x at the surface positioned at +dz |
---|
| 46 | // fDy1 Half-length along y at the surface positioned at -dz |
---|
| 47 | // fDy2 Half-length along y at the surface positioned at +dz |
---|
| 48 | // fDz Half-length along z axis |
---|
| 49 | |
---|
| 50 | // History: |
---|
| 51 | // 12.01.95 P.Kent: Old prototype code converted to thick geometry |
---|
| 52 | // 17.02.95 P.Kent: Exiting normal return |
---|
| 53 | // 19.08.96 P.Kent, V.Grichine: Fs in accordance with G4Box |
---|
| 54 | // 21.04.97 J.Apostolakis: Added Set Methods |
---|
| 55 | // 19.11.99 V.Grichine: kUndefined was added to Eside enum |
---|
| 56 | // -------------------------------------------------------------------- |
---|
| 57 | |
---|
| 58 | #ifndef G4TRD_HH |
---|
| 59 | #define G4TRD_HH |
---|
| 60 | |
---|
| 61 | #include "G4CSGSolid.hh" |
---|
| 62 | |
---|
| 63 | class G4Trd : public G4CSGSolid |
---|
| 64 | { |
---|
| 65 | public: // with description |
---|
| 66 | |
---|
| 67 | G4Trd( const G4String& pName, |
---|
| 68 | G4double pdx1, G4double pdx2, |
---|
| 69 | G4double pdy1, G4double pdy2, |
---|
| 70 | G4double pdz ); |
---|
| 71 | // |
---|
| 72 | // Constructs a trapezoid with name, and half lengths |
---|
| 73 | |
---|
| 74 | virtual ~G4Trd(); |
---|
| 75 | // |
---|
| 76 | // Destructor |
---|
| 77 | |
---|
| 78 | // Accessors |
---|
| 79 | |
---|
| 80 | inline G4double GetXHalfLength1() const; |
---|
| 81 | inline G4double GetXHalfLength2() const; |
---|
| 82 | inline G4double GetYHalfLength1() const; |
---|
| 83 | inline G4double GetYHalfLength2() const; |
---|
| 84 | inline G4double GetZHalfLength() const; |
---|
| 85 | |
---|
| 86 | // Modifiers |
---|
| 87 | |
---|
| 88 | inline void SetXHalfLength1(G4double val); |
---|
| 89 | inline void SetXHalfLength2(G4double val); |
---|
| 90 | inline void SetYHalfLength1(G4double val); |
---|
| 91 | inline void SetYHalfLength2(G4double val); |
---|
| 92 | inline void SetZHalfLength(G4double val); |
---|
| 93 | |
---|
| 94 | // Methods of solid |
---|
| 95 | |
---|
| 96 | inline G4double GetCubicVolume(); |
---|
| 97 | inline G4double GetSurfaceArea(); |
---|
| 98 | |
---|
| 99 | void ComputeDimensions( G4VPVParameterisation* p, |
---|
| 100 | const G4int n, |
---|
| 101 | const G4VPhysicalVolume* pRep ); |
---|
| 102 | |
---|
| 103 | G4bool CalculateExtent( const EAxis pAxis, |
---|
| 104 | const G4VoxelLimits& pVoxelLimit, |
---|
| 105 | const G4AffineTransform& pTransform, |
---|
| 106 | G4double& pMin, G4double& pMax ) const; |
---|
| 107 | |
---|
| 108 | EInside Inside( const G4ThreeVector& p ) const; |
---|
| 109 | |
---|
| 110 | G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const; |
---|
| 111 | |
---|
| 112 | G4double DistanceToIn( const G4ThreeVector& p, |
---|
| 113 | const G4ThreeVector& v ) const; |
---|
| 114 | |
---|
| 115 | G4double DistanceToIn( const G4ThreeVector& p ) const; |
---|
| 116 | |
---|
| 117 | G4double DistanceToOut( const G4ThreeVector& p, |
---|
| 118 | const G4ThreeVector& v, |
---|
| 119 | const G4bool calcNorm=false, |
---|
| 120 | G4bool *validNorm=0, |
---|
| 121 | G4ThreeVector *n=0 ) const; |
---|
| 122 | |
---|
| 123 | G4double DistanceToOut( const G4ThreeVector& p ) const; |
---|
| 124 | |
---|
| 125 | void CheckAndSetAllParameters ( G4double pdx1, G4double pdx2, |
---|
| 126 | G4double pdy1, G4double pdy2, |
---|
| 127 | G4double pdz ); |
---|
| 128 | |
---|
| 129 | void SetAllParameters ( G4double pdx1, G4double pdx2, |
---|
| 130 | G4double pdy1, G4double pdy2, |
---|
| 131 | G4double pdz ); |
---|
| 132 | |
---|
| 133 | G4GeometryType GetEntityType() const; |
---|
| 134 | |
---|
| 135 | G4ThreeVector GetPointOnSurface() const; |
---|
| 136 | |
---|
| 137 | std::ostream& StreamInfo( std::ostream& os ) const; |
---|
| 138 | |
---|
| 139 | // Visualisation functions |
---|
| 140 | |
---|
| 141 | void DescribeYourselfTo (G4VGraphicsScene& scene) const; |
---|
| 142 | G4Polyhedron* CreatePolyhedron () const; |
---|
| 143 | G4NURBS* CreateNURBS () const; |
---|
| 144 | |
---|
| 145 | public: // without description |
---|
| 146 | |
---|
| 147 | G4Trd(__void__&); |
---|
| 148 | // Fake default constructor for usage restricted to direct object |
---|
| 149 | // persistency for clients requiring preallocation of memory for |
---|
| 150 | // persistifiable objects. |
---|
| 151 | |
---|
| 152 | protected: // without description |
---|
| 153 | |
---|
| 154 | G4ThreeVectorList* |
---|
| 155 | CreateRotatedVertices( const G4AffineTransform& pTransform ) const; |
---|
| 156 | // |
---|
| 157 | // Creates the List of transformed vertices in the format required |
---|
| 158 | // for G4CSGSolid:: ClipCrossSection and ClipBetweenSections |
---|
| 159 | |
---|
| 160 | G4double fDx1,fDx2,fDy1,fDy2,fDz; |
---|
| 161 | |
---|
| 162 | // Codes for faces (kPX=plus x face,kMY= minus y face etc) |
---|
| 163 | |
---|
| 164 | enum ESide {kUndefined, kPX,kMX,kPY,kMY,kPZ,kMZ}; |
---|
| 165 | |
---|
| 166 | private: |
---|
| 167 | |
---|
| 168 | G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const; |
---|
| 169 | // Algorithm for SurfaceNormal() following the original |
---|
| 170 | // specification for points not on the surface |
---|
| 171 | }; |
---|
| 172 | |
---|
| 173 | #include "G4Trd.icc" |
---|
| 174 | |
---|
| 175 | #endif |
---|