49 static const G4double halfCarTolerance
55 type1 = (std::fabs(z[1]-z[0]) > std::fabs(r[1]-r[0]));
59 B = (r[1]-r[0])/(z[1]-z[0]);
60 A = 0.5*( r[1]+r[0] -
B*(z[1]+z[0]) );
64 B = (z[1]-z[0])/(r[1]-r[0]);
65 A = 0.5*( z[1]+z[0] -
B*(r[1]+r[0]) );
72 rLo = r[0]-halfCarTolerance;
rHi = r[1]+halfCarTolerance;
76 rLo = r[1]-halfCarTolerance;
rHi = r[0]+halfCarTolerance;
81 zLo = z[0]-halfCarTolerance;
zHi = z[1]+halfCarTolerance;
85 zLo = z[1]-halfCarTolerance;
zHi = z[0]+halfCarTolerance;
95 : zLo(0.), zHi(0.), rLo(0.), rHi(0.), type1(false), A(0.), B(0.)
123 if (z < zLo || z >
zHi)
return false;
127 if (r < rLo || r >
rHi)
return false;
227 if (radical < -1E-6*std::fabs(b)) {
return 0; }
229 if (radical < 1E-6*std::fabs(b))
234 if (std::fabs(a) > 1/kInfinity)
236 if(
B==0.) {
return 0; }
237 if ( std::fabs(x0*ty - y0*tx) < std::fabs(1E-6/
B) )
247 radical = std::sqrt(radical);
252 G4double sa, sb, q = -0.5*( b + (b < 0 ? -radical : +radical) );
255 if (sa < sb) { *s1 = sa; *s2 = sb; }
else { *s1 = sb; *s2 = sa; }
256 if (
A +
B*(z0+(*s1)*tz) < 0) {
return 0; }
259 else if (a < -1/kInfinity)
261 G4double sa, sb, q = -0.5*( b + (b < 0 ? -radical : +radical) );
264 *s1 = (
B*tz > 0)^(sa > sb) ? sb : sa;
267 else if (std::fabs(b) < 1/kInfinity)
274 if (
A +
B*(z0+(*s1)*tz) < 0) {
return 0; }
316 if (std::fabs(tz) < 1/kInfinity) {
return 0; }
324 G4double a = tz*tz - B2*(tx*tx + ty*ty);
325 G4double b = 2*( (z0-
A)*tz - B2*(x0*tx + y0*ty) );
330 if (radical < -1E-6*std::fabs(b)) {
return 0; }
332 if (radical < 1E-6*std::fabs(b))
337 if (std::fabs(a) > 1/kInfinity)
339 if ( std::fabs(x0*ty - y0*tx) < std::fabs(1E-6/
B) )
349 radical = std::sqrt(radical);
352 if (a < -1/kInfinity)
354 G4double sa, sb, q = -0.5*( b + (b < 0 ? -radical : +radical) );
357 if (sa < sb) { *s1 = sa; *s2 = sb; }
else { *s1 = sb; *s2 = sa; }
358 if ((z0 + (*s1)*tz -
A)/
B < 0) {
return 0; }
361 else if (a > 1/kInfinity)
363 G4double sa, sb, q = -0.5*( b + (b < 0 ? -radical : +radical) );
366 *s1 = (tz*
B > 0)^(sa > sb) ? sb : sa;
369 else if (std::fabs(b) < 1/kInfinity)
376 if ((z0 + (*s1)*tz -
A)/
B < 0) {
return 0; }
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4bool HitOn(const G4double r, const G4double z)
virtual ~G4IntersectingCone()
G4int LineHitsCone(const G4ThreeVector &p, const G4ThreeVector &v, G4double *s1, G4double *s2)
G4int LineHitsCone1(const G4ThreeVector &p, const G4ThreeVector &v, G4double *s1, G4double *s2)
G4IntersectingCone(const G4double r[2], const G4double z[2])
G4int LineHitsCone2(const G4ThreeVector &p, const G4ThreeVector &v, G4double *s1, G4double *s2)