454 G4bool ifWholeCircle = (std::abs(dphi-wholeCircle) <
perMillion) ?
true :
false;
455 G4double delPhi = ifWholeCircle ? wholeCircle : dphi;
456 G4int nSphi = (nstep > 0) ?
458 if (nSphi == 0) nSphi = 1;
459 G4int nVphi = ifWholeCircle ? nSphi : nSphi+1;
460 G4bool ifClosed = np1 > 0 ?
false :
true;
464 G4int absNp1 = std::abs(np1);
465 G4int absNp2 = std::abs(np2);
467 G4int i1end = absNp1-1;
468 G4int i2beg = absNp1;
469 G4int i2end = absNp1+absNp2-1;
472 for(i=i1beg; i<=i2end; i++) {
477 for (i=i1beg; i<=i1end; i++) {
478 j += (r[i] == 0.) ? 1 : nVphi;
484 if (r[i2beg] != r[i1beg] ||
z[i2beg] !=
z[i1beg]) {
485 j += (r[i2beg] == 0.) ? 1 : nVphi;
489 for(i=i2beg+1; i<i2end; i++) {
490 j += (r[i] == 0.) ? 1 : nVphi;
493 if (r[i2end] != r[i1end] ||
z[i2end] !=
z[i1end]) {
494 if (absNp2 > 1) j += (r[i2end] == 0.) ? 1 : nVphi;
500 k = ifClosed ? absNp1*nSphi : (absNp1-1)*nSphi;
503 for(i=i2beg; i<i2end; i++) {
504 if (r[i] > 0. || r[i+1] > 0.) k += nSphi;
508 if (r[i2end] > 0. || r[i2beg] > 0.) k += nSphi;
513 if (ifSide1 && (r[i1beg] > 0. || r[i2beg] > 0.)) k += nSphi;
514 if (ifSide2 && (r[i1end] > 0. || r[i2end] > 0.)) k += nSphi;
517 if (!ifWholeCircle) {
518 k += ifClosed ? 2*absNp1 : 2*(absNp1-1);
528 kk =
new G4int[absNp1+absNp2];
531 for(i=i1beg; i<=i1end; i++) {
534 {
pV[k++] =
G4Point3D(0, 0,
z[i]); }
else { k += nVphi; }
541 {
pV[k++] =
G4Point3D(0, 0,
z[i]); }
else { k += nVphi; }
546 for(i=i2beg+1; i<i2end; i++) {
549 {
pV[k++] =
G4Point3D(0, 0,
z[i]); }
else { k += nVphi; }
564 for(j=0; j<nVphi; j++) {
565 cosPhi = std::cos(phi+j*delPhi/nSphi);
566 sinPhi = std::sin(phi+j*delPhi/nSphi);
567 for(i=i1beg; i<=i2end; i++) {
578 v2 = ifClosed ? nodeVis : 1;
579 for(i=i1beg; i<i1end; i++) {
581 if (!ifClosed && i == i1end-1) {
584 v2 = (r[i] == r[i+1] && r[i+1] == r[i+2]) ? -1 : nodeVis;
586 RotateEdge(kk[i], kk[i+1], r[i], r[i+1], v1, v2,
587 edgeVis, ifWholeCircle, nSphi, k);
590 RotateEdge(kk[i1end], kk[i1beg], r[i1end],r[i1beg], nodeVis, nodeVis,
591 edgeVis, ifWholeCircle, nSphi, k);
597 v2 = ifClosed ? nodeVis : 1;
598 for(i=i2beg; i<i2end; i++) {
600 if (!ifClosed && i==i2end-1) {
603 v2 = (r[i] == r[i+1] && r[i+1] == r[i+2]) ? -1 : nodeVis;
605 RotateEdge(kk[i+1], kk[i], r[i+1], r[i], v2, v1,
606 edgeVis, ifWholeCircle, nSphi, k);
609 RotateEdge(kk[i2beg], kk[i2end], r[i2beg], r[i2end], nodeVis, nodeVis,
610 edgeVis, ifWholeCircle, nSphi, k);
618 RotateEdge(kk[i2beg], kk[i1beg], r[i2beg], r[i1beg], 1, 1,
619 -1, ifWholeCircle, nSphi, k);
622 RotateEdge(kk[i1end], kk[i2end], r[i1end], r[i2end], 1, 1,
623 -1, ifWholeCircle, nSphi, k);
629 if (!ifWholeCircle) {
634 for (i=i1beg; i<=i1end; i++) {
636 ii[3] = (i == i1end) ? i1beg : i+1;
637 ii[1] = (absNp2 == 1) ? i2beg : ii[0]+absNp1;
638 ii[2] = (absNp2 == 1) ? i2beg : ii[3]+absNp1;
646 for (i=i1beg; i<i1end; i++) {
649 ii[1] = (absNp2 == 1) ? i2beg : ii[0]+absNp1;
650 ii[2] = (absNp2 == 1) ? i2beg : ii[3]+absNp1;
651 vv[0] = (i == i1beg) ? 1 : -1;
653 vv[2] = (i == i1end-1) ? 1 : -1;
664 <<
"Polyhedron::RotateAroundZ: number of generated faces ("
665 << k-1 <<
") is not equal to the number of allocated faces ("
static constexpr double perMillion
void AllocateMemory(G4int Nvert, G4int Nface)
const G4double spatialTolerance
void SetSideFacets(G4int ii[4], G4int vv[4], G4int *kk, G4double *r, G4double dphi, G4int ns, G4int &kface)
HepGeom::Point3D< G4double > G4Point3D
static constexpr double twopi
static G4int GetNumberOfRotationSteps()
void RotateEdge(G4int k1, G4int k2, G4double r1, G4double r2, G4int v1, G4int v2, G4int vEdge, G4bool ifWholeCircle, G4int ns, G4int &kface)