|
|
|||
File indexing completed on 2026-08-13 09:13:01
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 // G4UGenericTrap 0027 // 0028 // Class description: 0029 // 0030 // Wrapper class for G4GenericTrap to make use of VecGeom GenericTrap. 0031 0032 // Author: Gabriele Cosmo (CERN), 30.10.2013 0033 // -------------------------------------------------------------------- 0034 #ifndef G4UGENERICTRAP_HH 0035 #define G4UGENERICTRAP_HH 0036 0037 #include "G4UAdapter.hh" 0038 0039 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) ) 0040 0041 #include <VecGeom/volumes/UnplacedGenTrap.h> 0042 #include "G4TwoVector.hh" 0043 0044 #include "G4Polyhedron.hh" 0045 0046 /** 0047 * @brief G4UGenericTrap is a wrapper class for G4GenericTrap 0048 * to make use of VecGeom GenericTrap. 0049 */ 0050 0051 class G4UGenericTrap : public G4UAdapter<vecgeom::UnplacedGenTrap> 0052 { 0053 using Shape_t = vecgeom::UnplacedGenTrap; 0054 using Base_t = G4UAdapter<vecgeom::UnplacedGenTrap>; 0055 0056 public: 0057 0058 /** 0059 * Constructs an generic trapezoid, given its vertices. 0060 * @param[in] name The solid name. 0061 * @param[in] halfZ Half length in Z. 0062 * @param[in] vertices The (x,y) coordinates of the vertices. 0063 */ 0064 G4UGenericTrap(const G4String& name, G4double halfZ, 0065 const std::vector<G4TwoVector>& vertices); 0066 0067 /** 0068 * Default destructor. 0069 */ 0070 ~G4UGenericTrap() override = default; 0071 0072 /** 0073 * Accessors. 0074 */ 0075 G4double GetZHalfLength() const; 0076 G4int GetNofVertices() const; 0077 G4TwoVector GetVertex(G4int index) const; 0078 const std::vector<G4TwoVector>& GetVertices() const; 0079 G4double GetTwistAngle(G4int index) const; 0080 G4bool IsTwisted() const; 0081 G4int GetVisSubdivisions() const; 0082 0083 /** 0084 * Modifiers. 0085 */ 0086 void SetVisSubdivisions(G4int subdiv); 0087 void SetZHalfLength(G4double); 0088 0089 /** 0090 * Returns the type ID, "G4GenericTrap" of the solid. 0091 */ 0092 inline G4GeometryType GetEntityType() const override; 0093 0094 /** 0095 * Returns true as the solid has only planar faces. 0096 */ 0097 inline G4bool IsFaceted() const override; 0098 0099 /** 0100 * Computes the bounding limits of the solid. 0101 * @param[out] pMin The minimum bounding limit point. 0102 * @param[out] pMax The maximum bounding limit point. 0103 */ 0104 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override; 0105 0106 /** 0107 * Calculates the minimum and maximum extent of the solid, when under the 0108 * specified transform, and within the specified limits. 0109 * @param[in] pAxis The axis along which compute the extent. 0110 * @param[in] pVoxelLimit The limiting space dictated by voxels. 0111 * @param[in] pTransform The internal transformation applied to the solid. 0112 * @param[out] pMin The minimum extent value. 0113 * @param[out] pMax The maximum extent value. 0114 * @returns True if the solid is intersected by the extent region. 0115 */ 0116 G4bool CalculateExtent(const EAxis pAxis, 0117 const G4VoxelLimits& pVoxelLimit, 0118 const G4AffineTransform& pTransform, 0119 G4double& pMin, G4double& pMax) const override; 0120 0121 /** 0122 * Returns a generated polyhedron as graphical representations. 0123 */ 0124 G4Polyhedron* CreatePolyhedron() const override; 0125 0126 /** 0127 * Copy constructor and assignment operator. 0128 */ 0129 G4UGenericTrap( const G4UGenericTrap& source ); 0130 G4UGenericTrap& operator=(const G4UGenericTrap& source); 0131 0132 private: 0133 0134 /** 0135 * Initialises data. Used in constructor. 0136 */ 0137 void Initialise(const std::vector<G4TwoVector>& v); 0138 0139 private: 0140 0141 G4int fVisSubdivisions; 0142 std::vector<G4TwoVector> fVertices; 0143 0144 }; 0145 0146 // -------------------------------------------------------------------- 0147 // Inline methods 0148 // -------------------------------------------------------------------- 0149 0150 inline G4GeometryType G4UGenericTrap::GetEntityType() const 0151 { 0152 return "G4GenericTrap"; 0153 } 0154 0155 inline G4bool G4UGenericTrap::IsFaceted() const 0156 { 0157 return true; 0158 } 0159 0160 #endif // G4GEOM_USE_USOLIDS 0161 0162 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|