File indexing completed on 2025-01-18 09:58:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #ifndef G4POLYCONESIDE_HH
0046 #define G4POLYCONESIDE_HH
0047
0048 #include "G4VCSGface.hh"
0049
0050 class G4IntersectingCone;
0051
0052 struct G4PolyconeSideRZ
0053 {
0054 G4double r, z;
0055 };
0056
0057
0058
0059
0060 #include "G4GeomSplitter.hh"
0061
0062
0063
0064
0065 class G4PlSideData
0066 {
0067 public:
0068
0069 void initialize()
0070 {
0071 fPhix = 0.; fPhiy = 0.; fPhiz = 0.; fPhik = 0.;
0072 }
0073
0074 G4double fPhix=0., fPhiy=0., fPhiz=0., fPhik=0.;
0075 };
0076
0077
0078
0079
0080
0081
0082 using G4PlSideManager = G4GeomSplitter<G4PlSideData>;
0083
0084
0085
0086
0087 class G4PolyconeSide : public G4VCSGface
0088 {
0089 public:
0090
0091 G4PolyconeSide( const G4PolyconeSideRZ* prevRZ,
0092 const G4PolyconeSideRZ* tail,
0093 const G4PolyconeSideRZ* head,
0094 const G4PolyconeSideRZ* nextRZ,
0095 G4double phiStart, G4double deltaPhi,
0096 G4bool phiIsOpen, G4bool isAllBehind = false );
0097 ~G4PolyconeSide() override;
0098
0099 G4PolyconeSide( const G4PolyconeSide& source );
0100 G4PolyconeSide& operator=( const G4PolyconeSide& source );
0101
0102 G4bool Intersect(const G4ThreeVector& p, const G4ThreeVector& v,
0103 G4bool outgoing, G4double surfTolerance,
0104 G4double& distance, G4double &distFromSurface,
0105 G4ThreeVector& normal, G4bool& isAllBehind) override;
0106
0107 G4double Distance( const G4ThreeVector& p, G4bool outgoing ) override;
0108
0109 EInside Inside( const G4ThreeVector& p, G4double tolerance,
0110 G4double* bestDistance ) override;
0111
0112 G4ThreeVector Normal( const G4ThreeVector& p,
0113 G4double* bestDistance ) override;
0114
0115 G4double Extent( const G4ThreeVector axis ) override;
0116
0117 void CalculateExtent( const EAxis axis,
0118 const G4VoxelLimits& voxelLimit,
0119 const G4AffineTransform& tranform,
0120 G4SolidExtentList& extentList ) override;
0121
0122 G4VCSGface* Clone() override { return new G4PolyconeSide( *this ); }
0123
0124 G4double SurfaceArea() override;
0125 G4ThreeVector GetPointOnFace() override;
0126
0127 G4PolyconeSide(__void__&);
0128
0129
0130
0131
0132 inline G4int GetInstanceID() const { return instanceID; }
0133
0134
0135 static const G4PlSideManager& GetSubInstanceManager();
0136
0137
0138 protected:
0139
0140 G4double DistanceAway( const G4ThreeVector& p, G4bool opposite,
0141 G4double& distOutside2,
0142 G4double* rzNorm = nullptr );
0143
0144 G4double DistanceAway( const G4ThreeVector& p, G4double& distOutside2,
0145 G4double* edgeRZnorm );
0146
0147 G4bool PointOnCone( const G4ThreeVector& hit, G4double normSign,
0148 const G4ThreeVector& p,
0149 const G4ThreeVector& v, G4ThreeVector& normal );
0150
0151 void CopyStuff( const G4PolyconeSide& source );
0152
0153 static void FindLineIntersect( G4double x1, G4double y1,
0154 G4double tx1, G4double ty1,
0155 G4double x2, G4double y2,
0156 G4double tx2, G4double ty2,
0157 G4double& x, G4double& y );
0158
0159 G4double GetPhi( const G4ThreeVector& p );
0160
0161 protected:
0162
0163 G4double r[2], z[2];
0164 G4double startPhi,
0165 deltaPhi;
0166 G4bool phiIsOpen = false;
0167 G4bool allBehind = false;
0168
0169 G4IntersectingCone* cone = nullptr;
0170
0171 G4double rNorm, zNorm;
0172 G4double rS, zS;
0173 G4double length;
0174 G4double prevRS,
0175 prevZS;
0176 G4double nextRS,
0177 nextZS;
0178
0179 G4double rNormEdge[2],
0180 zNormEdge[2];
0181
0182 G4int ncorners = 0;
0183 G4ThreeVector* corners = nullptr;
0184
0185 private:
0186
0187 G4double kCarTolerance;
0188 G4double fSurfaceArea = 0.0;
0189
0190 G4int instanceID;
0191
0192 G4GEOM_DLL static G4PlSideManager subInstanceManager;
0193
0194 };
0195
0196 #endif