File indexing completed on 2025-01-18 09:59:06
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
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 #ifndef G4SPHERE_HH
0061 #define G4SPHERE_HH
0062
0063 #include "G4GeomTypes.hh"
0064
0065 #if defined(G4GEOM_USE_USOLIDS)
0066 #define G4GEOM_USE_USPHERE 1
0067 #endif
0068
0069 #if defined(G4GEOM_USE_USPHERE)
0070 #define G4USphere G4Sphere
0071 #include "G4USphere.hh"
0072 #else
0073
0074 #include <CLHEP/Units/PhysicalConstants.h>
0075 #include "G4CSGSolid.hh"
0076 #include "G4Polyhedron.hh"
0077
0078 class G4VisExtent;
0079
0080 class G4Sphere : public G4CSGSolid
0081 {
0082 public:
0083
0084 G4Sphere(const G4String& pName,
0085 G4double pRmin, G4double pRmax,
0086 G4double pSPhi, G4double pDPhi,
0087 G4double pSTheta, G4double pDTheta);
0088
0089
0090
0091
0092 ~G4Sphere() override;
0093
0094
0095
0096
0097
0098 inline G4double GetInnerRadius () const;
0099 inline G4double GetOuterRadius () const;
0100 inline G4double GetStartPhiAngle () const;
0101 inline G4double GetDeltaPhiAngle () const;
0102 inline G4double GetStartThetaAngle() const;
0103 inline G4double GetDeltaThetaAngle() const;
0104 inline G4double GetSinStartPhi () const;
0105 inline G4double GetCosStartPhi () const;
0106 inline G4double GetSinEndPhi () const;
0107 inline G4double GetCosEndPhi () const;
0108 inline G4double GetSinStartTheta () const;
0109 inline G4double GetCosStartTheta () const;
0110 inline G4double GetSinEndTheta () const;
0111 inline G4double GetCosEndTheta () const;
0112
0113
0114
0115 inline void SetInnerRadius (G4double newRMin);
0116 inline void SetOuterRadius (G4double newRmax);
0117 inline void SetStartPhiAngle (G4double newSphi, G4bool trig = true);
0118 inline void SetDeltaPhiAngle (G4double newDphi);
0119 inline void SetStartThetaAngle(G4double newSTheta);
0120 inline void SetDeltaThetaAngle(G4double newDTheta);
0121
0122
0123
0124 G4double GetCubicVolume() override;
0125 G4double GetSurfaceArea() override;
0126
0127 void ComputeDimensions( G4VPVParameterisation* p,
0128 const G4int n,
0129 const G4VPhysicalVolume* pRep) override;
0130
0131 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0132
0133 G4bool CalculateExtent(const EAxis pAxis,
0134 const G4VoxelLimits& pVoxelLimit,
0135 const G4AffineTransform& pTransform,
0136 G4double& pmin, G4double& pmax) const override;
0137
0138 EInside Inside(const G4ThreeVector& p) const override;
0139
0140 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override;
0141
0142 G4double DistanceToIn(const G4ThreeVector& p,
0143 const G4ThreeVector& v) const override;
0144
0145 G4double DistanceToIn(const G4ThreeVector& p) const override;
0146
0147 G4double DistanceToOut(const G4ThreeVector& p,
0148 const G4ThreeVector& v,
0149 const G4bool calcNorm = false,
0150 G4bool* validNorm = nullptr,
0151 G4ThreeVector* n = nullptr) const override;
0152
0153 G4double DistanceToOut(const G4ThreeVector& p) const override;
0154
0155 G4GeometryType GetEntityType() const override;
0156
0157 G4ThreeVector GetPointOnSurface() const override;
0158
0159 G4VSolid* Clone() const override;
0160
0161 std::ostream& StreamInfo(std::ostream& os) const override;
0162
0163
0164
0165 G4VisExtent GetExtent () const override;
0166 void DescribeYourselfTo(G4VGraphicsScene& scene) const override;
0167 G4Polyhedron* CreatePolyhedron() const override;
0168
0169 G4Sphere(__void__&);
0170
0171
0172
0173
0174
0175 G4Sphere(const G4Sphere& rhs);
0176 G4Sphere& operator=(const G4Sphere& rhs);
0177
0178
0179
0180 private:
0181
0182 inline void Initialize();
0183
0184
0185
0186 inline void CheckThetaAngles(G4double sTheta, G4double dTheta);
0187 inline void CheckSPhiAngle(G4double sPhi);
0188 inline void CheckDPhiAngle(G4double dPhi);
0189 inline void CheckPhiAngles(G4double sPhi, G4double dPhi);
0190
0191
0192
0193 inline void InitializePhiTrigonometry();
0194 inline void InitializeThetaTrigonometry();
0195
0196
0197
0198 G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
0199
0200
0201
0202
0203 private:
0204
0205
0206
0207 enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kSTheta,kETheta};
0208
0209
0210
0211 enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNSTheta,kNETheta};
0212
0213 G4double fRminTolerance, fRmaxTolerance, kAngTolerance,
0214 kRadTolerance, fEpsilon = 2.e-11;
0215
0216
0217
0218 G4double fRmin, fRmax, fSPhi, fDPhi, fSTheta, fDTheta;
0219
0220
0221
0222 G4double sinCPhi, cosCPhi, cosHDPhi, cosHDPhiOT, cosHDPhiIT,
0223 sinSPhi, cosSPhi, sinEPhi, cosEPhi, hDPhi, cPhi, ePhi;
0224
0225
0226
0227 G4double sinSTheta, cosSTheta, sinETheta, cosETheta,
0228 tanSTheta, tanSTheta2, tanETheta, tanETheta2, eTheta;
0229
0230
0231
0232 G4bool fFullPhiSphere=false, fFullThetaSphere=false, fFullSphere=true;
0233
0234
0235
0236 G4double halfCarTolerance, halfAngTolerance;
0237
0238
0239 };
0240
0241 #include "G4Sphere.icc"
0242
0243 #endif
0244
0245 #endif