Problem 1029

Summary: Possible bug in geometry/solids/specific/src/G4ExtrudedSolid.cc
Product: Geant4 Reporter: Guilherme Lima <lima>
Component: geometry/solidsAssignee: Ivana Hrivnacova <ivana>
Status: RESOLVED FIXED    
Severity: trivial CC: zmarshal
Priority: P5    
Version: 9.1   
Hardware: All   
OS: All   

Description Guilherme Lima 2008-10-29 19:04:41 CET
A piece of code looks pretty suspicious around line 543 of geometry/solid/specific/src/G4ExtrudedSolid.cc:

----------
    good = AddFacet( new G4QuadrangularFacet( GetVertex(fNz-1, 3), GetVertex(fNz-1, 2), 
                                              GetVertex(fNz-1, 1), GetVertex(1, 0),
                                              ABSOLUTE) );
-----------

I think that to be consistent, the first argument to GetVertex() should be always fNz-1, otherwise the vertices returned may belong to distinct, inconsistent polygons.

Therefore, my proposed patch is here:

----------
    good = AddFacet( new G4QuadrangularFacet( GetVertex(fNz-1, 3), GetVertex(fNz-1, 2), 
                                              GetVertex(fNz-1, 1), GetVertex(fHz-1, 0),
                                              ABSOLUTE) );
-----------

Thanks,
Guilherme
Comment 1 Guilherme Lima 2008-10-29 19:06:34 CET
A typo: obviously the patch should write fNz-1 rather than fHz.

Sorry for the confusion.
Guilherme
Comment 2 Gabriele Cosmo 2008-10-30 11:05:05 CET
Thanks for the report.
Problem now assigned to the author of G4ExtrudedSolid.
Comment 3 Ivana Hrivnacova 2008-10-30 12:52:19 CET
The proposed fix is correct; the bug was introduced when we moved from a solid
with 2 z-sides only to a general case.
Now corrected in CVS.