Geant4 Cross Reference |
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 // G4VCSGfaceted 27 // 28 // Class description: 29 // 30 // Virtual class defining CSG-like type shape that is built entirely 31 // of G4CSGface faces. 32 33 // Author: David C. Williams (davidw@scipp.ucsc.edu) 34 // -------------------------------------------------------------------- 35 #ifndef G4VCSGFACETED_HH 36 #define G4VCSGFACETED_HH 1 37 38 #include "G4VSolid.hh" 39 40 class G4VCSGface; 41 class G4VisExtent; 42 43 class G4VCSGfaceted : public G4VSolid 44 { 45 public: 46 47 G4VCSGfaceted( const G4String& name ); 48 ~G4VCSGfaceted() override; 49 50 G4VCSGfaceted( const G4VCSGfaceted& source ); 51 G4VCSGfaceted& operator=( const G4VCSGfaceted& source ); 52 53 G4bool CalculateExtent( const EAxis pAxis, 54 const G4VoxelLimits& pVoxelLimit, 55 const G4AffineTransform& pTransform, 56 G4double& pmin, G4double& pmax) const override; 57 58 EInside Inside( const G4ThreeVector& p ) const override; 59 60 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override; 61 62 G4double DistanceToIn( const G4ThreeVector& p, 63 const G4ThreeVector& v ) const override; 64 G4double DistanceToIn( const G4ThreeVector& p ) const override; 65 G4double DistanceToOut( const G4ThreeVector& p, 66 const G4ThreeVector& v, 67 const G4bool calcNorm = false, 68 G4bool* validNorm = nullptr, 69 G4ThreeVector* n = nullptr ) const override; 70 G4double DistanceToOut( const G4ThreeVector& p ) const override; 71 72 G4GeometryType GetEntityType() const override; 73 74 std::ostream& StreamInfo(std::ostream& os) const override; 75 76 G4Polyhedron* CreatePolyhedron() const override = 0; 77 78 void DescribeYourselfTo( G4VGraphicsScene& scene ) const override; 79 80 G4VisExtent GetExtent() const override; 81 82 G4Polyhedron* GetPolyhedron () const override; 83 84 G4int GetCubVolStatistics() const; 85 G4double GetCubVolEpsilon() const; 86 void SetCubVolStatistics(G4int st); 87 void SetCubVolEpsilon(G4double ep); 88 G4int GetAreaStatistics() const; 89 G4double GetAreaAccuracy() const; 90 void SetAreaStatistics(G4int st); 91 void SetAreaAccuracy(G4double ep); 92 93 G4double GetCubicVolume() override; 94 // Returns an estimation of the geometrical cubic volume of the 95 // solid. Caches the computed value once computed the first time. 96 G4double GetSurfaceArea() override; 97 // Returns an estimation of the geometrical surface area of the 98 // solid. Caches the computed value once computed the first time. 99 100 G4VCSGfaceted(__void__&); 101 // Fake default constructor for usage restricted to direct object 102 // persistency for clients requiring preallocation of memory for 103 // persistifiable objects. 104 105 protected: 106 107 G4int numFace = 0; 108 G4VCSGface **faces = nullptr; 109 G4double fCubicVolume = 0.0; 110 G4double fSurfaceArea = 0.0; 111 mutable G4bool fRebuildPolyhedron = false; 112 mutable G4Polyhedron* fpPolyhedron = nullptr; 113 114 virtual G4double DistanceTo( const G4ThreeVector& p, 115 const G4bool outgoing ) const; 116 117 G4ThreeVector GetPointOnSurfaceGeneric()const; 118 // Returns a random point located on the surface of the solid 119 // in case of generic Polycone or generic Polyhedra. 120 121 void CopyStuff( const G4VCSGfaceted& source ); 122 void DeleteStuff(); 123 124 private: 125 126 G4int fStatistics; 127 G4double fCubVolEpsilon; 128 G4double fAreaAccuracy; 129 // Statistics, error accuracy for volume estimation. 130 }; 131 132 #endif 133