File indexing completed on 2026-07-19 08:16:28
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 G4bool
0032 G4AuxiliaryNavServices::
0033 CheckPointOnSurface( const G4VSolid* sampleSolid,
0034 const G4ThreeVector& localPoint,
0035 const G4ThreeVector* globalDirection,
0036 const G4AffineTransform& sampleTransform,
0037 const G4bool locatedOnEdge)
0038 {
0039 G4ThreeVector localDirection, sampleNormal;
0040 G4bool enter = false;
0041
0042 EInside insideSolid = sampleSolid->Inside(localPoint);
0043 if ( insideSolid!=kOutside )
0044 {
0045 G4bool checkDirection = locatedOnEdge && (globalDirection!=nullptr);
0046 if( (insideSolid==kSurface) && checkDirection)
0047 {
0048
0049
0050 localDirection = sampleTransform.TransformAxis(*globalDirection);
0051
0052
0053
0054 sampleNormal = sampleSolid->SurfaceNormal(localPoint);
0055
0056 G4double dotProd = sampleNormal.dot(localDirection);
0057
0058 #ifdef G4DEBUG_AUX_NAVIGATION
0059 G4cout << " dir.norm= " << dotProd
0060 << " localDirection= " << localDirection
0061 << " sampleNormal= " << sampleNormal;
0062 if( dotProd == 0.0 )
0063 {
0064 G4cout << " distanceToIn = "
0065 << sampleSolid->DistanceToIn( localPoint, localDirection );
0066 }
0067 #endif
0068
0069 if ( dotProd <= 0.0 )
0070 {
0071 if( dotProd == 0.0 )
0072 {
0073
0074
0075
0076
0077
0078
0079 G4double distanceToIn =
0080 sampleSolid->DistanceToIn( localPoint, localDirection );
0081 if( distanceToIn != kInfinity )
0082 {
0083 enter = true;
0084 }
0085 }
0086 else
0087 {
0088 enter = true;
0089 }
0090 }
0091 }
0092 else
0093 {
0094 enter = true;
0095 }
0096 }
0097 #ifdef G4DEBUG_AUX_NAVIGATION
0098 G4cout << " enter = " << (enter ? "true" : "false" ) << G4endl;
0099 #endif
0100
0101 return enter;
0102 }
0103
0104
0105
0106 inline G4bool
0107 G4AuxiliaryNavServices::
0108 CheckPointExiting( const G4VSolid* sampleSolid,
0109 const G4ThreeVector& localPoint,
0110 const G4ThreeVector* globalDirection,
0111 const G4AffineTransform& sampleTransform )
0112 {
0113 if( globalDirection == nullptr ) { return false; }
0114
0115 G4ThreeVector localDirection, sampleNormal;
0116 G4bool exiting = false;
0117
0118 EInside insideSolid = sampleSolid->Inside(localPoint);
0119 if( insideSolid==kSurface )
0120 {
0121 localDirection = sampleTransform.TransformAxis(*globalDirection);
0122
0123
0124
0125 sampleNormal = sampleSolid->SurfaceNormal(localPoint);
0126 if ( sampleNormal.dot(localDirection) >= 0 )
0127 {
0128 if( sampleNormal.dot(localDirection) == 0 )
0129 {
0130
0131
0132
0133
0134
0135
0136 G4double distanceToIn =
0137 sampleSolid->DistanceToIn( localPoint, localDirection );
0138 if( distanceToIn != kInfinity )
0139 {
0140 exiting = true;
0141 }
0142 }
0143 else
0144 {
0145 exiting = true;
0146 }
0147 }
0148 }
0149 return exiting;
0150 }