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 inline G4bool
00035 G4AuxiliaryNavServices::
00036 CheckPointOnSurface( const G4VSolid* sampleSolid,
00037 const G4ThreeVector& localPoint,
00038 const G4ThreeVector* globalDirection,
00039 const G4AffineTransform& sampleTransform,
00040 const G4bool locatedOnEdge)
00041 {
00042 G4ThreeVector localDirection, sampleNormal;
00043 G4bool enter = false;
00044
00045 EInside insideSolid = sampleSolid->Inside(localPoint);
00046 if ( insideSolid!=kOutside )
00047 {
00048 G4bool checkDirection= locatedOnEdge && (globalDirection!=0);
00049 if( (insideSolid==kSurface) && checkDirection)
00050 {
00051
00052
00053 localDirection= sampleTransform.TransformAxis(*globalDirection);
00054
00055
00056
00057 sampleNormal = sampleSolid->SurfaceNormal(localPoint);
00058 if ( sampleNormal.dot(localDirection) <= 0 )
00059 {
00060 if( sampleNormal.dot(localDirection) == 0 )
00061 {
00062
00063
00064
00065
00066
00067
00068 G4double distanceToIn =
00069 sampleSolid->DistanceToIn( localPoint, localDirection );
00070 if( distanceToIn != kInfinity )
00071 {
00072 enter = true;
00073 }
00074 }
00075 else
00076 {
00077 enter = true;
00078 }
00079 }
00080 }
00081 else
00082 {
00083 enter = true;
00084 }
00085 }
00086 return enter;
00087 }
00088
00089
00090
00091 inline G4bool
00092 G4AuxiliaryNavServices::
00093 CheckPointExiting( const G4VSolid* sampleSolid,
00094 const G4ThreeVector& localPoint,
00095 const G4ThreeVector* globalDirection,
00096 const G4AffineTransform& sampleTransform )
00097 {
00098 if( !globalDirection ) { return false; }
00099
00100 G4ThreeVector localDirection, sampleNormal;
00101 G4bool exiting = false;
00102
00103 EInside insideSolid = sampleSolid->Inside(localPoint);
00104 if( insideSolid==kSurface )
00105 {
00106 localDirection= sampleTransform.TransformAxis(*globalDirection);
00107
00108
00109
00110 sampleNormal = sampleSolid->SurfaceNormal(localPoint);
00111 if ( sampleNormal.dot(localDirection) >= 0 )
00112 {
00113 if( sampleNormal.dot(localDirection) == 0 )
00114 {
00115
00116
00117
00118
00119
00120
00121 G4double distanceToIn =
00122 sampleSolid->DistanceToIn( localPoint, localDirection );
00123 if( distanceToIn != kInfinity )
00124 {
00125 exiting = true;
00126 }
00127 }
00128 else
00129 {
00130 exiting = true;
00131 }
00132 }
00133 }
00134 return exiting;
00135 }