File indexing completed on 2025-01-18 09:59:22
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 inline G4double G4VIntersectionLocator::GetDeltaIntersectionFor()
0032 {
0033 return fiDeltaIntersection;
0034 }
0035
0036 inline G4double G4VIntersectionLocator::GetEpsilonStepFor()
0037 {
0038 return fiEpsilonStep;
0039 }
0040
0041 inline G4Navigator* G4VIntersectionLocator::GetNavigatorFor()
0042 {
0043 return fiNavigator;
0044 }
0045
0046 inline G4ChordFinder* G4VIntersectionLocator::GetChordFinderFor()
0047 {
0048 return fiChordFinder;
0049 }
0050
0051 inline G4int G4VIntersectionLocator::GetVerboseFor()
0052 {
0053 return fVerboseLevel;
0054 }
0055
0056 inline G4bool G4VIntersectionLocator::GetAdjustementOfFoundIntersection()
0057 {
0058 return fUseNormalCorrection;
0059 }
0060
0061 inline void G4VIntersectionLocator::
0062 AddAdjustementOfFoundIntersection(G4bool UseCorrection )
0063 {
0064 fUseNormalCorrection = UseCorrection;
0065 }
0066
0067 inline void G4VIntersectionLocator::SetEpsilonStepFor( G4double EpsilonStep )
0068 {
0069 fiEpsilonStep = EpsilonStep;
0070 }
0071
0072 inline void G4VIntersectionLocator::
0073 SetDeltaIntersectionFor( G4double deltaIntersection )
0074 {
0075 fiDeltaIntersection = deltaIntersection;
0076 }
0077
0078 inline void G4VIntersectionLocator::SetNavigatorFor( G4Navigator* fNavigator )
0079 {
0080 fiNavigator = fNavigator;
0081 }
0082
0083 inline void G4VIntersectionLocator::SetChordFinderFor(G4ChordFinder* fCFinder )
0084 {
0085 fiChordFinder = fCFinder;
0086 }
0087
0088 inline void G4VIntersectionLocator::SetSafetyParametersFor(G4bool UseSafety )
0089 {
0090 fiUseSafety = UseSafety;
0091 }
0092
0093 inline void G4VIntersectionLocator::SetVerboseFor(G4int fVerbose)
0094 {
0095 fVerboseLevel = fVerbose;
0096 }
0097
0098 inline G4bool
0099 G4VIntersectionLocator::IntersectChord( const G4ThreeVector& StartPointA,
0100 const G4ThreeVector& EndPointB,
0101 G4double& NewSafety,
0102 G4double& PreviousSafety,
0103 G4ThreeVector& PreviousSftOrigin,
0104 G4double& LinearStepLength,
0105 G4ThreeVector& IntersectionPoint,
0106 G4bool* ptrCalledNavigator )
0107 {
0108 G4bool CalledNavigator = false;
0109
0110
0111
0112 G4ThreeVector ChordAB_Vector = EndPointB - StartPointA;
0113 G4double ChordAB_Length = ChordAB_Vector.mag();
0114 G4ThreeVector ChordAB_Dir = ChordAB_Vector.unit();
0115 G4bool intersects;
0116 G4ThreeVector OriginShift = StartPointA - PreviousSftOrigin ;
0117 G4double MagSqShift = OriginShift.mag2() ;
0118 G4double currentSafety;
0119
0120 if( MagSqShift >= sqr(PreviousSafety) )
0121 {
0122 currentSafety = 0.0 ;
0123 }
0124 else
0125 {
0126 currentSafety = PreviousSafety - std::sqrt(MagSqShift) ;
0127 }
0128
0129 if( fiUseSafety && (ChordAB_Length <= currentSafety) )
0130 {
0131
0132
0133 LinearStepLength = ChordAB_Length;
0134 intersects = false;
0135 NewSafety = currentSafety;
0136 CalledNavigator = false;
0137 }
0138 else
0139 {
0140
0141
0142 LinearStepLength = GetNavigatorFor()->ComputeStep( StartPointA,
0143 ChordAB_Dir, ChordAB_Length, NewSafety );
0144 intersects = (LinearStepLength <= ChordAB_Length);
0145
0146
0147
0148 LinearStepLength = std::min( LinearStepLength, ChordAB_Length);
0149 CalledNavigator = true;
0150
0151
0152
0153 PreviousSftOrigin = StartPointA;
0154 PreviousSafety = NewSafety;
0155
0156 if( intersects )
0157 {
0158
0159
0160 IntersectionPoint = StartPointA + LinearStepLength * ChordAB_Dir;
0161 }
0162 }
0163 if( ptrCalledNavigator != nullptr )
0164 {
0165 *ptrCalledNavigator = CalledNavigator;
0166 }
0167
0168 return intersects;
0169 }