Problem 931

Summary: G4TessellatedSolid::Inside reports erroneous results
Product: Geant4 Reporter: rickard.holmberg
Component: geometry/solidsAssignee: flei
Status: RESOLVED FIXED    
Severity: normal CC: Gabriele.Cosmo
Priority: P2    
Version: other   
Hardware: PC   
OS: Linux   
URL: http://avkrok.net/~rickard/geant4/

Description rickard.holmberg 2007-03-02 09:41:33 CET
I am having some problems when trying to use the G4TessellatedSolid. It
seems that some points supposedly inside of the defined volume are
considered to lie outside by G4TessellatedSolid::Inside(), as reported
by running with geometry/navigator/check_mode 1.

The error that I get is

*** G4Exception : FarOutsideCurrentVolume
      issued by : G4NormalNavigation::ComputeStep()
Point is far outside Current Volume !
*** Fatal Exception *** core dump ***

A larger snippet of the output is available at
http://avkrok.net/~rickard/geant4/log , together with the gdml files
used at http://avkrok.net/~rickard/geant4/geometry.gdml and
http://avkrok.net/~rickard/geant4/testblock.gdml .

I have tried to verify that all of my triangles are correctly oriented,
by checking that each edge is used twice (once in each direction) and
looking at one triangle to verify that it is correctly oriented.

Looking at G4TessellatedSolid::Inside(), I think that at least part of
the problem lies in the algorithm chosen for deciding what lies inside
of the volume. As far as I can see, that method looks at the faces
closest to the point (with a tolerance of kCarTolerance/2), plus one
face further away (due to the itcut++ on line 357 in
source/geometry/solids/specific/src/G4TessellatedSolid.cc), and if the
point lies outside of any of the planes of the faces, the point is
considered to lie outside of the volume. To the best of my
understanding, that could not work for concave volumes with internal
acute angles. A draft of an alternative algorithm is available from the URL
attached, together with some sketches of my debugging of this problem so far.
Comment 1 rickard.holmberg 2007-03-05 16:55:59 CET
I have a "works-for-me" fix for this problem now. Available from the "additional
informations" URL or directly as
http://avkrok.net/~rickard/geant4/current-tessellation.diff
If someone could take a look at that patch and comment/verify/correct it I would
be very grateful.
Comment 2 Gabriele Cosmo 2007-10-10 14:43:17 CEST
The problem is now fixed in tag "geom-specific-V09-00-06" and will be included in
the next public release. Thanks for the useful feedback and proposed solution.