49#define G4MT_phphix ((subInstanceManager.offset[instanceID]).fPhix)
50#define G4MT_phphiy ((subInstanceManager.offset[instanceID]).fPhiy)
51#define G4MT_phphiz ((subInstanceManager.offset[instanceID]).fPhiz)
52#define G4MT_phphik ((subInstanceManager.offset[instanceID]).fPhik)
58 return subInstanceManager;
86 r[0] = tail->
r;
z[0] = tail->
z;
87 r[1] = head->
r;
z[1] = head->
z;
99 phiTotal = (
phiIsOpen) ? thePhiTotal : twopi;
124 b1(
r[1]*std::cos(phi),
r[1]*std::sin(phi),
z[1] ),
125 c1( prevRZ->
r*std::cos(phi), prevRZ->
r*std::sin(phi), prevRZ->
z ),
126 d1( nextRZ->
r*std::cos(phi), nextRZ->
r*std::sin(phi), nextRZ->
z ),
139 c2 =
G4ThreeVector( prevRZ->
r*std::cos(phi), prevRZ->
r*std::sin(phi), prevRZ->
z );
140 d2 =
G4ThreeVector( nextRZ->
r*std::cos(phi), nextRZ->
r*std::sin(phi), nextRZ->
z );
149 vec->
center = 0.25*( a1 + a2 + b1 + b2 );
151 tt = b2 + b1 - a2 - a1;
155 tt = b2 - b1 + a2 - a1;
184 adj = 0.5*(c1+c2-a1-a2);
185 adj = adj.
cross(a12);
190 adj = 0.5*(d1+d2-b1-b2);
191 adj = adj.
cross(a12);
200 vec->
edges[0] = edge;
204 vec->
edges[1] = edge;
232 edge = vec->
edges[0];
270 if (normvec.
dot(vec->
surfPhi) > 0) normvec = -normvec;
286 if (normvec.
dot(vec->
surfPhi) < 0) normvec = -normvec;
308 : startPhi(0.), deltaPhi(0.), endPhi(0.),
342 if (
this == &source)
return *
this;
376 kCarTolerance = source.kCarTolerance;
377 fSurfaceArea = source.fSurfaceArea;
388 *sourceEdge = source.
edges;
392 }
while( ++sourceEdge, ++edge <
edges + numEdges);
400 *sourceVec = source.
vecs;
458 G4double normSign = outgoing ? +1 : -1;
498 if (dotProd <= 0)
continue;
504 distFromSurface = -normSign*delta.
dot(vec->
normal);
506 if (distFromSurface < -surfTolerance)
continue;
520 if (normSign*qc.
cross(qd).
dot(v) < 0)
continue;
525 if (normSign*qa.
cross(qb).
dot(v) > 0)
continue;
532 if (
r[0] > 1/kInfinity && normSign*qa.
cross(qc).
dot(v) < 0)
return false;
533 if (
r[1] > 1/kInfinity && normSign*qb.
cross(qd).
dot(v) > 0)
return false;
540 if (distFromSurface < 0)
545 if (std::fabs(rz) >
lenRZ+surfTolerance)
return false;
548 if (std::fabs(pp) >
lenPhi[0]+
lenPhi[1]*rz+surfTolerance)
return false;
555 distance = distFromSurface/dotProd;
559 }
while( ++vec, ++face <
numSide );
571 G4double normSign = outgoing ? -1 : +1;
581 if (normSign*normDist > -0.5*kCarTolerance)
619 if ( (std::fabs(norm) > tolerance) || (*bestDistance > 2.0*tolerance) )
678 i1 = iPhi; i2 = iPhi;
694 if (answer > best) best = answer;
695 }
while( ++vec < list+4 );
787 if (dotProd <= 0)
return false;
794 distFromSurface = -normSign*delta.
dot(vec.
normal);
796 if (distFromSurface < -surfTolerance)
return false;
802 distance = distFromSurface/dotProd;
824 if (
r[0]==0)
return true;
826 if (atRZ < -
lenRZ*1.2)
return false;
832 if (normSign*qacb.
dot(v) < 0)
return false;
834 if (distFromSurface < 0)
836 if (atRZ < -
lenRZ-surfTolerance)
return false;
841 if (
r[1]==0)
return true;
843 if (atRZ >
lenRZ*1.2)
return false;
849 if (normSign*qacb.
dot(v) >= 0)
return false;
851 if (distFromSurface < 0)
853 if (atRZ >
lenRZ+surfTolerance)
return false;
881 *i1 =
PhiSegment( std::atan2( p.
y() + s1*v.
y(), p.
x() + s1*v.
x() ) );
884 return (*i1 < 0) ? 0 : 1;
890 *i2 =
PhiSegment( std::atan2( p.
y() + s2*v.
y(), p.
x() + s2*v.
x() ) );
891 if (*i1 == *i2)
return 0;
895 if (*i2 < 0)
return 0;
900 if (*i2 < 0)
return 1;
913 if (iPhi >= 0)
return iPhi;
929 return (d2 < d1) ? 0 :
numSide-1;
1054 if (pcDotRZ < -
lenRZ)
1061 if (pcDotPhi < -lenPhiZ)
1066 G4double distOutPhi = pcDotPhi+lenPhiZ;
1067 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1071 else if (pcDotPhi > lenPhiZ)
1076 G4double distOutPhi = pcDotPhi-lenPhiZ;
1077 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1087 distOut2 = distOutZ*distOutZ;
1091 else if (pcDotRZ >
lenRZ)
1098 if (pcDotPhi < -lenPhiZ)
1103 G4double distOutPhi = pcDotPhi+lenPhiZ;
1104 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1108 else if (pcDotPhi > lenPhiZ)
1113 G4double distOutPhi = pcDotPhi-lenPhiZ;
1114 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1123 distOut2 = distOutZ*distOutZ;
1134 if (pcDotPhi < -lenPhiZ)
1140 distOut2 = distOut*distOut;
1144 else if (pcDotPhi > lenPhiZ)
1150 distOut2 = distOut*distOut;
1159 return std::fabs(distFaceNorm);
1162 return std::sqrt( distFaceNorm*distFaceNorm + distOut2 );
1180 *p4=p2 + lambda1*w + lambda2*v;
1181 return 0.5*(v.
cross(w)).mag();
1200 if( (chose>=0.) && (chose < aOne) )
1211 if( fSurfaceArea==0. )
1237 return fSurfaceArea;
1246 std::vector<G4double>areas;
1247 std::vector<G4ThreeVector>points;
1265 points.push_back(point1);
1266 areas.push_back(result1);
1278 if(chose>=Achose1 && chose<Achose2)
1280 point1=points[i] ;
break;
1282 ++i; Achose1=Achose2;
const G4double kCarTolerance
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)
G4int CreateSubInstance()
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)
static const G4PhSideManager & GetSubInstanceManager()
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]