|
|
|||
File indexing completed on 2026-07-18 08:35:07
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 intellectual property of the * 0019 // * Vanderbilt University Free Electron Laser Center * 0020 // * Vanderbilt University, Nashville, TN, USA * 0021 // * Development supported by: * 0022 // * United States MFEL program under grant FA9550-04-1-0045 * 0023 // * and NASA under contract number NNG04CT05P. * 0024 // * Written by Marcus H. Mendenhall and Robert A. Weller. * 0025 // * * 0026 // * Contributed to the Geant4 Core, January, 2005. * 0027 // * * 0028 // ******************************************************************** 0029 // 0030 // G4Tet 0031 // 0032 // Class description: 0033 // 0034 // A G4Tet is a tetrahedra solid, defined by 4 points in space. 0035 0036 // Author: M.H.Mendenhall & R.A.Weller (Vanderbilt University, USA), 03.09.2004 0037 // E.Tcherniaev (CERN), 08.01.2020 - Complete revision, speed up 0038 // -------------------------------------------------------------------- 0039 #ifndef G4TET_HH 0040 #define G4TET_HH 0041 0042 #include "G4GeomTypes.hh" 0043 0044 #if defined(G4GEOM_USE_USOLIDS) 0045 #define G4GEOM_USE_UTET 1 0046 #endif 0047 0048 #if defined(G4GEOM_USE_UTET) 0049 #define G4UTet G4Tet 0050 #include "G4UTet.hh" 0051 #else 0052 0053 #include "G4VSolid.hh" 0054 0055 /** 0056 * @brief G4Tet is a tetrahedra solid, defined by 4 points in space. 0057 */ 0058 0059 class G4Tet : public G4VSolid 0060 { 0061 public: 0062 0063 /** 0064 * Constructs a tetrahedra, given its parameters. 0065 * @param[in] pName The solid name. 0066 * @param[in] anchor The anchor point. 0067 * @param[in] p2 Point 2. 0068 * @param[in] p3 Point 3. 0069 * @param[in] p4 Point 4. 0070 * @param[in] degeneracyFlag Flag indicating degeneracy of points. 0071 */ 0072 G4Tet(const G4String& pName, 0073 const G4ThreeVector& anchor, 0074 const G4ThreeVector& p2, 0075 const G4ThreeVector& p3, 0076 const G4ThreeVector& p4, 0077 G4bool* degeneracyFlag = nullptr); 0078 0079 /** 0080 * Destructor. 0081 */ 0082 ~G4Tet() override; 0083 0084 /** 0085 * Modifier and accessors, for the four vertices of the shape. 0086 */ 0087 void SetVertices(const G4ThreeVector& anchor, 0088 const G4ThreeVector& p1, 0089 const G4ThreeVector& p2, 0090 const G4ThreeVector& p3, 0091 G4bool* degeneracyFlag = nullptr); 0092 void GetVertices(G4ThreeVector& anchor, 0093 G4ThreeVector& p1, 0094 G4ThreeVector& p2, 0095 G4ThreeVector& p3) const; 0096 std::vector<G4ThreeVector> GetVertices() const; 0097 0098 /** 0099 * Checks if the tetrahedron is degenerate. A tetrahedron is considered 0100 * as degenerate in case its minimal height is less than the degeneracy 0101 * tolerance 0102 * @returns true if the tetrahedron is degenerate. 0103 */ 0104 G4bool CheckDegeneracy(const G4ThreeVector& p0, 0105 const G4ThreeVector& p1, 0106 const G4ThreeVector& p2, 0107 const G4ThreeVector& p3) const; 0108 0109 /** 0110 * Dispatch method for parameterisation replication mechanism and 0111 * dimension computation. 0112 */ 0113 void ComputeDimensions(G4VPVParameterisation* p, 0114 const G4int n, 0115 const G4VPhysicalVolume* pRep) override; 0116 0117 /** 0118 * Computes the bounding limits of the solid. 0119 * @param[out] pMin The minimum bounding limit point. 0120 * @param[out] pMax The maximum bounding limit point. 0121 */ 0122 void SetBoundingLimits(const G4ThreeVector& pMin, const G4ThreeVector& pMax); 0123 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override; 0124 0125 /** 0126 * Calculates the minimum and maximum extent of the solid, when under the 0127 * specified transform, and within the specified limits. 0128 * @param[in] pAxis The axis along which compute the extent. 0129 * @param[in] pVoxelLimit The limiting space dictated by voxels. 0130 * @param[in] pTransform The internal transformation applied to the solid. 0131 * @param[out] pMin The minimum extent value. 0132 * @param[out] pMax The maximum extent value. 0133 * @returns True if the solid is intersected by the extent region. 0134 */ 0135 G4bool CalculateExtent(const EAxis pAxis, 0136 const G4VoxelLimits& pVoxelLimit, 0137 const G4AffineTransform& pTransform, 0138 G4double& pmin, G4double& pmax) const override; 0139 0140 /** 0141 * Concrete implementations of the expected query interfaces for 0142 * solids, as defined in the base class G4VSolid. 0143 */ 0144 EInside Inside(const G4ThreeVector& p) const override; 0145 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override; 0146 G4double DistanceToIn(const G4ThreeVector& p, 0147 const G4ThreeVector& v) const override; 0148 G4double DistanceToIn(const G4ThreeVector& p) const override; 0149 G4double DistanceToOut(const G4ThreeVector& p, 0150 const G4ThreeVector& v, 0151 const G4bool calcNorm = false, 0152 G4bool* validNorm = nullptr, 0153 G4ThreeVector* n = nullptr) const override; 0154 G4double DistanceToOut(const G4ThreeVector& p) const override; 0155 0156 /** 0157 * Returns the type ID, "G4Tet" of the solid. 0158 */ 0159 G4GeometryType GetEntityType() const override; 0160 0161 /** 0162 * Returns true as the solid has only planar faces. 0163 */ 0164 G4bool IsFaceted () const override; 0165 0166 /** 0167 * Makes a clone of the object for use in multi-treading. 0168 * @returns A pointer to the new cloned allocated solid. 0169 */ 0170 G4VSolid* Clone() const override; 0171 0172 /** 0173 * Streams the object contents to an output stream. 0174 */ 0175 std::ostream& StreamInfo(std::ostream& os) const override; 0176 0177 /** 0178 * Returning an estimation of the solid volume (capacity) and 0179 * surface area, in internal units. 0180 */ 0181 G4double GetCubicVolume() override; 0182 G4double GetSurfaceArea() override; 0183 0184 /** 0185 * Returns a random point located and uniformly distributed on the 0186 * surface of the solid. 0187 */ 0188 G4ThreeVector GetPointOnSurface() const override; 0189 0190 /** 0191 * Methods for creating graphical representations (i.e. for visualisation). 0192 */ 0193 void DescribeYourselfTo (G4VGraphicsScene& scene) const override; 0194 G4VisExtent GetExtent () const override; 0195 G4Polyhedron* CreatePolyhedron () const override; 0196 G4Polyhedron* GetPolyhedron () const override; 0197 0198 /** 0199 * Fake default constructor for usage restricted to direct object 0200 * persistency for clients requiring preallocation of memory for 0201 * persistifiable objects. 0202 */ 0203 G4Tet(__void__&); 0204 0205 /** 0206 * Copy constructor and assignment operator. 0207 */ 0208 G4Tet(const G4Tet& rhs); 0209 G4Tet& operator=(const G4Tet& rhs); 0210 0211 private: 0212 0213 /** 0214 * Initialises the data members. 0215 */ 0216 void Initialize(const G4ThreeVector& p0, 0217 const G4ThreeVector& p1, 0218 const G4ThreeVector& p2, 0219 const G4ThreeVector& p3); 0220 0221 /** 0222 * Algorithm for SurfaceNormal() following the original specification 0223 * for points not on the surface. 0224 */ 0225 G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const; 0226 0227 private: 0228 0229 G4double halfTolerance = 0; 0230 G4double fCubicVolume = 0; // Volume 0231 G4double fSurfaceArea = 0; // Surface area 0232 mutable G4bool fRebuildPolyhedron = false; 0233 mutable G4Polyhedron* fpPolyhedron = nullptr; 0234 0235 G4ThreeVector fVertex[4]; // thetrahedron vertices 0236 G4ThreeVector fNormal[4]; // normals to faces 0237 G4double fDist[4] = {0}; // distances from origin to faces 0238 G4double fArea[4] = {0}; // face areas 0239 G4ThreeVector fBmin, fBmax; // bounding box 0240 }; 0241 0242 #endif 0243 0244 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|