65 return subInstanceManager;
95 r[0] = tail->
r;
z[0] = tail->
z;
96 r[1] = head->
r;
z[1] = head->
z;
132 b1(
r[1]*std::cos(phi),
r[1]*std::sin(phi),
z[1] ),
133 c1( prevRZ->
r*std::cos(phi), prevRZ->
r*std::sin(phi), prevRZ->
z ),
134 d1( nextRZ->
r*std::cos(phi), nextRZ->
r*std::sin(phi), nextRZ->
z ),
147 c2 =
G4ThreeVector( prevRZ->
r*std::cos(phi), prevRZ->
r*std::sin(phi), prevRZ->
z );
148 d2 =
G4ThreeVector( nextRZ->
r*std::cos(phi), nextRZ->
r*std::sin(phi), nextRZ->
z );
157 vec->
center = 0.25*( a1 + a2 + b1 + b2 );
159 tt = b2 + b1 - a2 - a1;
163 tt = b2 - b1 + a2 - a1;
192 adj = 0.5*(
c1+c2-a1-a2);
193 adj = adj.
cross(a12);
198 adj = 0.5*(d1+d2-b1-b2);
199 adj = adj.
cross(a12);
208 vec->
edges[0] = edge;
212 vec->
edges[1] = edge;
240 edge = vec->
edges[0];
260 }
while( prev=vec, ++vec <
vecs + numSide );
278 if (normvec.
dot(vec->
surfPhi) > 0) normvec = -normvec;
290 vec =
vecs + numSide - 1;
294 if (normvec.
dot(vec->
surfPhi) < 0) normvec = -normvec;
318 : numSide(0), startPhi(0.), deltaPhi(0.), endPhi(0.),
319 phiIsOpen(false), allBehind(false), cone(0), vecs(0), edges(0),
320 lenRZ(0.), edgeNorm(0.), kCarTolerance(0.), fSurfaceArea(0.), instanceID(0)
356 if (
this == &source)
return *
this;
392 kCarTolerance = source.kCarTolerance;
393 fSurfaceArea = source.fSurfaceArea;
404 *sourceEdge = source.
edges;
408 }
while( ++sourceEdge, ++edge <
edges + numEdges);
416 *sourceVec = source.
vecs;
476 G4double normSign = outgoing ? +1 : -1;
516 if (dotProd <= 0)
continue;
522 distFromSurface = -normSign*delta.
dot(vec->
normal);
524 if (distFromSurface < -surfTolerance)
continue;
538 if (normSign*qc.
cross(qd).
dot(v) < 0)
continue;
543 if (normSign*qa.
cross(qb).
dot(v) > 0)
continue;
550 if (
r[0] > 1/kInfinity && normSign*qa.
cross(qc).
dot(v) < 0)
return false;
551 if (
r[1] > 1/kInfinity && normSign*qb.
cross(qd).
dot(v) > 0)
return false;
558 if (distFromSurface < 0)
563 if (std::fabs(rz) >
lenRZ+surfTolerance)
return false;
566 if (std::fabs(pp) >
lenPhi[0] +
lenPhi[1]*rz + surfTolerance)
return false;
573 distance = distFromSurface/dotProd;
577 }
while( ++vec, ++face <
numSide );
588 G4double normSign = outgoing ? -1 : +1;
598 if (normSign*normDist > -0.5*kCarTolerance)
638 if ( (std::fabs(norm) < tolerance) && (*bestDistance < 2.0*tolerance) )
703 i1 = iPhi; i2 = iPhi;
719 if (answer > best) best = answer;
720 }
while( ++vec < list+4 );
816 if (dotProd <= 0)
return false;
823 distFromSurface = -normSign*delta.
dot(vec.
normal);
825 if (distFromSurface < -surfTolerance)
return false;
831 distance = distFromSurface/dotProd;
853 if (
r[0]==0)
return true;
855 if (atRZ < -
lenRZ*1.2)
return false;
861 if (normSign*qacb.
dot(v) < 0)
return false;
863 if (distFromSurface < 0)
865 if (atRZ < -
lenRZ-surfTolerance)
return false;
870 if (
r[1]==0)
return true;
872 if (atRZ >
lenRZ*1.2)
return false;
878 if (normSign*qacb.
dot(v) >= 0)
return false;
880 if (distFromSurface < 0)
882 if (atRZ >
lenRZ+surfTolerance)
return false;
912 *i1 =
PhiSegment( std::atan2( p.
y() + s1*v.
y(), p.
x() + s1*v.
x() ) );
915 return (*i1 < 0) ? 0 : 1;
921 *i2 =
PhiSegment( std::atan2( p.
y() + s2*v.
y(), p.
x() + s2*v.
x() ) );
922 if (*i1 == *i2)
return 0;
926 if (*i2 < 0)
return 0;
931 if (*i2 < 0)
return 1;
946 if (iPhi >= 0)
return iPhi;
960 return (d2 < d1) ? 0 :
numSide-1;
978 while( phi < 0 ) phi +=
twopi;
1090 if (pcDotRZ < -
lenRZ)
1097 if (pcDotPhi < -lenPhiZ)
1102 G4double distOutPhi = pcDotPhi+lenPhiZ;
1103 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1107 else if (pcDotPhi > lenPhiZ)
1112 G4double distOutPhi = pcDotPhi-lenPhiZ;
1113 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1123 distOut2 = distOutZ*distOutZ;
1127 else if (pcDotRZ >
lenRZ)
1134 if (pcDotPhi < -lenPhiZ)
1139 G4double distOutPhi = pcDotPhi+lenPhiZ;
1140 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1144 else if (pcDotPhi > lenPhiZ)
1149 G4double distOutPhi = pcDotPhi-lenPhiZ;
1150 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1159 distOut2 = distOutZ*distOutZ;
1170 if (pcDotPhi < -lenPhiZ)
1176 distOut2 = distOut*distOut;
1180 else if (pcDotPhi > lenPhiZ)
1186 distOut2 = distOut*distOut;
1195 return std::fabs(distFaceNorm);
1198 return std::sqrt( distFaceNorm*distFaceNorm + distOut2 );
1218 *p4=p2 + lambda1*w + lambda2*
v;
1219 return 0.5*(v.cross(w)).mag();
1240 if( (chose>=0.) && (chose < aOne) )
1253 if( fSurfaceArea==0. )
1279 return fSurfaceArea;
1290 std::vector<G4double>areas;
1291 std::vector<G4ThreeVector>points;
1309 points.push_back(point1);
1310 areas.push_back(result1);
1318 Achose1=0;Achose2=0.;
1323 if(chose>=Achose1 && chose<Achose2)
1325 point1=points[i] ;
break;
1327 i++; Achose1=Achose2;
G4PolyhedraSideEdge * edges[2]
G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4double *Area)
G4double GetPhi(const G4ThreeVector &p)
G4double Extent(const G4ThreeVector axis)
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 cornNorm[2]
CLHEP::Hep3Vector G4ThreeVector
EInside Inside(const G4ThreeVector &p, G4double tolerance, G4double *bestDistance)
double dot(const Hep3Vector &) const
virtual ~G4PolyhedraSide()
G4int ClosestPhiSegment(G4double phi)
G4double DistanceToOneSide(const G4ThreeVector &p, const G4PolyhedraSideVec &vec, G4double *normDist)
G4ThreeVector edgeNorm[2]
static const G4PhSideManager & GetSubInstanceManager()
G4double GetSurfaceTolerance() const
void SetNormal(const G4ThreeVector &newNormal)
G4ThreeVector Normal(const G4ThreeVector &p, G4double *bestDistance)
virtual G4bool PartialClip(const G4VoxelLimits &voxelLimit, const EAxis IgnoreMe)
virtual void AddVertexInOrder(const G4ThreeVector vertex)
G4int LineHitsSegments(const G4ThreeVector &p, const G4ThreeVector &v, G4int *i1, G4int *i2)
G4int LineHitsCone(const G4ThreeVector &p, const G4ThreeVector &v, G4double *s1, G4double *s2)
G4int CreateSubInstance()
G4PolyhedraSideVec * vecs
G4double DistanceAway(const G4ThreeVector &p, const G4PolyhedraSideVec &vec, G4double *normDist)
G4double Distance(const G4ThreeVector &p, G4bool outgoing)
G4double SurfaceTriangle(G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4ThreeVector *p4)
G4bool IntersectSidePlane(const G4ThreeVector &p, const G4ThreeVector &v, const G4PolyhedraSideVec &vec, G4double normSign, G4double surfTolerance, G4double &distance, G4double &distFromSurface)
void AddSurface(const G4ClippablePolygon &surface)
G4int PhiSegment(G4double phi)
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, G4bool outgoing, G4double surfTolerance, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal, G4bool &allBehind)
G4ThreeVector GetPointOnFace()
Hep3Vector cross(const Hep3Vector &) const
void CopyStuff(const G4PolyhedraSide &source)
G4IntersectingCone * cone
G4PolyhedraSideEdge * edges
void CalculateExtent(const EAxis axis, const G4VoxelLimits &voxelLimit, const G4AffineTransform &tranform, G4SolidExtentList &extentList)
G4PolyhedraSide & operator=(const G4PolyhedraSide &source)
static G4GeometryTolerance * GetInstance()