89 G4double midPhi = phi + (start ? +0.5 : -0.5)*deltaPhi;
91 sinMid = std::sin(midPhi);
107 corn->
r = iterRZ.
GetA();
108 corn->
z = iterRZ.
GetB();
117 { corn->
prev = helper; }
122 { corn->
next = corn+1;}
127 }
while( ++corn, iterRZ.
Next() );
137 G4double rFact = std::cos(0.5*deltaPhi);
138 G4double rFactNormalize = 1.0/std::sqrt(1.0+rFact*rFact);
151 dz = here->z - prev->
z;
165 G4double zSignOther = start ? -1 : 1;
167 -zSignOther*std::cos(phiOther), 0 );
174 sideNorm *= rFactNormalize;
179 }
while( edge++, prev=here, ++here <
corners+numEdges );
217 G4double zSignOther = start ? -1 : 1;
219 -zSignOther*std::cos(phiOther), 0 );
221 xyVector = -
normal - normalOther;
241 }
while( prevEdge=edge, ++edge <
edges+numEdges );
267 G4Exception(
"G4PolyPhiFace::Diagnose()",
"GeomSolids0002",
276 : numEdges(0), rMin(0.), rMax(0.), zMin(0.), zMax(0.),
kCarTolerance(0.)
306 if (
this == &source) {
return *
this; }
358 * sourceEdge = source.
edges;
364 }
while( ++sourceEdge, ++edge, prev=here, ++here <
corners+numEdges );
378 G4double normSign = outgoing ? +1 : -1;
392 if (dotProd <= 0)
return false;
399 distFromSurface = -normSign*ps.
dot(
normal);
401 if (distFromSurface < -surfTolerance)
return false;
407 distance = distFromSurface/dotProd;
426 G4double normSign = outgoing ? +1 : -1;
435 else if (distPhi < 0)
460 return std::sqrt( distPhi*distPhi + distRZ2 );
489 if (
InsideEdges( r, p.
z(), &distRZ2, &base3Dnorm, &head3Dnorm ))
494 *bestDistance = std::fabs(distPhi);
499 if (distPhi < -tolerance)
return kInside;
500 if (distPhi < tolerance)
return kSurface;
509 *bestDistance = std::sqrt( distPhi*distPhi + distRZ2 );
519 if ( distRZ2 > tolerance*tolerance )
527 if (normDist < -tolerance)
return kInside;
528 if (normDist < tolerance)
return kSurface;
562 *bestDistance = std::fabs(distPhi);
569 *bestDistance = std::sqrt( distPhi*distPhi + distRZ2 );
588 + axis.
z()*corner->
z;
589 if (here > max) max = here;
675 prevZ =
ExactZOrder( z, qx, qy, qz, v, normSign, prev );
681 cornZ =
ExactZOrder( z, qx, qy, qz, v, normSign, corn );
685 if (prevZ < 0)
continue;
689 if (prevZ > 0)
continue;
698 if (prevZ == 0)
continue;
715 nextZ =
ExactZOrder( z, qx, qy, qz, v, normSign, next );
716 }
while( nextZ == 0 );
721 if (nextZ*prevZ < 0)
continue;
730 G4ThreeVector qa( qx - prev->x, qy - prev->y, qz - prev->z ),
731 qb( qx - corn->
x, qy - corn->
y, qz - corn->
z );
733 G4double aboveOrBelow = normSign*qa.cross(qb).dot(v);
735 if (aboveOrBelow > 0)
737 else if (aboveOrBelow < 0)
748 }
while( prevZ = cornZ, prev=corn, ++corn <
corners+numEdges );
783 if ( r < rMin || r >
rMax )
return false;
784 if ( z < zMin || z >
zMax )
return false;
816 G4double distance2 = distOut*distOut;
817 if (distance2 > bestDistance2)
continue;
832 else if (q > edge->
length)
846 if (distance2 < bestDistance2)
848 bestDistance2 = distance2;
852 answer = (distNorm <= 0);
855 *base3Dnorm = testMe;
856 *head3Dnorm = &testMe->
norm3D;
861 answer = (distOut <= 0);
864 *base3Dnorm = edge->
v0;
865 *head3Dnorm = &edge->
norm3D;
871 *bestDist2 = bestDistance2;
890 *p4=p2 + lambda1*w + lambda2*
v;
891 return 0.5*(v.cross(w)).mag();
920 return ((b.
x()-a.
x())*(c.
y()-a.
y())-
921 (c.
x()-a.
x())*(b.
y()-a.
y()));
930 return Area2(a,b,c)>0;
939 return Area2(a,b,c)>=0;
948 return Area2(a,b,c)==0;
962 Positive = !(
Left(a,b,c))^!(
Left(a,b,d));
963 return Positive && (!
Left(c,d,a)^!
Left(c,d,b));
971 if( !
Collinear(a,b,c) ) {
return false; }
975 return ((a.
x()<=c.
x())&&(c.
x()<=b.
x()))||
976 ((a.
x()>=c.
x())&&(c.
x()>=b.
x()));
980 return ((a.
y()<=c.
y())&&(c.
y()<=b.
y()))||
981 ((a.
y()>=c.
y())&&(c.
y()>=b.
y()));
1015 corner_next=corner->
next;
1019 if( (corner!=a)&&(corner_next!=a)
1020 &&(corner!=b)&&(corner_next!=b) )
1027 if(
Intersect(rz1,rz2,rz3,rz4) ) {
return false; }
1029 corner=corner->
next;
1052 if(
LeftOn(arz,arz1,arz0))
1054 return Left(arz,brz,arz0)&&
Left(brz,arz,arz1);
1082 c_next=corner->
next;
1083 c_prev=corner->
prev;
1088 corner=corner->
next;
1105 std::vector<G4double> areas;
1106 std::vector<G4ThreeVector> points;
1117 triang->
r = helper->
r;
1118 triang->
z = helper->
z;
1119 triang->
x = helper->
x;
1120 triang->
y= helper->
y;
1127 { triang->
prev=helper2; }
1132 { triang->
next=triang+1; }
1136 helper=helper->
next;
1137 triang=triang->
next;
1169 points.push_back(p4);
1170 areas.push_back(result1);
1198 "Maximum number of steps is reached for triangulation!" );
1211 points.push_back(p4);
1212 areas.push_back(result1);
1227 Achose1=0; Achose2=0.;
1232 if(chose>=Achose1 && chose<Achose2)
1239 i++; Achose1=Achose2;