Problem 153 - Problems visualizing boolean solids
Summary: Problems visualizing boolean solids
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: visualization (show other problems)
Version: 2.0
Hardware: PC Linux
: P2 normal
Assignee: Satoshi Tanaka
URL:
Depends on:
Blocks:
 
Reported: 2000-09-07 17:06 CEST by marc.kippen
Modified: 2001-05-31 06:22 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description marc.kippen 2000-09-07 17:06:39 CEST
Program crashes with the following error messages when visualizing
geometry consisting of a boolean intersection of a boolean subtraction
of two CSG solids (box & tube).

While attempting to draw with OGLIX:
------------------------------------
BooleanProcessor: corrapted input polyhedron
BooleanProcessor: intersection with empty polyhedron
HepPolyhedron::GetNormal: irrelevant index 1
Segmentation fault


While performing ray tracing on same object:
--------------------------------------------
Invalid call in G4SubtractionSolid::SurfaceNormal(p),  point p is inside rather
than on surface

*** G4Exception: Aborting execution ***
Abort
Comment 1 Gabriele Cosmo 2000-11-13 10:56:59 CET
Problem re-opened. The fix on CSG has been introduced and will
be available in the next release. The problem in visualization
of Boolean solids is still under investigation...
Comment 2 John.Allison 2000-11-16 09:49:59 CET
From Evgeni Chernaev:

From first sight it looks like an error in the USER data.
Why I think so:

 - the Ray Tracer and the Boolean Processor are absolutely independed
   but both failed to render the data;

 - first message from the BooleanProcessor is:
     "BooleanProcessor: corrapted input polyhedron"

   it means that in the subtraction one of the polyhedra (or may be both)
   had wrong stucture. For this reason the subtraction and then
   the intersection both returned an empty polyhedron.

   (John, it seems that there is no protection from attempt to draw
   an empty polyherdron:
     HepPolyhedron::GetNormal: irrelevant index 1
     Segmentation fault
   )

That is all what I can say. Unfortunately there is no enough information
in the report. Absence of real data does not allow to reproduce the
problem and thus to say something certainly.
Comment 3 John.Allison 2000-11-16 09:52:59 CET
Fix for protection against empty G4Polyhedron is be submitted shortly.
Comment 4 Gabriele Cosmo 2001-05-23 01:35:59 CEST
Additional information from Marc Kippen:

The problem with boolean solids that I originally reported also causes
errors when tracking particles.  The geometry code segment given below
shows an example (cylinder clipped by two boxes).  I can provide the
full source code if needed.

  //------------------------------ (world volume)
  G4Box* solidOrig
    = new G4Box("Orig", 100*cm, 100*cm, 100*cm);
  G4LogicalVolume* logicOrig
    = new G4LogicalVolume(solidOrig, Vac, "Orig", 0, 0, 0);
  G4VPhysicalVolume* physiOrig
    = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicOrig,
                        "Orig", 0, false, 0);
  (*logicOrig).SetVisAttributes(G4VisAttributes::Invisible);

  //------------------------------ a detector tube
  G4RotationMatrix Rot1;
  G4Transform3D T3D;
  G4double off = 8.0*cm;

  G4Tubs* Tubs1 = new G4Tubs("Tubs1", 0.0*cm, 10.0*cm, 5.0*cm, 0.0*pi, 2.0*pi);
  G4Box* Box1   = new G4Box("Box1", 20.0*cm, 5.0*cm, 10.0*cm);
  G4Box* Box2   = new G4Box("Box2", 5.0*cm, 20.0*cm, 10.0*cm);

  T3D = G4Transform3D(Rot1, G4ThreeVector(0.0, off, 0.0));
  G4VSolid* dBox1 = new G4DisplacedSolid("Box1", Box1, T3D);
  T3D = G4Transform3D(Rot1, G4ThreeVector(off, 0.0, 0.0));
  G4VSolid* dBox2 = new G4DisplacedSolid("Box2", Box2, T3D);

  G4VSolid* Bool1 = new G4SubtractionSolid("Bool1", Tubs1, dBox1);
  G4VSolid* Bool2 = new G4IntersectionSolid("Bool1", Bool1, dBox2);
  G4LogicalVolume* lBool2
    = new G4LogicalVolume(Bool2, matSi,"Bool2", 0, 0, 0);
  G4VPhysicalVolume* pBool2
    = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), lBool2,
                        "Bool2", logicOrig, false, 0);
  //------------------------------------------------------------------

When this geometry is visualized using the commands

    /vis/open OGLIX
    /vis/drawVolume

the following error message is produced and nothing is drawn in the
graphics window.

    BooleanProcessor: corrapted input polyhedron

Furthermore, if one shoots particles in particular directions, the tracking
enters an infinate loop where the particle skips back and forth between two
different volumes.  Below is an example:

    /gun/particle geantino
    /gun/position 0 0 0 cm
    /gun/direction 0.731 0.629 -0.265
    /run/beamOn

### Run 0 start.

(printed within UserSteppingAction)

      PosX     PosY      PosZ Vol   Material
     -----    -----     ----- ----  --------
        3      2.58     -1.09 Orig  Vacuum
     3.49         3     -1.26 Bool2 Si
     3.49         3     -1.26 Orig  Vacuum
     3.49         3     -1.26 Bool2 Si
     3.49         3     -1.26 Orig  Vacuum
     3.49         3     -1.26 Bool2 Si
     3.49         3     -1.26 Orig  Vacuum
     3.49         3     -1.26 Bool2 Si
     3.49         3     -1.26 Orig  Vacuum
     ...
     infinite
Comment 5 John.Allison 2001-05-25 09:07:59 CEST
We believe the current graphics reps handles Marc's geometry.

This only addresses the graphics side of his report.
The tracking problem might still be outstanding.
Comment 6 John.Allison 2001-05-31 06:22:59 CEST
We propose the following fixes (extracts from History files):

11th April 2001  John Allison  (greps-V03-01-00)
- Some code has been added to cover unforeseen earlier situation
  during preselection of faces without intersection (Evgeni).

May 30  2001  Vladimir Grichine    geom-solid-bool-V03-01-00
  - G4IntersectionSolid: fix in DistanceToIn(p,v) resolving bug observed
    in problem report #153.