74 r[0] = tail->
r;
z[0] = tail->
z;
75 r[1] = head->
r;
z[1] = head->
z;
86 phiTotal = (
phiIsOpen) ? thePhiTotal : twopi;
111 b1(
r[1]*std::cos(phi),
r[1]*std::sin(phi),
z[1] ),
112 c1( prevRZ->
r*std::cos(phi), prevRZ->
r*std::sin(phi), prevRZ->
z ),
113 d1( nextRZ->
r*std::cos(phi), nextRZ->
r*std::sin(phi), nextRZ->
z ),
126 c2 =
G4ThreeVector( prevRZ->
r*std::cos(phi), prevRZ->
r*std::sin(phi), prevRZ->
z );
127 d2 =
G4ThreeVector( nextRZ->
r*std::cos(phi), nextRZ->
r*std::sin(phi), nextRZ->
z );
136 vec->
center = 0.25*( a1 + a2 + b1 + b2 );
138 tt = b2 + b1 - a2 - a1;
142 tt = b2 - b1 + a2 - a1;
171 adj = 0.5*(c1+c2-a1-a2);
172 adj = adj.
cross(a12);
177 adj = 0.5*(d1+d2-b1-b2);
178 adj = adj.
cross(a12);
187 vec->
edges[0] = edge;
191 vec->
edges[1] = edge;
219 edge = vec->
edges[0];
257 if (normvec.
dot(vec->
surfPhi) > 0) normvec = -normvec;
273 if (normvec.
dot(vec->
surfPhi) < 0) normvec = -normvec;
297 : numSide(0), startPhi(0.), deltaPhi(0.), endPhi(0.),
298 phiIsOpen(false), allBehind(false), cone(0), vecs(0), edges(0),
299 lenRZ(0.), edgeNorm(0.), kCarTolerance(0.), fSurfaceArea(0.)
333 if (
this == &source)
return *
this;
369 kCarTolerance = source.kCarTolerance;
370 fSurfaceArea = source.fSurfaceArea;
381 *sourceEdge = source.
edges;
385 }
while( ++sourceEdge, ++edge <
edges + numEdges);
393 *sourceVec = source.
vecs;
453 G4double normSign = outgoing ? +1 : -1;
493 if (dotProd <= 0)
continue;
499 distFromSurface = -normSign*delta.
dot(vec->
normal);
501 if (distFromSurface < -surfTolerance)
continue;
515 if (normSign*qc.
cross(qd).
dot(v) < 0)
continue;
520 if (normSign*qa.
cross(qb).
dot(v) > 0)
continue;
527 if (
r[0] > 1/kInfinity && normSign*qa.
cross(qc).
dot(v) < 0)
return false;
528 if (
r[1] > 1/kInfinity && normSign*qb.
cross(qd).
dot(v) > 0)
return false;
535 if (distFromSurface < 0)
540 if (std::fabs(rz) >
lenRZ+surfTolerance)
return false;
543 if (std::fabs(pp) >
lenPhi[0] +
lenPhi[1]*rz + surfTolerance)
return false;
550 distance = distFromSurface/dotProd;
554 }
while( ++vec, ++face <
numSide );
565 G4double normSign = outgoing ? -1 : +1;
575 if (normSign*normDist > -0.5*kCarTolerance)
615 if ( (std::fabs(norm) < tolerance) && (*bestDistance < 2.0*tolerance) )
680 i1 = iPhi; i2 = iPhi;
696 if (answer > best) best = answer;
697 }
while( ++vec < list+4 );
793 if (dotProd <= 0)
return false;
800 distFromSurface = -normSign*delta.
dot(vec.
normal);
802 if (distFromSurface < -surfTolerance)
return false;
808 distance = distFromSurface/dotProd;
830 if (
r[0]==0)
return true;
832 if (atRZ < -
lenRZ*1.2)
return false;
838 if (normSign*qacb.
dot(v) < 0)
return false;
840 if (distFromSurface < 0)
842 if (atRZ < -
lenRZ-surfTolerance)
return false;
847 if (
r[1]==0)
return true;
849 if (atRZ >
lenRZ*1.2)
return false;
855 if (normSign*qacb.
dot(v) >= 0)
return false;
857 if (distFromSurface < 0)
859 if (atRZ >
lenRZ+surfTolerance)
return false;
889 *i1 =
PhiSegment( std::atan2( p.
y() + s1*v.
y(), p.
x() + s1*v.
x() ) );
892 return (*i1 < 0) ? 0 : 1;
898 *i2 =
PhiSegment( std::atan2( p.
y() + s2*v.
y(), p.
x() + s2*v.
x() ) );
899 if (*i1 == *i2)
return 0;
903 if (*i2 < 0)
return 0;
908 if (*i2 < 0)
return 1;
923 if (iPhi >= 0)
return iPhi;
931 while( phi <
startPhi ) phi += twopi;
934 while( phi >
startPhi ) phi -= twopi;
937 return (d2 < d1) ? 0 :
numSide-1;
955 while( phi < 0 ) phi += twopi;
956 while( phi > twopi ) phi -= twopi;
1067 if (pcDotRZ < -
lenRZ)
1074 if (pcDotPhi < -lenPhiZ)
1079 G4double distOutPhi = pcDotPhi+lenPhiZ;
1080 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1084 else if (pcDotPhi > lenPhiZ)
1089 G4double distOutPhi = pcDotPhi-lenPhiZ;
1090 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1100 distOut2 = distOutZ*distOutZ;
1104 else if (pcDotRZ >
lenRZ)
1111 if (pcDotPhi < -lenPhiZ)
1116 G4double distOutPhi = pcDotPhi+lenPhiZ;
1117 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1121 else if (pcDotPhi > lenPhiZ)
1126 G4double distOutPhi = pcDotPhi-lenPhiZ;
1127 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1136 distOut2 = distOutZ*distOutZ;
1147 if (pcDotPhi < -lenPhiZ)
1153 distOut2 = distOut*distOut;
1157 else if (pcDotPhi > lenPhiZ)
1163 distOut2 = distOut*distOut;
1172 return std::fabs(distFaceNorm);
1175 return std::sqrt( distFaceNorm*distFaceNorm + distOut2 );
1195 *p4=p2 + lambda1*w + lambda2*v;
1196 return 0.5*(v.
cross(w)).mag();
1217 if( (chose>=0.) && (chose < aOne) )
1230 if( fSurfaceArea==0. )
1256 return fSurfaceArea;
1267 std::vector<G4double>areas;
1268 std::vector<G4ThreeVector>points;
1286 points.push_back(point1);
1287 areas.push_back(result1);
1295 Achose1=0;Achose2=0.;
1300 if(chose>=Achose1 && chose<Achose2)
1302 point1=points[i] ;
break;
1304 i++; Achose1=Achose2;
CLHEP::Hep3Vector G4ThreeVector
Hep3Vector cross(const Hep3Vector &) const
double dot(const Hep3Vector &) const
virtual G4bool PartialClip(const G4VoxelLimits &voxelLimit, const EAxis IgnoreMe)
virtual void AddVertexInOrder(const G4ThreeVector vertex)
void SetNormal(const G4ThreeVector &newNormal)
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4int LineHitsCone(const G4ThreeVector &p, const G4ThreeVector &v, G4double *s1, G4double *s2)
EInside Inside(const G4ThreeVector &p, G4double tolerance, G4double *bestDistance)
G4PolyhedraSideVec * vecs
G4double Distance(const G4ThreeVector &p, G4bool outgoing)
G4PolyhedraSideEdge * edges
G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4double *Area)
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, G4bool outgoing, G4double surfTolerance, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal, G4bool &allBehind)
G4PolyhedraSide & operator=(const G4PolyhedraSide &source)
G4double SurfaceTriangle(G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4ThreeVector *p4)
G4double GetPhi(const G4ThreeVector &p)
G4bool IntersectSidePlane(const G4ThreeVector &p, const G4ThreeVector &v, const G4PolyhedraSideVec &vec, G4double normSign, G4double surfTolerance, G4double &distance, G4double &distFromSurface)
G4PolyhedraSide(const G4PolyhedraSideRZ *prevRZ, const G4PolyhedraSideRZ *tail, const G4PolyhedraSideRZ *head, const G4PolyhedraSideRZ *nextRZ, G4int numSide, G4double phiStart, G4double phiTotal, G4bool phiIsOpen, G4bool isAllBehind=false)
G4ThreeVector GetPointOnFace()
G4double Extent(const G4ThreeVector axis)
G4int ClosestPhiSegment(G4double phi)
G4int PhiSegment(G4double phi)
G4int LineHitsSegments(const G4ThreeVector &p, const G4ThreeVector &v, G4int *i1, G4int *i2)
G4ThreeVector Normal(const G4ThreeVector &p, G4double *bestDistance)
G4double DistanceAway(const G4ThreeVector &p, const G4PolyhedraSideVec &vec, G4double *normDist)
G4double DistanceToOneSide(const G4ThreeVector &p, const G4PolyhedraSideVec &vec, G4double *normDist)
virtual ~G4PolyhedraSide()
G4IntersectingCone * cone
void CalculateExtent(const EAxis axis, const G4VoxelLimits &voxelLimit, const G4AffineTransform &tranform, G4SolidExtentList &extentList)
void CopyStuff(const G4PolyhedraSide &source)
void AddSurface(const G4ClippablePolygon &surface)
G4ThreeVector cornNorm[2]
G4ThreeVector edgeNorm[2]
G4PolyhedraSideEdge * edges[2]