88            b1(
r[1]*std::cos(phi), 
r[1]*std::sin(phi), 
z[1]),
 
   89            c1(prevRZ->
r * std::cos(phi), prevRZ->
r * std::sin(phi), prevRZ->
z),
 
   90            d1(nextRZ->
r * std::cos(phi), nextRZ->
r * std::sin(phi), nextRZ->
z),
 
  101     a2 = 
UVector3(
r[0] * std::cos(phi), 
r[0] * std::sin(phi), 
z[0]);
 
  102     b2 = 
UVector3(
r[1] * std::cos(phi), 
r[1] * std::sin(phi), 
z[1]);
 
  103     c2 = 
UVector3(prevRZ->
r * std::cos(phi), prevRZ->
r * std::sin(phi), prevRZ->
z);
 
  104     d2 = 
UVector3(nextRZ->
r * std::cos(phi), nextRZ->
r * std::sin(phi), nextRZ->
z);
 
  115     tt = b2 + 
b1 - a2 - 
a1;
 
  119     tt = b2 - 
b1 + a2 - 
a1;
 
  148     adj = 0.5 * (
c1 + c2 - a1 - 
a2);
 
  149     adj = adj.
Cross(a12);
 
  154     adj = 0.5 * (
d1 + d2 - 
b1 - 
b2);
 
  155     adj = adj.
Cross(a12);
 
  164     vec->
edges[0] = edge;
 
  168     vec->
edges[1] = edge;
 
  197     edge = vec->
edges[0];    
 
  218   while (prev = vec, ++vec < 
vecs + numSide);
 
  236     if (normvec.
Dot(vec->
surfPhi) > 0) normvec = -normvec;
 
  248     vec = 
vecs + numSide - 1;
 
  252     if (normvec.
Dot(vec->
surfPhi) < 0) normvec = -normvec;
 
  276   : numSide(0), startPhi(0.), deltaPhi(0.), endPhi(0.),
 
  277     phiIsOpen(false), allBehind(false), cone(0), vecs(0), edges(0),
 
  278     lenRZ(0.), edgeNorm(0.), kCarTolerance(0.), fSurfaceArea(0.)
 
  312   if (
this == &source) 
return *
this;
 
  360                       *sourceEdge = source.
edges;
 
  365   while (++sourceEdge, ++edge < 
edges + numEdges);
 
  373                      *sourceVec = source.
vecs;
 
  428                               double surfTolerance,
 
  430                               double& distFromSurface,
 
  465     if (!solutions) 
return false;
 
  466     if (solutions == 2 && s2 > 0 && (s2 < s1 || s1 < 0))
 
  476   double normSign = outgoing ? 1 : -1;
 
  480     if (face == segment) 
continue;
 
  485     double dotProd = normSign * v.Dot(vec.
normal);
 
  486     if (dotProd <= 0) 
continue;
 
  492     distFromSurface = -normSign * delta.
Dot(vec.
normal);
 
  494     if (distFromSurface < -surfTolerance) 
continue;
 
  508     if (normSign * qc.
Cross(qd).
Dot(v) < 0) 
continue;
 
  513     if (normSign * qa.
Cross(qb).
Dot(v) > 0) 
continue;
 
  528     if (distFromSurface < 0)
 
  533       if (std::fabs(rz) > 
lenRZ + surfTolerance) 
return false;
 
  536       if (std::fabs(pp) > 
lenPhi[0] + 
lenPhi[1]*rz + surfTolerance) 
return false;
 
  542     distance = distFromSurface / dotProd;
 
  558   double normSign = outgoing ? -1 : +1;
 
  591                                            double* bestDistance)
 
  607   if ((std::fabs(norm) < tolerance) && (*bestDistance < 2.0 * tolerance))
 
  620                                 double* bestDistance)
 
  689     double answer = (*vec)->
Dot(axis);
 
  690     if (answer > best) best = answer;
 
  692   while (++vec < list + 4);
 
  730                                         double surfTolerance,
 
  732                                         double& distFromSurface)
 
  738   double dotProd = normSign * v.
Dot(vec.
normal);
 
  740   if (dotProd <= 0) 
return false;
 
  747   distFromSurface = -normSign * delta.
Dot(vec.
normal);
 
  749   if (distFromSurface < -surfTolerance) 
return false;
 
  755   distance = distFromSurface / dotProd;
 
  777     if (
r[0] == 0) 
return true;  
 
  779     if (atRZ < -
lenRZ * 1.2) 
return false; 
 
  785     if (normSign * qacb.
Dot(v) < 0) 
return false;
 
  787     if (distFromSurface < 0)
 
  789       if (atRZ < -
lenRZ - surfTolerance) 
return false;
 
  794     if (
r[1] == 0) 
return true;  
 
  796     if (atRZ > 
lenRZ * 1.2) 
return false; 
 
  802     if (normSign * qacb.
Dot(v) >= 0) 
return false;
 
  804     if (distFromSurface < 0)
 
  806       if (atRZ > 
lenRZ + surfTolerance) 
return false;
 
  831   if (n == 0) 
return 0;
 
  839     return (*i1 < 0) ? 0 : 1;
 
  846   if (*i1 == *i2) 
return 0;
 
  850     if (*i2 < 0) 
return 0;
 
  855   if (*i2 < 0) 
