Problem 1301 - GetPointOnSurface() does not return proper distributions for Boolean solids
Summary: GetPointOnSurface() does not return proper distributions for Boolean solids
Status: RESOLVED DUPLICATE of problem 1074
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/solids (show other problems)
Version: 9.5
Hardware: All All
: P5 major
Assignee: Gabriele Cosmo
URL:
Depends on:
Blocks:
 
Reported: 2012-04-03 21:55 CEST by Michael Kelsey
Modified: 2012-04-04 09:43 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Michael Kelsey 2012-04-03 21:55:48 CEST
In addition to report #1294, we find that G4BooleanSolid does not generate a proper distribution of surface points either:

  while(condition)
  {
    rand = G4UniformRand();
    if(rand > 0.5) { p = fPtrSolidA->GetPointOnSurface(); }
    else           { p = fPtrSolidB->GetPointOnSurface(); }
    if(Inside(p) == kSurface)  { break; }
  }

The "0.5" cut is not correct, since the two constituent solids may well have different surface areas (it doesn't take account of the details of overlap, either, but that could be a performance hit).
Comment 1 Gabriele Cosmo 2012-04-04 09:43:54 CEST
I repeat here what stated in #1074 ... GetPointOnSurface() is NOT meant to generate a uniform distribution of points on the surface, but allow the fastest possible way to generate them for overlaps checking and
debug purposes!  What suggested in reports #1074 and #1294 can be considered, but still they're introducing a penalty.
In many cases it is practically impossible to have a uniform distribution, or it would require too much CPU time. Boolean solids is one of these, as any possible solid can be part of it and especially when more than two Boolean operations are involved!
The current algorithm for Boolean solids is more than reasonable in respect to its specifications.
It should be also noticed that for some solids the current approach allows for the generation of more points close to edges or vertices, which is just good for the use which is made of it and for facilitating debugging on critical areas.

*** This problem has been marked as a duplicate of problem 1074 ***