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 inline G4double G4VIntersectionLocator::GetDeltaIntersectionFor()
00036 {
00037 return fiDeltaIntersection;
00038 }
00039
00040 inline G4double G4VIntersectionLocator::GetEpsilonStepFor()
00041 {
00042 return fiEpsilonStep;
00043 }
00044
00045 inline G4Navigator* G4VIntersectionLocator::GetNavigatorFor()
00046 {
00047 return fiNavigator;
00048 }
00049
00050 inline G4ChordFinder* G4VIntersectionLocator::GetChordFinderFor()
00051 {
00052 return fiChordFinder;
00053 }
00054
00055 inline G4int G4VIntersectionLocator::GetVerboseFor()
00056 {
00057 return fVerboseLevel;
00058 }
00059
00060 inline G4bool G4VIntersectionLocator::GetAdjustementOfFoundIntersection()
00061 {
00062 return fUseNormalCorrection;
00063 }
00064
00065 inline void G4VIntersectionLocator::
00066 AddAdjustementOfFoundIntersection(G4bool UseCorrection )
00067 {
00068 fUseNormalCorrection=UseCorrection;
00069 }
00070
00071 inline void G4VIntersectionLocator::SetEpsilonStepFor( G4double EpsilonStep )
00072 {
00073 fiEpsilonStep=EpsilonStep;
00074 }
00075
00076 inline void G4VIntersectionLocator::
00077 SetDeltaIntersectionFor( G4double deltaIntersection )
00078 {
00079 fiDeltaIntersection=deltaIntersection;
00080 }
00081
00082 inline void G4VIntersectionLocator::SetNavigatorFor( G4Navigator *fNavigator )
00083 {
00084 fiNavigator=fNavigator;
00085 }
00086
00087 inline void G4VIntersectionLocator::SetChordFinderFor(G4ChordFinder *fCFinder )
00088 {
00089 fiChordFinder=fCFinder;
00090 }
00091
00092 inline void G4VIntersectionLocator::SetSafetyParametersFor(G4bool UseSafety )
00093 {
00094 fiUseSafety=UseSafety;
00095 }
00096
00097 inline void G4VIntersectionLocator::SetVerboseFor(G4int fVerbose)
00098 {
00099 fVerboseLevel=fVerbose;
00100 }
00101
00102 inline G4bool
00103 G4VIntersectionLocator::IntersectChord( const G4ThreeVector& StartPointA,
00104 const G4ThreeVector& EndPointB,
00105 G4double &NewSafety,
00106 G4double &PreviousSafety,
00107 G4ThreeVector &PreviousSftOrigin,
00108 G4double &LinearStepLength,
00109 G4ThreeVector &IntersectionPoint,
00110 G4bool *ptrCalledNavigator )
00111 {
00112 G4bool CalledNavigator = false;
00113
00114
00115
00116 G4ThreeVector ChordAB_Vector = EndPointB - StartPointA;
00117 G4double ChordAB_Length = ChordAB_Vector.mag();
00118 G4ThreeVector ChordAB_Dir = ChordAB_Vector.unit();
00119 G4bool intersects;
00120 G4ThreeVector OriginShift = StartPointA - PreviousSftOrigin ;
00121 G4double MagSqShift = OriginShift.mag2() ;
00122 G4double currentSafety;
00123
00124 if( MagSqShift >= sqr(PreviousSafety) )
00125 {
00126 currentSafety = 0.0 ;
00127 }
00128 else
00129 {
00130 currentSafety = PreviousSafety - std::sqrt(MagSqShift) ;
00131 }
00132
00133 if( fiUseSafety && (ChordAB_Length <= currentSafety) )
00134 {
00135
00136
00137 LinearStepLength = ChordAB_Length;
00138 intersects = false;
00139 NewSafety= currentSafety;
00140 CalledNavigator= false;
00141
00142 }
00143 else
00144 {
00145
00146
00147
00148
00149 LinearStepLength = GetNavigatorFor()->ComputeStep( StartPointA,
00150 ChordAB_Dir, ChordAB_Length, NewSafety );
00151 intersects = (LinearStepLength <= ChordAB_Length);
00152
00153
00154
00155
00156
00157
00158 LinearStepLength = std::min( LinearStepLength, ChordAB_Length);
00159 CalledNavigator = true;
00160
00161
00162
00163 PreviousSftOrigin = StartPointA;
00164 PreviousSafety = NewSafety;
00165
00166 if( intersects )
00167 {
00168
00169
00170 IntersectionPoint = StartPointA + LinearStepLength * ChordAB_Dir;
00171 }
00172 }
00173 if( ptrCalledNavigator )
00174 {
00175 *ptrCalledNavigator = CalledNavigator;
00176 }
00177
00178 return intersects;
00179 }