45 type1 = (std::abs(z[1]-z[0]) > std::abs(r[1]-r[0]));
49 B = (r[1] - r[0]) / (z[1] - z[0]);
50 A = (r[0]*z[1] - r[1]*z[0]) / (z[1] -z[0]);
54 B = (z[1] - z[0]) / (r[1] - r[0]);
55 A = (z[0]*r[1] - z[1]*r[0]) / (r[1] - r[0]);
60 rLo = std::min(r[0], r[1]) - halfCarTolerance;
61 rHi = std::max(r[0], r[1]) + halfCarTolerance;
62 zLo = std::min(z[0], z[1]) - halfCarTolerance;
63 zHi = std::max(z[0], z[1]) + halfCarTolerance;
70 : zLo(0.), zHi(0.), rLo(0.), rHi(0.),
A(0.),
B(0.)
94 if (z < zLo || z >
zHi)
return false;
98 if (r < rLo || r >
rHi)
return false;
209 G4double radical = (br*br - 4*ar*cr) + ((std::max(arcz,azcr) - 2*bz*br) + std::min(arcz,azcr));
216 if (radical < -
EPS*std::fabs(b)) {
return 0; }
218 if (radical <
EPS*std::fabs(b))
223 if (std::fabs(a) > 1/kInfinity)
225 if(
B==0.) {
return 0; }
226 if ( std::fabs(x0*ty - y0*tx) < std::fabs(
EPS/
B) )
236 radical = std::sqrt(radical);
241 G4double sa, sb, q = -0.5*( b + (b < 0 ? -radical : +radical) );
244 if (sa < sb) { *s1 = sa; *s2 = sb; }
else { *s1 = sb; *s2 = sa; }
245 if (
A +
B*(z0+(*s1)*tz) < 0) {
return 0; }
248 else if (a < -1/kInfinity)
250 G4double sa, sb, q = -0.5*( b + (b < 0 ? -radical : +radical) );
253 *s1 = (
B*tz > 0)^(sa > sb) ? sb : sa;
256 else if (std::fabs(b) < 1/kInfinity)
263 if (
A +
B*(z0+(*s1)*tz) < 0) {
return 0; }
304 if (std::fabs(tz) < 1/kInfinity) {
return 0; }
331 G4double radical = (br*br - 4*ar*cr) + ((std::max(arcz,azcr) - 2*bz*br) + std::min(arcz,azcr));
338 if (radical < -
EPS*std::fabs(b)) {
return 0; }
340 if (radical <
EPS*std::fabs(b))
345 if (std::fabs(a) > 1/kInfinity)
347 if ( std::fabs(x0*ty - y0*tx) < std::fabs(
EPS/
B) )
357 radical = std::sqrt(radical);
360 if (a < -1/kInfinity)
362 G4double sa, sb, q = -0.5*( b + (b < 0 ? -radical : +radical) );
365 if (sa < sb) { *s1 = sa; *s2 = sb; }
else { *s1 = sb; *s2 = sa; }
366 if ((z0 + (*s1)*tz -
A)/
B < 0) {
return 0; }
369 else if (a > 1/kInfinity)
371 G4double sa, sb, q = -0.5*( b + (b < 0 ? -radical : +radical) );
374 *s1 = (tz*
B > 0)^(sa > sb) ? sb : sa;
377 else if (std::fabs(b) < 1/kInfinity)
384 if ((z0 + (*s1)*tz -
A)/
B < 0) {
return 0; }
G4double B(G4double temperature)
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)