Problem 2519

Summary: G4GenericPolycone is incorrectly subtracted in G4SubtractionSolid
Product: Geant4 Reporter: Egor Frolov <E.A.Frolov>
Component: geometry/solidsAssignee: Evgueni.Tcherniaev
Status: CLOSED INVALID    
Severity: normal    
Priority: P4    
Version: 11.0   
Hardware: All   
OS: All   
Attachments: File with bugged geometry
Minimal code reproducing the problem
G4GenericPolycone
G4Polycone

Description Egor Frolov 2022-12-02 11:03:44 CET
Created attachment 792 [details]
File with bugged geometry

In my geometry I need a plate with biconical hole. For this I initially created G4Box and G4GenericPolycone solids (specific values are not important):
  G4Box* solidPlateTMP = new G4Box("solidPlateTMP", 5, 5, 2);
  double Zs[] = { -2.1, 0, 2.1};
  double Rs[] = {2, 1, 2};
  G4GenericPolycone* solidHole = new G4GenericPolycone("solidHole", 177.*deg, 273.*deg, 3, Rs, Zs);
And then create the solid I need:
  G4SubtractionSolid* solidPlate = new G4SubtractionSolid("solidPlate", solidPlateTMP, solidHole, 0, G4ThreeVector(5, 5, 0)); // hole center axis is at the plate's corner.
Comment 1 Egor Frolov 2022-12-02 11:12:54 CET
Created attachment 793 [details]
Minimal code reproducing the problem

(Sorry, accidentally sent unfinished bug report)

As said earlier, G4GenericPolycone resulted in incorrect geometry shown in the attachment#1 [details].
Using G4Polycone with the same parameters instead, however, gives expected result. In the attachment#2 [details] is the minimal code which reproduces the problem. After compilation running ./Geant4_bug produces .wrl geometry file with the bug. If program is run with -f option it will produce .wrl file with correct geometry.
Comment 2 Evgueni.Tcherniaev 2022-12-02 16:39:59 CET
Created attachment 794 [details]
G4GenericPolycone
Comment 3 Evgueni.Tcherniaev 2022-12-02 16:41:44 CET
Created attachment 795 [details]
G4Polycone
Comment 4 Evgueni.Tcherniaev 2022-12-02 16:48:48 CET
Geant4 worked correctly, the reason of the issue is that the solids constructed with G4GenericPolycone and G4Polycone have different shape, please see the images in the attachments.