Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. >> 3 // >> 4 // By copying, distributing or modifying the Program (or any work >> 5 // based on the Program) you indicate your acceptance of this statement, >> 6 // and all its terms. >> 7 // >> 8 // $Id: G4PolyPhiFace.hh,v 1.1 2000/04/07 10:56:52 gcosmo Exp $ >> 9 // GEANT4 tag $Name: geant4-02-00 $ >> 10 // >> 11 // >> 12 // -------------------------------------------------------------------- >> 13 // GEANT 4 class header file 1 // 14 // 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 // 15 // 26 // G4PolyPhiFace 16 // G4PolyPhiFace 27 // 17 // 28 // Class description: 18 // Class description: 29 // 19 // 30 // Definition of a face that bounds a polyco 20 // Definition of a face that bounds a polycone or polyhedra when 31 // it has a phi opening: << 21 // it has a phi opening. 32 // << 33 // G4PolyPhiFace( const G4ReduciblePolygon* << 34 // G4double phi, << 35 // G4double deltaPhi, << 36 // G4double phiOther ) << 37 // 22 // 38 // Specifically: a face that lies on a plane 23 // Specifically: a face that lies on a plane that passes through 39 // the z axis. It has boundaries that are st 24 // the z axis. It has boundaries that are straight lines of arbitrary 40 // length and direction, but with corners aw 25 // length and direction, but with corners aways on the same side of 41 // the z axis. 26 // the z axis. 42 27 43 // Author: David C. Williams (davidw@scipp.ucs << 44 // ------------------------------------------- 28 // -------------------------------------------------------------------- 45 #ifndef G4POLYPHIFACE_HH << 29 46 #define G4POLYPHIFACE_HH 1 << 30 #ifndef G4PolyPhiFace_hh >> 31 #define G4PolyPhiFace_hh 47 32 48 #include "G4VCSGface.hh" 33 #include "G4VCSGface.hh" 49 #include "G4TwoVector.hh" << 50 34 51 class G4ReduciblePolygon; 35 class G4ReduciblePolygon; 52 36 53 struct G4PolyPhiFaceVertex << 37 typedef struct { 54 { << 38 G4double x, y, r, z; // position 55 G4double x, y, r, z; // position << 39 G4double rNorm, 56 G4double rNorm, << 40 zNorm; // r/z normal 57 zNorm; // r/z normal << 41 G4ThreeVector norm3D; // 3D normal 58 G4ThreeVector norm3D; // 3D normal << 42 } G4PolyPhiFaceVertex; 59 << 43 60 // Needed for Triangulation Algorithm << 44 typedef struct { 61 // << 45 G4PolyPhiFaceVertex *v0, *v1; // Corners 62 G4bool ear; << 46 G4double tr, tz, // Unit vector along edge 63 G4PolyPhiFaceVertex *next,*prev; << 47 length; // Length of edge 64 }; << 48 G4ThreeVector norm3D; // 3D edge normal vector 65 << 49 } G4PolyPhiFaceEdge; 66 struct G4PolyPhiFaceEdge << 50 67 { << 51 class G4PolyPhiFace : public G4VCSGface { 68 G4PolyPhiFaceEdge() = default; << 52 69 G4PolyPhiFaceVertex *v0{nullptr}, *v1{nullp << 53 public: 70 G4double tr{.0}, tz{0.}, // Unit vect << 54 G4PolyPhiFace( const G4ReduciblePolygon *rz, 71 length{0.}; // Length of << 55 const G4double phi, const G4double deltaPhi, const G4double phiOther ); 72 G4ThreeVector norm3D; // 3D edge n << 56 virtual ~G4PolyPhiFace(); 73 }; << 57 74 << 58 G4PolyPhiFace( const G4PolyPhiFace &source ); 75 class G4PolyPhiFace : public G4VCSGface << 59 G4PolyPhiFace *operator=( const G4PolyPhiFace &source ); 76 { << 60 77 << 61 G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v, 78 public: << 62 const G4bool outgoing, const G4double surfTolerance, 79 << 63 G4double &distance, G4double &distFromSurface, 80 G4PolyPhiFace( const G4ReduciblePolygon* r << 64 G4ThreeVector &normal, G4bool &allBehind ); 81 G4double phi, G4doubl << 65 82 // Constructor. << 66 G4double Distance( const G4ThreeVector &p, const G4bool outgoing ); 83 // Points r,z should be supplied in cloc << 67 84 // For example: << 68 EInside Inside( const G4ThreeVector &p, const G4double tolerance, 85 // [1]---------[2] << 69 G4double *bestDistance ); 86 // | | << 70 87 // | | << 71 G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance ); 88 // [0]---------[3] << 72 89 << 73 G4double Extent( const G4ThreeVector axis ); 90 ~G4PolyPhiFace() override; << 74 91 // Destructor. Removes edges and corners << 75 void CalculateExtent( const EAxis axis, 92 << 76 const G4VoxelLimits &voxelLimit, 93 G4PolyPhiFace( const G4PolyPhiFace &source << 77 const G4AffineTransform &tranform, 94 G4PolyPhiFace& operator=( const G4PolyPhiF << 78 G4SolidExtentList &extentList ); 95 // Copy constructor and assgnment operat << 79 96 << 80 G4VCSGface *Clone() { return new G4PolyPhiFace(*this); } 97 G4bool Intersect( const G4ThreeVector& p, << 81 98 G4bool outgoing, G << 82 void Diagnose( G4VSolid *solid ); 99 G4double& distance << 83 100 G4ThreeVector& nor << 84 protected: 101 << 85 G4PolyPhiFaceEdge *edges; // The edges of the face 102 G4double Distance( const G4ThreeVector& p, << 86 G4PolyPhiFaceVertex *corners; // And the corners 103 << 87 G4int numEdges; // Number of edges 104 EInside Inside( const G4ThreeVector& p, G4 << 88 G4ThreeVector normal; // Normal unit vector 105 G4double* bestDistan << 89 G4ThreeVector radial; // Unit vector along radial direction 106 << 90 G4ThreeVector surface; // Point on surface 107 G4ThreeVector Normal( const G4ThreeVector& << 91 G4double rMin, rMax, // Extent in r 108 G4double* best << 92 zMin, zMax; // Extent in z 109 << 93 G4bool allBehind; // True if the entire polycone/polyhedra is behind the place 110 G4double Extent( const G4ThreeVector axis << 94 // of this face 111 << 95 112 void CalculateExtent( const EAxis axis, << 96 G4bool InsideEdgesExact( const G4double r, const G4double z, 113 const G4VoxelLimits << 97 const G4double normSign, const G4ThreeVector &p, const G4ThreeVector &v ); 114 const G4AffineTransf << 98 G4bool InsideEdges( const G4double r, const G4double z ); 115 G4SolidExtentL << 99 G4bool InsideEdges( const G4double r, const G4double z, 116 << 100 G4double *distRZ2, G4PolyPhiFaceVertex **base3Dnorm=0, 117 inline G4VCSGface* Clone() override; << 101 G4ThreeVector **head3Dnorm=0 ); 118 // Allocates on the heap a clone of this << 102 119 << 103 inline G4double ExactZOrder( const G4double z, 120 G4double SurfaceArea() override; << 104 const G4double qx, const G4double qy, const G4double qz, 121 G4double SurfaceTriangle( const G4ThreeVec << 105 const G4ThreeVector &v, 122 const G4ThreeVec << 106 const G4double normSign, 123 G4ThreeVector GetPointOnFace() override; << 107 const G4PolyPhiFaceVertex *vert ) const; 124 // Auxiliary methods for determination o << 108 125 << 109 void CopyStuff( const G4PolyPhiFace &source ); 126 G4PolyPhiFace(__void__&); << 127 // Fake default constructor for usage re << 128 // persistency for clients requiring pre << 129 // persistifiable objects. << 130 << 131 void Diagnose( G4VSolid* solid ); << 132 // Throw an exception if something is fo << 133 // the solid. For debugging purposes onl << 134 << 135 protected: << 136 << 137 G4bool InsideEdgesExact( G4double r, G4dou << 138 const G4ThreeVect << 139 // Decide if the point in r,z is inside << 140 // **but** do so consistently with other << 141 << 142 G4bool InsideEdges( G4double r, G4double z << 143 G4bool InsideEdges( G4double r, G4double z << 144 G4PolyPhiFaceVertex** << 145 G4ThreeVector** head3D << 146 // Decide if the point in r,z is inside << 147 << 148 inline G4double ExactZOrder( G4double z, << 149 G4double qx, << 150 const G4ThreeVector << 151 G4double norm << 152 const G4PolyPhiFace << 153 // Decide precisely whether a trajectory << 154 // or exactly passes through the z posit << 155 << 156 void CopyStuff( const G4PolyPhiFace& sourc << 157 << 158 // Functions used for Triangulation in Cas << 159 // The triangulation is used for GetPointO << 160 << 161 G4double Area2( const G4TwoVector& a, cons << 162 // Calculation of 2*Area of Triangle wit << 163 << 164 G4bool Left( const G4TwoVector& a, const G << 165 G4bool LeftOn( const G4TwoVector& a, const << 166 G4bool Collinear( const G4TwoVector& a, co << 167 // Boolean functions for sign of Surface << 168 << 169 G4bool IntersectProp( const G4TwoVector& a << 170 const G4TwoVector& c << 171 // Boolean function for finding proper i << 172 // line segments (a,b) and (c,d). << 173 << 174 G4bool Between( const G4TwoVector& a, cons << 175 // Boolean function for determining if p << 176 // where the three points (a,b,c) are on << 177 << 178 G4bool Intersect( const G4TwoVector& a, co << 179 const G4TwoVector& c, co << 180 // Boolean function for finding proper i << 181 // of two line segments (a,b) and (c,d). << 182 << 183 G4bool Diagonalie( G4PolyPhiFaceVertex* a, << 184 // Boolean Diagonalie help to determine << 185 // of segment (a,b) is convex or reflex. << 186 << 187 G4bool InCone( G4PolyPhiFaceVertex *a, G4P << 188 // Boolean function for determining if b << 189 // where a is the center of the cone. << 190 << 191 G4bool Diagonal( G4PolyPhiFaceVertex* a, G << 192 // Boolean function for determining if D << 193 // inside Polycone or PolyHedra. << 194 << 195 void EarInit(); << 196 // Initialisation for Triangulisation by << 197 // For details see "Computational Geomet << 198 << 199 void Triangulate(); << 200 // Triangularisation by ear tips for Pol << 201 // For details see "Computational Geomet << 202 // NOTE: a copy of the shape is made and << 203 // order to have a list of triangl << 204 // method GetPointOnFace(). << 205 << 206 protected: << 207 << 208 G4int numEdges = 0; // Number of edges << 209 G4PolyPhiFaceEdge* edges = nullptr; << 210 G4PolyPhiFaceVertex* corners = nullptr; << 211 G4ThreeVector normal; // Normal uni << 212 G4ThreeVector radial; // Unit vecto << 213 G4ThreeVector surface; // Point on s << 214 G4ThreeVector surface_point; // Auxiliary << 215 // method Get << 216 G4double rMin, rMax, // Extent in r << 217 zMin, zMax; // Extent in z << 218 G4bool allBehind = false; // True if the p << 219 // is behind the << 220 G4double kCarTolerance; // Surface th << 221 G4double fSurfaceArea = 0.0; // Surface Ar << 222 G4PolyPhiFaceVertex* triangles = nullptr; << 223 // Auxiliary pointer to 'corners' used f << 224 // Copy structure, changing the structur << 225 }; 110 }; 226 111 227 #include "G4PolyPhiFace.icc" 112 #include "G4PolyPhiFace.icc" 228 113 229 #endif 114 #endif 230 115