265{
266 G4double dist = 0.0, dist2 = 0.0, disTmp = 0.0;
267
268#ifdef G4BOOLDEBUG
270 {
271 G4cout <<
"WARNING - Invalid call in "
272 <<
"G4SubtractionSolid::DistanceToIn(p,v)" <<
G4endl
273 <<
" Point p is inside !" <<
G4endl;
276 G4cerr <<
"WARNING - Invalid call in "
277 <<
"G4SubtractionSolid::DistanceToIn(p,v)" <<
G4endl
278 <<
" Point p is inside !" <<
G4endl;
281 }
282#endif
283
284
286 {
288
290 {
292 do
293 {
295
296 if(disTmp == kInfinity)
297 {
298 return kInfinity ;
299 }
300 dist += disTmp ;
301
303 {
305 dist2 = dist+disTmp;
306 if (dist == dist2) { return dist; }
307 dist = dist2 ;
308 ++count1;
309 if( count1 > 1000 )
310 {
313 {
315 ->GetConstituentMovedSolid()->GetName();
316 }
317 std::ostringstream message;
318 message << "Illegal condition caused by solids: "
320 message.precision(16);
321 message << "Looping detected in point " << p+dist*v
322 << ", from original point " << p
323 <<
" and direction " << v <<
G4endl
324 << "Computed candidate distance: " << dist << "*mm. ";
325 message.precision(6);
327 G4Exception(
"G4SubtractionSolid::DistanceToIn(p,v)",
329 "Returning candidate distance.");
330 return dist;
331 }
332 }
333 }
335 }
336 }
337 else
338 {
340
341 if( dist == kInfinity )
342 {
343 return kInfinity ;
344 }
345 else
346 {
349 {
351 dist += disTmp ;
352
354 {
356
357 if(disTmp == kInfinity)
358 {
359 return kInfinity ;
360 }
361 dist2 = dist+disTmp;
362 if (dist == dist2) { return dist; }
363 dist = dist2 ;
364 ++count2;
365 if( count2 > 1000 )
366 {
369 {
371 ->GetConstituentMovedSolid()->GetName();
372 }
373 std::ostringstream message;
374 message << "Illegal condition caused by solids: "
376 message.precision(16);
377 message << "Looping detected in point " << p+dist*v
378 << ", from original point " << p
379 <<
" and direction " << v <<
G4endl
380 << "Computed candidate distance: " << dist << "*mm. ";
381 message.precision(6);
383 G4Exception(
"G4SubtractionSolid::DistanceToIn(p,v)",
385 "Returning candidate distance.");
386 return dist;
387 }
388 }
389 }
390 }
391 }
392
393 return dist ;
394}
virtual G4GeometryType GetEntityType() const =0