65 : ncorners(0), corners(0)
75 r[0] = tail->
r;
z[0] = tail->
z;
76 r[1] = head->
r;
z[1] = head->
z;
140 zNormEdge[0] /= lAdj;
152 zNormEdge[1] /= lAdj;
161 : startPhi(0.), deltaPhi(0.), phiIsOpen(false), allBehind(false),
162 cone(0), rNorm(0.), zNorm(0.), rS(0.), zS(0.), length(0.),
163 prevRS(0.), prevZS(0.), nextRS(0.), nextZS(0.), ncorners(0), corners(0),
164 kCarTolerance(0.), fSurfaceArea(0.)
198 if (
this == &source) {
return *
this; }
224 kCarTolerance = source.kCarTolerance;
225 fSurfaceArea = source.fSurfaceArea;
270 G4double normSign = outgoing ? +1 : -1;
278 if (nside == 0)
return false;
290 if (normSign*v.dot(normal) > 0)
307 if (normSign*v.dot(pNormal) > 0)
313 distFromSurface = -normSign*
DistanceAway( p,
false, distOutside2 );
314 if (distOutside2 < surfTolerance*surfTolerance)
316 if (distFromSurface > -surfTolerance)
328 distFromSurface = s1;
341 if (nside==1)
return false;
353 if (normSign*v.dot(normal) > 0)
358 if (normSign*v.dot(pNormal) > 0)
361 distFromSurface = -normSign*
DistanceAway( p,
false, distOutside2 );
362 if (distOutside2 < surfTolerance*surfTolerance)
364 if (distFromSurface > -surfTolerance)
372 distFromSurface = s2;
391 G4double normSign = outgoing ? -1 : +1;
398 if (distFrom > -0.5*kCarTolerance )
404 return std::sqrt( distFrom*distFrom + distOut2 );
406 return std::fabs(distFrom);
413 if (distFrom > -0.5*kCarTolerance)
417 return std::sqrt( distFrom*distFrom + distOut2 );
419 return std::fabs(distFrom);
436 G4double distFrom[2], distOut2[2], dist2[2];
439 distFrom[0] =
DistanceAway( p,
false, distOut2[0], edgeRZnorm );
440 distFrom[1] =
DistanceAway( p,
true, distOut2[1], edgeRZnorm+1 );
442 dist2[0] = distFrom[0]*distFrom[0] + distOut2[0];
443 dist2[1] = distFrom[1]*distFrom[1] + distOut2[1];
448 G4int i = std::fabs(dist2[0]) < std::fabs(dist2[1]) ? 0 : 1;
450 *bestDistance = std::sqrt( dist2[i] );
455 if ( (std::fabs(edgeRZnorm[i]) < tolerance)
456 && (distOut2[i] < tolerance*tolerance) )
458 else if (edgeRZnorm[i] < 0)
477 *bestDistance = std::sqrt( dFrom*dFrom + dOut2 );
524 if (bd > ad) ad = bd;
525 if (
cd > ad) ad =
cd;
526 if (dd > ad) ad = dd;
582 G4double rFudge = 1.0/std::cos(0.5*sigPhi);
712 cosPhi = std::cos(phi),
713 sinPhi = std::sin(phi);
716 v1( r1*cosPhi, r1*sinPhi, z1 ),
731 cosPhi = std::cos(phi),
732 sinPhi = std::sin(phi);
795 }
while( --numPhi > 0 );
809 a1(
r[1]*cosPhi,
r[1]*sinPhi,
z[1] ),
810 b0( r0*cosPhi, r0*sinPhi,
z[0] ),
811 b1( r1*cosPhi, r1*sinPhi,
z[1] );
919 if (opposite) rx = -rx;
924 G4double deltaR = rx -
r[0], deltaZ = zx -
z[0];
949 if (edgeRZnorm) *edgeRZnorm = answer;
969 if (d2 < d1) d1 = d2;
976 distOutside2 += dist*dist;
979 *edgeRZnorm = std::max(std::fabs(*edgeRZnorm),std::fabs(dist));
1003 if (!
cone->
HitOn( rx, hit.
z() ))
return false;
1007 G4double phiTolerant = 2.0*kCarTolerance/(rx+kCarTolerance);
1025 qb = qx - corners[3];
1028 if (normSign*qacb.
dot(v) < 0)
return false;
1030 else if (phi < phiTolerant)
1034 qb = qx - corners[0];
1037 if (normSign*qacb.
dot(v) < 0)
return false;
1071 G4double deter = tx1*ty2 - tx2*ty1;
1073 G4double s1 = ((x2-
x1)*ty2 - tx2*(y2-y1))/deter;
1074 G4double s2 = ((x2-
x1)*ty1 - tx1*(y2-y1))/deter;
1080 x = 0.5*( x1+s1*tx1 + x2+s2*tx2 );
1081 y = 0.5*( y1+s1*ty1 + y2+s2*ty2 );
1091 fSurfaceArea = (
r[0]+
r[1])* std::sqrt(
sqr(
r[0]-
r[1])+
sqr(
z[0]-
z[1]));
1094 return fSurfaceArea;
1104 dr=
r[1]-
r[0];dz=
z[1]-
z[0];
1125 zz = z[0]+(rr-r[0])*dz/dr;