Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 7 // 6 // * the Geant4 Collaboration. It is provided << 8 // $Id: G4Box.hh,v 1.3 1999/12/15 14:50:06 gunter Exp $ 7 // * conditions of the Geant4 Software License << 9 // GEANT4 tag $Name: geant4-01-01 $ 8 // * LICENSE and available at http://cern.ch/ << 10 // 9 // * include a list of copyright holders. << 11 // 10 // * << 12 // class G4Box 11 // * Neither the authors of this software syst << 13 // 12 // * institutes,nor the agencies providing fin << 14 // A Box is a cuboid of given half lengths dx,dy,dz. The Box is 13 // * work make any representation or warran << 15 // centred on the origin with sides parallel to the x/y/z axes. 14 // * regarding this software system or assum << 16 // 15 // * use. Please see the license in the file << 17 // Member functions: 16 // * for the full disclaimer and the limitatio << 18 // 17 // * << 19 // As inherited from G4CSGSolid + 18 // * This code implementation is the result << 20 // 19 // * technical work of the GEANT4 collaboratio << 21 // G4Box(const G4String& pName, G4double pX, 20 // * By using, copying, modifying or distri << 22 // G4double pY, G4double pZ) 21 // * any work based on the software) you ag << 23 // Construct a box with name, and half lengths pX,pY,pZ 22 // * use in resulting scientific publicati << 24 // 23 // * acceptance of all terms of the Geant4 Sof << 25 // G4double GetXHalfLength() const 24 // ******************************************* << 26 // G4double GetYHalfLength() const 25 // << 27 // G4double GetZHalfLength() const 26 // G4Box << 28 // 27 // << 29 // Return the respective parameter 28 // Class description: << 30 // 29 // << 31 // Protected: 30 // A Box is a cuboid of given half lengths d << 32 // 31 // centred on the origin with sides parallel << 33 // G4ThreeVectorList* 32 << 34 // CreateRotatedVertices(const G4AffineTransform& pTransform) const 33 // 30.06.95 P.Kent: Converted from source code << 35 // 34 // 27.03.96 J.Allison: Added virtual functions << 36 // Create the List of transformed vertices in the format required 35 // SendWireframeTo(G4VGrap << 37 // for G4VSolid:: ClipCrossSection and ClipBetweenSections. 36 // 27.03.98 J.Apostolakis: Inherit from G4CSGS << 38 // 37 // ------------------------------------------- << 39 // Member Data: (private) 38 #ifndef G4BOX_HH << 40 // 39 #define G4BOX_HH << 41 // fDx,fDy,fDz - The box's half-widths >> 42 // >> 43 // History: >> 44 // 30.06.95 P.Kent Converted from source code developed end 94 >> 45 // 27.03.96 J.Allison Added virtual functions DescribeYourselfTo and >> 46 // SendWireframeTo (G4VGraphicsModel&). >> 47 // 22.07.96 J.Allison Changed G4VGraphicsModel to G4VGraphicsScene. >> 48 // and SendPolyhedronTo to CreatePolyhedron. >> 49 // 27.03.98 J.Apostolakis Inherit from G4CSGSolid (not G4VSolid). >> 50 // 18.11.99 J.Apostolakis, V.Grichine: kUndefined was added to ESide 40 51 41 #include "G4GeomTypes.hh" << 42 52 43 #if defined(G4GEOM_USE_USOLIDS) << 53 #ifndef G4BOX_HH 44 #define G4GEOM_USE_UBOX 1 << 54 #define G4BOX_HH 45 #endif << 46 << 47 #if defined(G4GEOM_USE_UBOX) << 48 #define G4UBox G4Box << 49 #include "G4UBox.hh" << 50 #else << 51 55 52 #include "G4CSGSolid.hh" 56 #include "G4CSGSolid.hh" 53 #include "G4Polyhedron.hh" << 54 57 55 class G4Box : public G4CSGSolid << 58 class G4Box : public G4CSGSolid 56 { 59 { 57 public: << 60 public: 58 61 59 G4Box(const G4String& pName, G4double pX, << 62 G4Box(const G4String& pName, G4double pX, 60 // Construct a box with name, and half l << 63 G4double pY, G4double pZ); 61 64 62 ~G4Box() override; << 65 virtual ~G4Box(); 63 66 64 void ComputeDimensions(G4VPVParameterisati 67 void ComputeDimensions(G4VPVParameterisation* p, 65 const G4int n, 68 const G4int n, 66 const G4VPhysicalVo << 69 const G4VPhysicalVolume* pRep); 67 << 68 void BoundingLimits(G4ThreeVector& pMin, G << 69 70 70 G4bool CalculateExtent(const EAxis pAxis, 71 G4bool CalculateExtent(const EAxis pAxis, 71 const G4VoxelLimits << 72 const G4VoxelLimits& pVoxelLimit, 72 const G4AffineTrans << 73 const G4AffineTransform& pTransform, 73 G4double& pMi << 74 G4double& pmin, G4double& pmax) const; >> 75 // Access functions >> 76 >> 77 G4double GetXHalfLength() const >> 78 { >> 79 return fDx; >> 80 } >> 81 >> 82 G4double GetYHalfLength() const >> 83 { >> 84 return fDy; >> 85 } >> 86 >> 87 G4double GetZHalfLength() const >> 88 { >> 89 return fDz; >> 90 } >> 91 >> 92 void SetXHalfLength(G4double dx) >> 93 { >> 94 fDx=dx; >> 95 } >> 96 >> 97 void SetYHalfLength(G4double dy) >> 98 { >> 99 fDy=dy; >> 100 } >> 101 >> 102 void SetZHalfLength(G4double dz) >> 103 { >> 104 fDz=dz; >> 105 } >> 106 >> 107 EInside Inside(const G4ThreeVector& p) const; >> 108 >> 109 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const; >> 110 >> 111 G4double DistanceToIn(const G4ThreeVector& p,const G4ThreeVector& v) const; >> 112 >> 113 G4double DistanceToIn(const G4ThreeVector& p) const; >> 114 >> 115 G4double DistanceToOut(const G4ThreeVector& p,const G4ThreeVector& v, >> 116 const G4bool calcNorm=false, >> 117 G4bool *validNorm=0,G4ThreeVector *n=0) const; >> 118 >> 119 G4double DistanceToOut(const G4ThreeVector& p) const; >> 120 >> 121 virtual G4GeometryType GetEntityType() const { return G4String("G4Box"); } >> 122 >> 123 void DescribeYourselfTo (G4VGraphicsScene& scene) const; >> 124 G4VisExtent GetExtent () const; >> 125 G4Polyhedron* CreatePolyhedron () const; >> 126 G4NURBS* CreateNURBS () const; >> 127 >> 128 protected: >> 129 >> 130 G4ThreeVectorList* >> 131 CreateRotatedVertices(const G4AffineTransform& pTransform) const; >> 132 >> 133 // Codes for faces (kPX=plus x face,kMY= minus y face etc) 74 134 75 // Accessors and modifiers << 135 enum ESide {kUndefined,kPX,kMX,kPY,kMY,kPZ,kMZ}; 76 136 77 inline G4double GetXHalfLength() const; << 137 private: 78 inline G4double GetYHalfLength() const; << 79 inline G4double GetZHalfLength() const; << 80 138 81 void SetXHalfLength(G4double dx) ; << 139 G4double fDx,fDy,fDz; 82 void SetYHalfLength(G4double dy) ; << 83 void SetZHalfLength(G4double dz) ; << 84 << 85 // Methods for solid << 86 << 87 inline G4double GetCubicVolume() override; << 88 inline G4double GetSurfaceArea() override; << 89 << 90 EInside Inside(const G4ThreeVector& p) con << 91 G4ThreeVector SurfaceNormal( const G4Three << 92 G4double DistanceToIn(const G4ThreeVector& << 93 const G4ThreeVector& << 94 G4double DistanceToIn(const G4ThreeVector& << 95 G4double DistanceToOut(const G4ThreeVector << 96 const G4bool calcNo << 97 G4bool* valid << 98 G4ThreeVector << 99 G4double DistanceToOut(const G4ThreeVector << 100 << 101 G4GeometryType GetEntityType() const overr << 102 G4ThreeVector GetPointOnSurface() const ov << 103 << 104 G4bool IsFaceted() const override; << 105 << 106 G4VSolid* Clone() const override; << 107 << 108 std::ostream& StreamInfo(std::ostream& os) << 109 << 110 // Utilities for visualization << 111 << 112 void DescribeYourselfTo (G4VGraph << 113 G4VisExtent GetExtent () const << 114 G4Polyhedron* CreatePolyhedron () const << 115 << 116 G4Box(__void__&); << 117 // Fake default constructor for usage re << 118 // persistency for clients requiring pre << 119 // persistifiable objects. << 120 << 121 G4Box(const G4Box& rhs); << 122 G4Box& operator=(const G4Box& rhs); << 123 // Copy constructor and assignment opera << 124 << 125 private: << 126 << 127 G4ThreeVector ApproxSurfaceNormal( const G << 128 // Algorithm for SurfaceNormal() followi << 129 // specification for points not on the s << 130 << 131 private: << 132 << 133 G4double fDx = 0.0, fDy = 0.0, fDz = 0.0; << 134 G4double delta; // Cached half Cartesian << 135 }; 140 }; 136 << 137 #include "G4Box.icc" << 138 << 139 #endif << 140 141 141 #endif 142 #endif 142 143