|
|
|||
File indexing completed on 2026-04-02 07:38:38
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4VCSGfaceted 0027 // 0028 // Class description: 0029 // 0030 // Virtual class defining CSG-like type shape that is built entirely 0031 // of G4CSGface faces. 0032 0033 // Author: David C. Williams (UCSC), 1998 - Created 0034 // -------------------------------------------------------------------- 0035 #ifndef G4VCSGFACETED_HH 0036 #define G4VCSGFACETED_HH 1 0037 0038 #include "G4VSolid.hh" 0039 0040 class G4VCSGface; 0041 class G4VisExtent; 0042 0043 /** 0044 * @brief G4VCSGfaceted is a virtual class defining a CSG-like type shape 0045 * that is built entirely of G4CSGface faces. 0046 */ 0047 0048 class G4VCSGfaceted : public G4VSolid 0049 { 0050 public: 0051 0052 /** 0053 * Constructor taking a 'name'. 0054 */ 0055 G4VCSGfaceted( const G4String& name ); 0056 0057 /** 0058 * Destructor. 0059 */ 0060 ~G4VCSGfaceted() override; 0061 0062 /** 0063 * Copy constructor and assignment operator. 0064 */ 0065 G4VCSGfaceted( const G4VCSGfaceted& source ); 0066 G4VCSGfaceted& operator=( const G4VCSGfaceted& source ); 0067 0068 /** 0069 * Calculates the minimum and maximum extent of the solid, when under the 0070 * specified transform, and within the specified limits. 0071 * @param[in] pAxis The axis along which compute the extent. 0072 * @param[in] pVoxelLimit The limiting space dictated by voxels. 0073 * @param[in] pTransform The internal transformation applied to the solid. 0074 * @param[out] pMin The minimum extent value. 0075 * @param[out] pMax The maximum extent value. 0076 * @returns True if the solid is intersected by the extent region. 0077 */ 0078 G4bool CalculateExtent( const EAxis pAxis, 0079 const G4VoxelLimits& pVoxelLimit, 0080 const G4AffineTransform& pTransform, 0081 G4double& pmin, G4double& pmax) const override; 0082 0083 /** 0084 * Concrete implementations of the expected query interfaces for 0085 * solids, as defined in G4VSolid. 0086 */ 0087 EInside Inside( const G4ThreeVector& p ) const override; 0088 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override; 0089 G4double DistanceToIn( const G4ThreeVector& p, 0090 const G4ThreeVector& v ) const override; 0091 G4double DistanceToIn( const G4ThreeVector& p ) const override; 0092 G4double DistanceToOut( const G4ThreeVector& p, 0093 const G4ThreeVector& v, 0094 const G4bool calcNorm = false, 0095 G4bool* validNorm = nullptr, 0096 G4ThreeVector* n = nullptr ) const override; 0097 G4double DistanceToOut( const G4ThreeVector& p ) const override; 0098 0099 /** 0100 * Returns the type ID, "G4CSGfaceted" of the solid. 0101 */ 0102 G4GeometryType GetEntityType() const override; 0103 0104 /** 0105 * Streams the object contents to an output stream. 0106 */ 0107 std::ostream& StreamInfo(std::ostream& os) const override; 0108 0109 /** 0110 * Returns a pointer to a generated polyhedron used for visualisation. 0111 */ 0112 G4Polyhedron* CreatePolyhedron() const override = 0; 0113 0114 /** 0115 * Methods for creating graphical representations (i.e. for visualisation). 0116 */ 0117 void DescribeYourselfTo( G4VGraphicsScene& scene ) const override; 0118 G4VisExtent GetExtent() const override; 0119 G4Polyhedron* GetPolyhedron () const override; 0120 0121 /** 0122 * Accessors and modifiers for capacity and area computation. 0123 */ 0124 G4int GetCubVolStatistics() const; 0125 G4double GetCubVolEpsilon() const; 0126 void SetCubVolStatistics(G4int st); 0127 void SetCubVolEpsilon(G4double ep); 0128 G4int GetAreaStatistics() const; 0129 G4double GetAreaAccuracy() const; 0130 void SetAreaStatistics(G4int st); 0131 void SetAreaAccuracy(G4double ep); 0132 0133 /** 0134 * Returning an estimation of the solid volume (capacity) and 0135 * surface area, in internal units. Caches the computed value 0136 * once computed the first time. 0137 */ 0138 G4double GetCubicVolume() override; 0139 G4double GetSurfaceArea() override; 0140 0141 /** 0142 * Fake default constructor for usage restricted to direct object 0143 * persistency for clients requiring preallocation of memory for 0144 * persistifiable objects. 0145 */ 0146 G4VCSGfaceted(__void__&); 0147 0148 protected: 0149 0150 /** 0151 * Protected method used in DistanceToIn() and DistanceToOut(). 0152 */ 0153 virtual G4double DistanceTo( const G4ThreeVector& p, 0154 const G4bool outgoing ) const; 0155 0156 /** 0157 * Returns a random point located on the surface of the solid 0158 * in case of generic Polycone or generic Polyhedra. 0159 */ 0160 G4ThreeVector GetPointOnSurfaceGeneric()const; 0161 0162 /** 0163 * Copy parameters from other solid or reset them. 0164 * Used in copy constructor and assignment operator. 0165 */ 0166 void CopyStuff( const G4VCSGfaceted& source ); 0167 void DeleteStuff(); 0168 0169 protected: 0170 0171 G4int numFace = 0; 0172 G4VCSGface **faces = nullptr; 0173 G4double fCubicVolume = 0.0; 0174 G4double fSurfaceArea = 0.0; 0175 mutable G4bool fRebuildPolyhedron = false; 0176 mutable G4Polyhedron* fpPolyhedron = nullptr; 0177 0178 private: 0179 0180 /** Statistics, error accuracy for volume estimation. */ 0181 G4int fStatistics; 0182 G4double fCubVolEpsilon; 0183 G4double fAreaAccuracy; 0184 }; 0185 0186 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|