File indexing completed on 2026-10-02 09:06:01
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 #ifndef G4VTWISTEDFACETED_HH
0036 #define G4VTWISTEDFACETED_HH 1
0037
0038 #include "G4VSolid.hh"
0039 #include "G4TwoVector.hh"
0040 #include "G4TwistTrapAlphaSide.hh"
0041 #include "G4TwistTrapParallelSide.hh"
0042 #include "G4TwistBoxSide.hh"
0043 #include "G4TwistTrapFlatSide.hh"
0044
0045 class G4SolidExtentList;
0046 class G4ClippablePolygon;
0047
0048
0049
0050
0051
0052
0053 class G4VTwistedFaceted: public G4VSolid
0054 {
0055 public:
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 G4VTwistedFaceted(const G4String& pname,
0075 G4double PhiTwist,
0076 G4double pDz,
0077 G4double pTheta,
0078 G4double pPhi,
0079 G4double pDy1,
0080 G4double pDx1,
0081 G4double pDx2,
0082 G4double pDy2,
0083 G4double pDx3,
0084 G4double pDx4,
0085 G4double pAlph );
0086
0087
0088
0089
0090 ~G4VTwistedFaceted() override;
0091
0092
0093
0094
0095
0096 void ComputeDimensions(G4VPVParameterisation*,
0097 const G4int,
0098 const G4VPhysicalVolume* ) override;
0099
0100
0101
0102
0103
0104
0105 void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override;
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117 G4bool CalculateExtent(const EAxis pAxis,
0118 const G4VoxelLimits& pVoxelLimit,
0119 const G4AffineTransform& pTransform,
0120 G4double& pMin,
0121 G4double& pMax ) const override;
0122
0123
0124
0125
0126
0127 G4double DistanceToIn (const G4ThreeVector& p,
0128 const G4ThreeVector& v ) const override;
0129 G4double DistanceToIn (const G4ThreeVector& p ) const override;
0130 G4double DistanceToOut(const G4ThreeVector& p,
0131 const G4ThreeVector& v,
0132 const G4bool calcnorm = false,
0133 G4bool* validnorm = nullptr,
0134 G4ThreeVector* n = nullptr ) const override;
0135 G4double DistanceToOut(const G4ThreeVector& p) const override;
0136 EInside Inside (const G4ThreeVector& p) const override;
0137 G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const override;
0138
0139
0140
0141
0142
0143 G4ThreeVector GetPointOnSurface() const override;
0144
0145
0146
0147
0148
0149 G4double GetCubicVolume() override;
0150 G4double GetSurfaceArea() override;
0151
0152
0153
0154
0155 void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
0156 G4Polyhedron* CreatePolyhedron () const override;
0157 G4Polyhedron* GetPolyhedron () const override;
0158 G4VisExtent GetExtent () const override;
0159
0160
0161
0162
0163 std::ostream& StreamInfo(std::ostream& os) const override;
0164
0165
0166
0167
0168 inline G4double GetTwistAngle() const { return fPhiTwist; }
0169 inline G4double GetDx1 () const { return fDx1 ; }
0170 inline G4double GetDx2 () const { return fDx2 ; }
0171 inline G4double GetDx3 () const { return fDx3 ; }
0172 inline G4double GetDx4 () const { return fDx4 ; }
0173 inline G4double GetDy1 () const { return fDy1 ; }
0174 inline G4double GetDy2 () const { return fDy2 ; }
0175 inline G4double GetDz () const { return fDz ; }
0176 inline G4double GetPhi () const { return fPhi ; }
0177 inline G4double GetTheta () const { return fTheta ; }
0178 inline G4double GetAlpha () const { return fAlph ; }
0179 inline G4double Xcoef(G4double u, G4double phi, G4double ftg) const;
0180 inline G4double GetValueA(G4double phi) const;
0181 inline G4double GetValueB(G4double phi) const;
0182 inline G4double GetValueD(G4double phi) const;
0183
0184
0185
0186
0187 G4GeometryType GetEntityType() const override;
0188
0189
0190
0191
0192
0193
0194 G4VTwistedFaceted(__void__&);
0195
0196
0197
0198
0199 G4VTwistedFaceted(const G4VTwistedFaceted& rhs);
0200 G4VTwistedFaceted& operator=(const G4VTwistedFaceted& rhs);
0201
0202 protected:
0203
0204 mutable G4bool fRebuildPolyhedron = false;
0205 mutable G4Polyhedron* fpPolyhedron = nullptr;
0206
0207 G4double fCubicVolume = 0.0;
0208 G4double fSurfaceArea = 0.0;
0209
0210 private:
0211
0212
0213
0214
0215 G4double GetLateralFaceArea(const G4TwoVector& p1,
0216 const G4TwoVector& p2,
0217 const G4TwoVector& p3,
0218 const G4TwoVector& p4) const;
0219
0220
0221
0222
0223 void CreateSurfaces();
0224
0225 private:
0226
0227 G4double fTheta;
0228 G4double fPhi ;
0229
0230 G4double fDy1;
0231 G4double fDx1;
0232 G4double fDx2;
0233
0234 G4double fDy2;
0235 G4double fDx3;
0236 G4double fDx4;
0237
0238 G4double fDz;
0239
0240 G4double fDx ;
0241 G4double fDy ;
0242
0243 G4double fAlph ;
0244 G4double fTAlph ;
0245
0246 G4double fdeltaX ;
0247 G4double fdeltaY ;
0248
0249 G4double fPhiTwist;
0250
0251 G4VTwistSurface* fLowerEndcap ;
0252 G4VTwistSurface* fUpperEndcap ;
0253
0254 G4VTwistSurface* fSide0 ;
0255 G4VTwistSurface* fSide90 ;
0256 G4VTwistSurface* fSide180 ;
0257 G4VTwistSurface* fSide270 ;
0258
0259 };
0260
0261
0262
0263 inline
0264 G4double G4VTwistedFaceted::GetValueA(G4double phi) const
0265 {
0266 return ( fDx4 + fDx2 + ( fDx4 - fDx2 ) * ( 2 * phi ) / fPhiTwist ) ;
0267 }
0268
0269 inline
0270 G4double G4VTwistedFaceted::GetValueD(G4double phi) const
0271 {
0272 return ( fDx3 + fDx1 + ( fDx3 - fDx1 ) * ( 2 * phi ) / fPhiTwist ) ;
0273 }
0274
0275 inline
0276 G4double G4VTwistedFaceted::GetValueB(G4double phi) const
0277 {
0278 return ( fDy2 + fDy1 + ( fDy2 - fDy1 ) * ( 2 * phi ) / fPhiTwist ) ;
0279 }
0280
0281 inline
0282 G4double G4VTwistedFaceted::Xcoef(G4double u, G4double phi, G4double ftg) const
0283 {
0284 return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
0285 - u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) - ftg );
0286 }
0287
0288 #endif