Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // class G4BoundingEnvelope 27 // 28 // Class description: 29 // 30 // Helper class to facilitate calculation of t 31 // within the limits defined by a G4VoxelLimit 32 // 33 // The function CalculateExtent() of a particu 34 // a G4BoundingEnvelope object that bounds the 35 // CalculateExtent() of the G4BoundingEnvelope 36 // 37 // Calculation of extent uses G4Transform3D, t 38 // scaling and reflection, if any. 39 40 // 2016.05.25, E.Tcherniaev - initial version 41 // ------------------------------------------- 42 #ifndef G4BOUNDINGENVELOPE_HH 43 #define G4BOUNDINGENVELOPE_HH 44 45 #include <vector> 46 #include "geomdefs.hh" 47 48 #include "G4ThreeVector.hh" 49 #include "G4VoxelLimits.hh" 50 #include "G4Transform3D.hh" 51 #include "G4Point3D.hh" 52 #include "G4Plane3D.hh" 53 54 using G4ThreeVectorList = std::vector<G4ThreeV 55 using G4Polygon3D = std::vector<G4Point3D>; 56 using G4Segment3D = std::pair<G4Point3D,G4Poin 57 58 class G4BoundingEnvelope 59 { 60 public: 61 62 G4BoundingEnvelope(const G4ThreeVector& pM 63 const G4ThreeVector& pM 64 // Constructor from an axis aligned boun 65 66 G4BoundingEnvelope(const std::vector<const 67 // Constructor from a sequence of convex 68 // should have equal numbers of vertices 69 // polygons which may consist of a singl 70 71 G4BoundingEnvelope(const G4ThreeVector& pM 72 const G4ThreeVector& pM 73 const std::vector<const 74 // Constructor from AABB and a sequence 75 76 ~G4BoundingEnvelope() = default; 77 // Destructor 78 79 G4bool BoundingBoxVsVoxelLimits(const EAxi 80 const G4Vo 81 const G4Tr 82 G4double& 83 // Analyse the position of the bounding 84 // It returns "true" in the case where t 85 // figured out directly from the dimensi 86 // it is clear that the bounding box and 87 // The reply "false" means that further 88 89 G4bool CalculateExtent(const EAxis pAxis, 90 const G4VoxelLimits 91 const G4Transform3D 92 G4double& pMin, G4d 93 // Calculate extent of the bounding enve 94 95 private: 96 97 void CheckBoundingBox(); 98 // Check correctness of the AABB (axis a 99 100 void CheckBoundingPolygons(); 101 // Check correctness of the sequence of 102 103 G4double FindScaleFactor(const G4Transform 104 // Find max scale factor of the transfor 105 106 void TransformVertices(const G4Transform3D 107 std::vector<G 108 std::vector<s 109 // Create list of transformed polygons 110 111 void GetPrismAABB(const G4Polygon3D& pBase 112 const G4Polygon3D& pBase 113 G4Segment3D& pAABB 114 // Find bounding box of a prism 115 116 void CreateListOfEdges(const G4Polygon3D& 117 const G4Polygon3D& 118 std::vector<G 119 // Create list of edges of a prism 120 121 void CreateListOfPlanes(const G4Polygon3D& 122 const G4Polygon3D& 123 std::vector< 124 // Create list of planes bounding a pris 125 126 G4bool ClipEdgesByVoxel(const std::vector< 127 const G4VoxelLimit 128 G4Segment3D& 129 // Clip set of edges by G4VoxelLimits 130 131 void ClipVoxelByPlanes(G4int pBits, 132 const G4VoxelLimits 133 const std::vector<G 134 const G4Segment3D& 135 G4Segment3D& 136 // Clip G4VoxelLimits by set of planes b 137 138 private: 139 140 G4ThreeVector fMin, fMax; 141 // original bounding box 142 143 const std::vector<const G4ThreeVectorList* 144 // ref to original sequence of polygonal 145 }; 146 147 #endif // G4BOUNDINGENVELOPE_HH 148