return 1;
 
  870   if (iPhi >= 0) 
return iPhi;
 
  884   return (d2 < d1) ? 0 : 
numSide - 1;
 
  986   double distFaceNorm = *normDist;
 
 1009   if (pcDotRZ < -
lenRZ)
 
 1012     double distOutZ = pcDotRZ + 
lenRZ;
 
 1016     if (pcDotPhi < -lenPhiZ)
 
 1021       double distOutPhi = pcDotPhi + lenPhiZ;
 
 1022       distOut2 = distOutPhi * distOutPhi + distOutZ * distOutZ;
 
 1026     else if (pcDotPhi > lenPhiZ)
 
 1031       double distOutPhi = pcDotPhi - lenPhiZ;
 
 1032       distOut2 = distOutPhi * distOutPhi + distOutZ * distOutZ;
 
 1042       distOut2 = distOutZ * distOutZ;
 
 1046   else if (pcDotRZ > 
lenRZ)
 
 1049     double distOutZ = pcDotRZ - 
lenRZ;
 
 1053     if (pcDotPhi < -lenPhiZ)
 
 1058       double distOutPhi = pcDotPhi + lenPhiZ;
 
 1059       distOut2 = distOutPhi * distOutPhi + distOutZ * distOutZ;
 
 1063     else if (pcDotPhi > lenPhiZ)
 
 1068       double distOutPhi = pcDotPhi - lenPhiZ;
 
 1069       distOut2 = distOutPhi * distOutPhi + distOutZ * distOutZ;
 
 1078       distOut2 = distOutZ * distOutZ;
 
 1089     if (pcDotPhi < -lenPhiZ)
 
 1094       double distOut = 
edgeNorm * (pcDotPhi + lenPhiZ);
 
 1095       distOut2 = distOut * distOut;
 
 1099     else if (pcDotPhi > lenPhiZ)
 
 1104       double distOut = 
edgeNorm * (pcDotPhi - lenPhiZ);
 
 1105       distOut2 = distOut * distOut;
 
 1114       return std::fabs(distFaceNorm);
 
 1117   return std::sqrt(distFaceNorm * distFaceNorm + distOut2);
 
 1137   *p4 = p2 + lambda1 * w + lambda2 * v;
 
 1138   return 0.5 * (v.Cross(w)).Mag();
 
 1152   double chose, aOne, aTwo;
 
 1157   *Area = aOne + aTwo;
 
 1160   if ((chose >= 0.) && (chose < aOne))
 
 1211   std::vector<double> areas;
 
 1212   std::vector<UVector3> points;
 
 1230     points.push_back(point1);
 
 1231     areas.push_back(result1);
 
 1239   double Achose1, Achose2;
 
 1245     Achose2 += areas[i];
 
 1246     if (chose >= Achose1 && chose < Achose2)
 
 1248       point1 = points[i] ;
 
bool IntersectSidePlane(const UVector3 &p, const UVector3 &v, const UPolyhedraSideVec &vec, double normSign, double surfTolerance, double &distance, double &distFromSurface)
 
static c2_factory< G4double > c2
 
virtual ~UPolyhedraSide()
 
UVector3 Cross(const UVector3 &) const 
 
double Safety(const UVector3 &p, bool outgoing)
 
double GetPhi(const UVector3 &p)
 
UVector3 GetPointOnPlane(UVector3 p0, UVector3 p1, UVector3 p2, UVector3 p3, double *Area)
 
static double Tolerance()
 
UPolyhedraSide(const UPolyhedraSideRZ *prevRZ, const UPolyhedraSideRZ *tail, const UPolyhedraSideRZ *head, const UPolyhedraSideRZ *nextRZ, int numSide, double phiStart, double phiTotal, bool phiIsOpen, bool isAllBehind=false)
 
static double normal(HepRandomEngine *eptr)
 
double SurfaceTriangle(UVector3 p1, UVector3 p2, UVector3 p3, UVector3 *p4)
 
UVector3 Normal(const UVector3 &p, double *bestDistance)
 
VUSolid::EnumInside Inside(const UVector3 &p, double tolerance, double *bestDistance)
 
bool Distance(const UVector3 &p, const UVector3 &v, bool outgoing, double surfTolerance, double &distance, double &distFromSurface, UVector3 &normal, bool &allBehind)
 
UPolyhedraSideEdge * edges[2]
 
int ClosestPhiSegment(double phi)
 
static const double kInfinity
 
UPolyhedraSideEdge * edges
 
double Dot(const UVector3 &) const 
 
double DistanceToOneSide(const UVector3 &p, const UPolyhedraSideVec &vec, double *normDist)
 
double Extent(const UVector3 axis)
 
UVector3 GetPointOnFace()
 
int LineHitsSegments(const UVector3 &p, const UVector3 &v, int *i1, int *i2)
 
double Random(double min=0.0, double max=1.0)
 
double DistanceAway(const UVector3 &p, const UPolyhedraSideVec &vec, double *normDist)
 
int LineHitsCone(const UVector3 &p, const UVector3 &v, double &s1, double &s2)
 
void CopyStuff(const UPolyhedraSide &source)
 
UPolyhedraSide & operator=(const UPolyhedraSide &source)
 
std::pair< UVector3, double > fPhi
 
int PhiSegment(double phi)