Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // G4FlatTrapSurface 27 // 28 // Class description: 29 // 30 // Class describing a flat boundary surface for a trapezoid. 31 32 // Author: 27-Oct-2004 - O.Link (Oliver.Link@cern.ch) 33 // -------------------------------------------------------------------- 34 #ifndef G4TWISTTRAPFLATSIDE_HH 35 #define G4TWISTTRAPFLATSIDE_HH 36 37 #include "G4VTwistSurface.hh" 38 39 class G4TwistTrapFlatSide : public G4VTwistSurface 40 { 41 public: 42 43 G4TwistTrapFlatSide( const G4String& name, 44 G4double PhiTwist, 45 G4double pDx1, 46 G4double pDx2, 47 G4double pDy, 48 G4double pDz, 49 G4double pAlpha, 50 G4double pPhi, 51 G4double pTheta, 52 G4int handedness ); 53 ~G4TwistTrapFlatSide() override; 54 55 G4ThreeVector GetNormal(const G4ThreeVector& /* xx */ , 56 G4bool isGlobal = false) override; 57 G4int DistanceToSurface(const G4ThreeVector& gp, 58 const G4ThreeVector& gv, 59 G4ThreeVector gxx[], 60 G4double distance[], 61 G4int areacode[], 62 G4bool isvalid[], 63 EValidate validate = kValidateWithTol) override; 64 65 G4int DistanceToSurface(const G4ThreeVector& gp, 66 G4ThreeVector gxx[], 67 G4double distance[], 68 G4int areacode[]) override; 69 70 inline G4ThreeVector SurfacePoint(G4double x, G4double y, 71 G4bool isGlobal = false) override; 72 inline G4double GetBoundaryMin(G4double u) override; 73 inline G4double GetBoundaryMax(G4double u) override; 74 inline G4double GetSurfaceArea() override; 75 void GetFacets( G4int m, G4int n, G4double xyz[][3], 76 G4int faces[][4], G4int iside ) override; 77 78 G4TwistTrapFlatSide(__void__&); 79 // Fake default constructor for usage restricted to direct object 80 // persistency for clients requiring preallocation of memory for 81 // persistifiable objects. 82 83 protected: 84 85 G4int GetAreaCode(const G4ThreeVector& xx, 86 G4bool withTol = true) override; 87 88 private: 89 90 void SetCorners() override; 91 void SetBoundaries() override; 92 93 inline G4double xAxisMax(G4double u, G4double fTanAlpha) const; 94 95 private: 96 97 G4double fDx1; 98 G4double fDx2; 99 G4double fDy; 100 G4double fDz; 101 G4double fPhiTwist; 102 G4double fAlpha; 103 G4double fTAlph; 104 G4double fPhi; 105 G4double fTheta; 106 G4double fdeltaX; 107 G4double fdeltaY; 108 }; 109 110 //======================================================== 111 // inline functions 112 //======================================================== 113 114 inline 115 G4double G4TwistTrapFlatSide::xAxisMax(G4double u, G4double fTanAlpha) const 116 { 117 return ( ( fDx2 + fDx1 )/2. + u*(fDx2 - fDx1)/(2.*fDy) + u *fTanAlpha ) ; 118 } 119 120 inline G4ThreeVector 121 G4TwistTrapFlatSide::SurfacePoint(G4double x, G4double y, G4bool isGlobal) 122 { 123 G4ThreeVector SurfPoint ( x,y,0); 124 125 if (isGlobal) { return (fRot*SurfPoint + fTrans); } 126 return SurfPoint; 127 } 128 129 inline 130 G4double G4TwistTrapFlatSide::GetBoundaryMin(G4double y) 131 { 132 return -xAxisMax(y, -fTAlph) ; 133 } 134 135 inline 136 G4double G4TwistTrapFlatSide::GetBoundaryMax(G4double y) 137 { 138 return xAxisMax(y, fTAlph) ; 139 } 140 141 inline 142 G4double G4TwistTrapFlatSide::GetSurfaceArea() 143 { 144 return 2*(fDx1 + fDx2)*fDy ; 145 } 146 147 #endif 148