00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef __G4TWISTTUBSSIDE__
00048 #define __G4TWISTTUBSSIDE__
00049
00050 #include "G4VTwistSurface.hh"
00051
00052 class G4TwistTubsSide : public G4VTwistSurface
00053 {
00054 public:
00055
00056 G4TwistTubsSide(const G4String &name,
00057 const G4RotationMatrix &rot,
00058 const G4ThreeVector &tlate,
00059 G4int handedness,
00060 const G4double kappa,
00061 const EAxis axis0 = kXAxis,
00062 const EAxis axis1 = kZAxis,
00063 G4double axis0min = -kInfinity,
00064 G4double axis1min = -kInfinity,
00065 G4double axis0max = kInfinity,
00066 G4double axis1max = kInfinity );
00067
00068 G4TwistTubsSide(const G4String &name,
00069 G4double EndInnerRadius[2],
00070 G4double EndOuterRadius[2],
00071 G4double DPhi,
00072 G4double EndPhi[2],
00073 G4double EndZ[2],
00074 G4double InnerRadius,
00075 G4double OuterRadius,
00076 G4double Kappa,
00077 G4int handedness);
00078
00079 virtual ~G4TwistTubsSide();
00080
00081 virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
00082 G4bool isGlobal = false) ;
00083
00084 virtual G4int DistanceToSurface(const G4ThreeVector &gp,
00085 const G4ThreeVector &gv,
00086 G4ThreeVector gxx[],
00087 G4double distance[],
00088 G4int areacode[],
00089 G4bool isvalid[],
00090 EValidate validate = kValidateWithTol);
00091
00092 virtual G4int DistanceToSurface(const G4ThreeVector &gp,
00093 G4ThreeVector gxx[],
00094 G4double distance[],
00095 G4int areacode[]);
00096
00097 inline G4ThreeVector ProjectAtPXPZ(const G4ThreeVector &p,
00098 G4bool isglobal = false) const ;
00099
00100 virtual G4ThreeVector SurfacePoint(G4double, G4double,
00101 G4bool isGlobal = false) ;
00102 virtual G4double GetBoundaryMin(G4double phi) ;
00103 virtual G4double GetBoundaryMax(G4double phi) ;
00104 virtual G4double GetSurfaceArea() ;
00105 virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
00106 G4int faces[][4], G4int iside ) ;
00107
00108 public:
00109
00110 G4TwistTubsSide(__void__&);
00111
00112
00113
00114
00115 private:
00116
00117 virtual G4double DistanceToPlane(const G4ThreeVector &p,
00118 const G4ThreeVector &A,
00119 const G4ThreeVector &B,
00120 const G4ThreeVector &C,
00121 const G4ThreeVector &D,
00122 const G4int parity,
00123 G4ThreeVector &xx,
00124 G4ThreeVector &n);
00125
00126 virtual G4int GetAreaCode(const G4ThreeVector &xx,
00127 G4bool withTol = true);
00128
00129 virtual void SetCorners();
00130
00131 virtual void SetCorners( G4double endInnerRad[2],
00132 G4double endOuterRad[2],
00133 G4double endPhi[2],
00134 G4double endZ[2] ) ;
00135
00136 virtual void SetBoundaries();
00137
00138 private:
00139
00140 G4double fKappa;
00141 };
00142
00143
00144
00145
00146
00147
00148 inline
00149 G4ThreeVector G4TwistTubsSide::ProjectAtPXPZ(const G4ThreeVector &p,
00150 G4bool isglobal) const
00151 {
00152
00153 G4ThreeVector tmpp;
00154 if (isglobal) {
00155 tmpp = fRot.inverse()*p - fTrans;
00156 } else {
00157 tmpp = p;
00158 }
00159 G4ThreeVector xx(p.x(), p.x() * fKappa * p.z(), p.z());
00160 if (isglobal) { return (fRot * xx + fTrans); }
00161 return xx;
00162 }
00163
00164 inline
00165 G4ThreeVector
00166 G4TwistTubsSide::SurfacePoint(G4double x, G4double z, G4bool isGlobal)
00167 {
00168 G4ThreeVector SurfPoint( x , x * fKappa * z , z ) ;
00169
00170 if (isGlobal) { return (fRot * SurfPoint + fTrans); }
00171 return SurfPoint;
00172 }
00173
00174 inline
00175 G4double G4TwistTubsSide::GetBoundaryMin(G4double)
00176 {
00177 return fAxisMin[0] ;
00178 }
00179
00180 inline
00181 G4double G4TwistTubsSide::GetBoundaryMax(G4double)
00182 {
00183 return fAxisMax[0] ;
00184 }
00185
00186 inline
00187 G4double G4TwistTubsSide::GetSurfaceArea()
00188 {
00189
00190 return ( fAxisMax[0] - fAxisMin[0] ) * ( fAxisMax[1] - fAxisMin[1] ) ;
00191 }
00192
00193 #endif