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