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.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /geometry/solids/specific/include/G4PolyPhiFace.hh (Version 11.3.0) and /geometry/solids/specific/include/G4PolyPhiFace.hh (Version 10.1)


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