Rendering issues with flattering filter

I think there are problems with the G4GenericPolycone function.

When trying to make a geometric volume with many points – an error occurs:
Input data:

float inch = 2.54 * cm;
constexpr auto nmbRZ = 5;

    G4double r[] = {1.3650 * inch, 1.2720 * inch, 0.9420 * inch, 0.6910 * inch, 0.0930 * inch};

    G4double z[] = {0. * inch, 0.090 * inch, 0.380 * inch, 0.550 * inch, 1.100 * inch};

Error:

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : GeomSolids0002
      issued by : G4GenericPolycone::Create()
Illegal input parameters - FF
        R/Z segments cross !
*** Fatal Error In Argument *** core dump ***
 **** Track information is not available at this moment
 **** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

Although this error should not be. Because r/z cannot intersect.

G4GenericPolycone is a solid constructed by rotation of a RZ-polygon around Z-axis. The RZ-polygon is defined by a sequence of points. To close the polygon, the last point in the sequence is connected with the first one. In your case, the edge between the last point and the first point intersects some other edges.

PS. Taking into account that Z is always increasing, I would recommend you to use G4Polycone instead of G4GenericPolycone, it also has a constructor from RZ-polygone