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
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef G4PolyconeSide_hh
00056 #define G4PolyconeSide_hh
00057
00058 #include "G4VCSGface.hh"
00059
00060 class G4IntersectingCone;
00061
00062 struct G4PolyconeSideRZ
00063 {
00064 G4double r, z;
00065 };
00066
00067 class G4PolyconeSide : public G4VCSGface
00068 {
00069 public:
00070
00071 G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
00072 const G4PolyconeSideRZ *tail,
00073 const G4PolyconeSideRZ *head,
00074 const G4PolyconeSideRZ *nextRZ,
00075 G4double phiStart, G4double deltaPhi,
00076 G4bool phiIsOpen, G4bool isAllBehind=false );
00077 virtual ~G4PolyconeSide();
00078
00079 G4PolyconeSide( const G4PolyconeSide &source );
00080 G4PolyconeSide& operator=( const G4PolyconeSide &source );
00081
00082 G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
00083 G4bool outgoing, G4double surfTolerance,
00084 G4double &distance, G4double &distFromSurface,
00085 G4ThreeVector &normal, G4bool &isAllBehind );
00086
00087 G4double Distance( const G4ThreeVector &p, G4bool outgoing );
00088
00089 EInside Inside( const G4ThreeVector &p, G4double tolerance,
00090 G4double *bestDistance );
00091
00092 G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
00093
00094 G4double Extent( const G4ThreeVector axis );
00095
00096 void CalculateExtent( const EAxis axis,
00097 const G4VoxelLimits &voxelLimit,
00098 const G4AffineTransform &tranform,
00099 G4SolidExtentList &extentList );
00100
00101 G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
00102
00103 G4double SurfaceArea();
00104 G4ThreeVector GetPointOnFace();
00105
00106 public:
00107
00108 G4PolyconeSide(__void__&);
00109
00110
00111
00112
00113 protected:
00114
00115 G4double DistanceAway( const G4ThreeVector &p, G4bool opposite,
00116 G4double &distOutside2, G4double *rzNorm=0 );
00117
00118 G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
00119 const G4ThreeVector &p,
00120 const G4ThreeVector &v, G4ThreeVector &normal );
00121
00122 void CopyStuff( const G4PolyconeSide &source );
00123
00124 static void FindLineIntersect( G4double x1, G4double y1,
00125 G4double tx1, G4double ty1,
00126 G4double x2, G4double y2,
00127 G4double tx2, G4double ty2,
00128 G4double &x, G4double &y );
00129
00130 G4double GetPhi( const G4ThreeVector& p );
00131
00132 protected:
00133
00134 G4double r[2], z[2];
00135 G4double startPhi,
00136 deltaPhi;
00137 G4bool phiIsOpen;
00138 G4bool allBehind;
00139
00140 G4IntersectingCone *cone;
00141
00142 G4double rNorm, zNorm;
00143 G4double rS, zS;
00144 G4double length;
00145 G4double prevRS,
00146 prevZS;
00147 G4double nextRS,
00148 nextZS;
00149
00150 G4double rNormEdge[2],
00151 zNormEdge[2];
00152
00153 G4int ncorners;
00154 G4ThreeVector *corners;
00155
00156 private:
00157
00158 std::pair<G4ThreeVector, G4double> fPhi;
00159 G4double kCarTolerance;
00160 G4double fSurfaceArea;
00161 };
00162
00163 #endif