50 #define G4MT_pcphix ((subInstanceManager.offset[instanceID]).fPhix)
51 #define G4MT_pcphiy ((subInstanceManager.offset[instanceID]).fPhiy)
52 #define G4MT_pcphiz ((subInstanceManager.offset[instanceID]).fPhiz)
53 #define G4MT_pcphik ((subInstanceManager.offset[instanceID]).fPhik)
84 r[0] = tail->
r;
z[0] = tail->
z;
85 r[1] = head->
r;
z[1] = head->
z;
151 zNormEdge[0] /= lAdj;
163 zNormEdge[1] /= lAdj;
170 : startPhi(0.), deltaPhi(0.),
171 cone(0), rNorm(0.), zNorm(0.), rS(0.), zS(0.),
length(0.),
172 prevRS(0.), prevZS(0.), nextRS(0.), nextZS(0.),
203 if (
this == &source) {
return *
this; }
271 G4double normSign = outgoing ? +1 : -1;
279 if (nside == 0)
return false;
291 if (normSign*v.dot(normal) > 0)
308 if (normSign*v.dot(pNormal) > 0)
314 distFromSurface = -normSign*
DistanceAway( p,
false, distOutside2 );
315 if (distOutside2 < surfTolerance*surfTolerance)
317 if (distFromSurface > -surfTolerance)
329 distFromSurface =
s1;
342 if (nside==1)
return false;
354 if (normSign*v.dot(normal) > 0)
359 if (normSign*v.dot(pNormal) > 0)
362 distFromSurface = -normSign*
DistanceAway( p,
false, distOutside2 );
363 if (distOutside2 < surfTolerance*surfTolerance)
365 if (distFromSurface > -surfTolerance)
373 distFromSurface = s2;
393 G4double normSign = outgoing ? -1 : +1;
406 return std::sqrt( distFrom*distFrom + distOut2 );
408 return std::fabs(distFrom);
419 return std::sqrt( distFrom*distFrom + distOut2 );
421 return std::fabs(distFrom);
437 dist2 = distFrom*distFrom + distOut2;
439 *bestDistance = std::sqrt( dist2);
443 if ( (std::fabs(edgeRZnorm) < tolerance)
444 && (distOut2< tolerance*tolerance) )
446 else if (edgeRZnorm < 0)
463 *bestDistance = std::sqrt( dFrom*dFrom + dOut2 );
509 if (bd > ad) ad = bd;
510 if (
cd > ad) ad =
cd;
511 if (dd > ad) ad = dd;
564 G4double rFudge = 1.0/std::cos(0.5*sigPhi);
694 cosPhi = std::cos(phi),
695 sinPhi = std::sin(phi);
698 v1( r1*cosPhi, r1*sinPhi, z1 ),
713 cosPhi = std::cos(phi),
714 sinPhi = std::sin(phi);
777 }
while( --numPhi > 0 );
791 a1(
r[1]*cosPhi,
r[1]*sinPhi,
z[1] ),
792 b0( r0*cosPhi, r0*sinPhi,
z[0] ),
793 b1( r1*cosPhi, r1*sinPhi,
z[1] );
900 if (opposite) rx = -rx;
915 if (edgeRZnorm !=
nullptr)
921 if (edgeRZnorm !=
nullptr)
931 if (edgeRZnorm !=
nullptr) *edgeRZnorm = answer;
953 if (d2 < d1) d1 =
d2;
960 distOutside2 += dist*dist;
961 if (edgeRZnorm !=
nullptr)
963 *edgeRZnorm =
std::max(std::fabs(*edgeRZnorm),std::fabs(dist));
989 if (rx < 0) part = -1;
1004 if (edgeRZnorm !=
nullptr)
1012 if (edgeRZnorm !=
nullptr)
1014 deltaR = rx -
r[1]*
part;
1022 if (edgeRZnorm !=
nullptr) *edgeRZnorm = answer;
1044 if (d2 < d1) d1 =
d2;
1051 distOutside2 += dist*dist;
1052 if (edgeRZnorm !=
nullptr)
1054 *edgeRZnorm =
std::max(std::fabs(*edgeRZnorm),std::fabs(dist));
1076 if (!
cone->
HitOn( rx, hit.
z() ))
return false;
1087 while( phi <
startPhi-phiTolerant )
1099 qb = qx - corners[3];
1102 if (normSign*qacb.
dot(v) < 0)
return false;
1104 else if (phi < phiTolerant)
1108 qb = qx - corners[0];
1111 if (normSign*qacb.
dot(v) < 0)
return false;
1143 G4double deter = tx1*ty2 - tx2*ty1;
1146 G4double s2 = ((x2-
x1)*ty1 - tx1*(y2-y1))/deter;
1152 x = 0.5*( x1+s1*tx1 + x2+s2*tx2 );
1153 y = 0.5*( y1+s1*ty1 + y2+s2*ty2 );
1174 dr=
r[1]-
r[0];dz=
z[1]-
z[0];
1195 zz = z[0]+(rr-r[0])*dz/dr;