File indexing completed on 2025-01-18 09:59:14
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
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 #ifndef G4TRAP_HH
0086 #define G4TRAP_HH
0087
0088 #include "G4Types.hh"
0089
0090 struct TrapSidePlane
0091 {
0092 G4double a,b,c,d;
0093
0094 };
0095
0096 #include "G4GeomTypes.hh"
0097
0098 #if defined(G4GEOM_USE_USOLIDS)
0099 #define G4GEOM_USE_UTRAP 1
0100 #endif
0101
0102 #if defined(G4GEOM_USE_UTRAP)
0103 #define G4UTrap G4Trap
0104 #include "G4UTrap.hh"
0105 #else
0106
0107 #include "G4CSGSolid.hh"
0108
0109 class G4Trap : public G4CSGSolid
0110 {
0111
0112 public:
0113
0114 G4Trap( const G4String& pName,
0115 G4double pDz,
0116 G4double pTheta, G4double pPhi,
0117 G4double pDy1, G4double pDx1, G4double pDx2,
0118 G4double pAlp1,
0119 G4double pDy2, G4double pDx3, G4double pDx4,
0120 G4double pAlp2 );
0121
0122
0123
0124
0125 G4Trap( const G4String& pName,
0126 const G4ThreeVector pt[8] ) ;
0127
0128
0129
0130 G4Trap( const G4String& pName,
0131 G4double pZ,
0132 G4double pY,
0133 G4double pX, G4double pLTX );
0134
0135
0136
0137 G4Trap( const G4String& pName,
0138 G4double pDx1, G4double pDx2,
0139 G4double pDy1, G4double pDy2,
0140 G4double pDz );
0141
0142
0143
0144 G4Trap(const G4String& pName,
0145 G4double pDx, G4double pDy, G4double pDz,
0146 G4double pAlpha, G4double pTheta, G4double pPhi );
0147
0148
0149
0150 G4Trap( const G4String& pName );
0151
0152
0153
0154
0155 ~G4Trap() override ;
0156
0157
0158
0159
0160
0161 inline G4double GetZHalfLength() const;
0162 inline G4double GetYHalfLength1() const;
0163 inline G4double GetXHalfLength1() const;
0164 inline G4double GetXHalfLength2() const;
0165 inline G4double GetTanAlpha1() const;
0166 inline G4double GetYHalfLength2() const;
0167 inline G4double GetXHalfLength3() const;
0168 inline G4double GetXHalfLength4() const;
0169 inline G4double GetTanAlpha2() const;
0170
0171
0172
0173
0174 inline TrapSidePlane GetSidePlane( G4int n ) const;
0175 inline G4ThreeVector GetSymAxis() const;
0176
0177 inline G4double GetPhi() const;
0178 inline G4double GetTheta() const;
0179 inline G4double GetAlpha1() const;
0180 inline G4double GetAlpha2() const;
0181
0182
0183
0184
0185 void SetAllParameters ( G4double pDz,
0186 G4double pTheta,
0187 G4double pPhi,
0188 G4double pDy1,
0189 G4double pDx1,
0190 G4double pDx2,
0191 G4double pAlp1,
0192 G4double pDy2,
0193 G4double pDx3,
0194 G4double pDx4,
0195 G4double pAlp2 );
0196
0197
0198
0199 G4double GetCubicVolume() override;
0200 G4double GetSurfaceArea() override;
0201
0202 void ComputeDimensions( G4VPVParameterisation* p,
0203 const G4int n,
0204 const G4VPhysicalVolume* pRep ) override;
0205
0206 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0207
0208 G4bool CalculateExtent(const EAxis pAxis,
0209 const G4VoxelLimits& pVoxelLimit,
0210 const G4AffineTransform& pTransform,
0211 G4double& pMin, G4double& pMax) const override;
0212
0213 EInside Inside( const G4ThreeVector& p ) const override;
0214
0215 G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
0216
0217 G4double DistanceToIn(const G4ThreeVector& p,
0218 const G4ThreeVector& v) const override;
0219
0220 G4double DistanceToIn( const G4ThreeVector& p ) const override;
0221
0222 G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
0223 const G4bool calcNorm = false,
0224 G4bool* validNorm = nullptr,
0225 G4ThreeVector* n = nullptr) const override;
0226
0227 G4double DistanceToOut( const G4ThreeVector& p ) const override;
0228
0229 G4GeometryType GetEntityType() const override;
0230
0231 G4ThreeVector GetPointOnSurface() const override;
0232
0233 G4VSolid* Clone() const override;
0234
0235 std::ostream& StreamInfo( std::ostream& os ) const override;
0236
0237
0238
0239 void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
0240 G4Polyhedron* CreatePolyhedron () const override;
0241
0242 G4Trap(__void__&);
0243
0244
0245
0246
0247 G4Trap(const G4Trap& rhs);
0248 G4Trap& operator=(const G4Trap& rhs);
0249
0250
0251 protected:
0252
0253 void MakePlanes();
0254 void MakePlanes( const G4ThreeVector pt[8] );
0255 G4bool MakePlane( const G4ThreeVector& p1,
0256 const G4ThreeVector& p2,
0257 const G4ThreeVector& p3,
0258 const G4ThreeVector& p4,
0259 TrapSidePlane& plane ) ;
0260 void SetCachedValues();
0261
0262 private:
0263
0264 void CheckParameters();
0265
0266
0267 void GetVertices(G4ThreeVector pt[8]) const;
0268
0269
0270 G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
0271
0272
0273
0274 private:
0275
0276 G4double halfCarTolerance;
0277 G4double fDz,fTthetaCphi,fTthetaSphi;
0278 G4double fDy1,fDx1,fDx2,fTalpha1;
0279 G4double fDy2,fDx3,fDx4,fTalpha2;
0280 TrapSidePlane fPlanes[4];
0281 G4double fAreas[6];
0282 G4int fTrapType;
0283 };
0284
0285 #include "G4Trap.icc"
0286
0287 #endif
0288
0289 #endif