Problem 158

Summary: Boolean Processing Errors
Product: Geant4 Reporter: marc.kippen
Component: visualizationAssignee: Satoshi Tanaka <stanaka>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.0   
Hardware: All   
OS: All   

Description marc.kippen 2000-09-28 17:34:46 CEST
Boolean solids are not visualised properly.  For example, consider a simple box
with a cylindrical hole (note that the height of both sub-solids is the same = 1
cm):

  G4Box* Box1 =     new G4Box("Box1", 10*cm, 10*cm, 1*cm);
  G4Tubs* Tubs1 = new G4Tubs("Tubs1", 0*cm,   9*cm, 1*cm, 0*pi, 2.0*pi);
  G4VSolid* Bool1 = new G4SubtractionSolid("Bool1", Box1, Tubs1);

  G4LogicalVolume* lBool1 = new G4LogicalVolume(Bool1, Mymat,"Bool1", 0, 0, 0);
  G4VPhysicalVolume* pBool1
    = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), lBool1,
                        "Bool1", logicOrig, false, 0);

Visualization of this geometry with OpenGL consists only of the box (no hole) and
the following error message:

  BooleanProcessor::modifyReference : could not find the edge, iface=31,
     i1,i2=  9,10, iref=107
  BooleanProcessor: boolean operation failed

Visualization with the RayTracer is similarly incorrect, but no error message is
produced.

If the height of the Tube is changed to 0.5 cm (i.e., < the box height), the
following error messages are produced:

  BooleanProcessor::execute : unknown faces !!!
  BooleanProcessor: boolean operation failed

If the height of the Tube is changed to 1.5 cm (i.e., > the box height), the
visualization is correct and there are no error messages.
Comment 1 Gabriele Cosmo 2001-04-26 09:10:59 CEST
*** Bug 251 has been marked as a duplicate of this bug. ***
*** 'tanaka@i1nws1.fuis.fukui-u.ac.jp' will be responsible for bug 251. ***
Comment 2 John.Allison 2001-08-03 17:10:59 CEST
From Evgeni Chernaev, 23 May 2001:

As I understand reports #153 and #158 are two reports on the
same problem experienced when a cylinder is subtracted from a box.

There were three different cases:

a) the height of the cylinder is equal to the height the box
b) ... is less than the height the box
c) ... is bigger than the height the box

The Boolean processor reported problem in cases a) and b).

A short answer on current situation with the problems is:
 problem in case a) is fixed, but the result will look slightly
 different from what you expected;
 problem in case b) still exists;

Now let me explain what the phrase "will look slightly different" means.
The Boolean processor always slightly shifts the solids to avoid
case of coincident surfaces. As a result in case a) the cylindrical hole
will be extracted only from one side of the box. The opposite
side of the box will remain unchanged.

From Evgeni Chernaev, 24 May 2001:

I've checked in a bug fix in BooleanProcessor.src. The fix
has been provided by Guy. Please, include the change in next tag.

From John Allison, 3 Aug 2001:

This fix was part of Geant4 release 3.2 (June 2001).