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) )
680 i1 = iPhi; i2 = iPhi;
696 if (answer > best) best = answer;
697 }
while( ++vec < list+4 );
789 if (dotProd <= 0)
return false;
796 distFromSurface = -normSign*delta.
dot(vec.
normal);
798 if (distFromSurface < -surfTolerance)
return false;
804 distance = distFromSurface/dotProd;
826 if (
r[0]==0)
return true;
828 if (atRZ < -
lenRZ*1.2)
return false;
834 if (normSign*qacb.
dot(v) < 0)
return false;
836 if (distFromSurface < 0)
838 if (atRZ < -
lenRZ-surfTolerance)
return false;
843 if (
r[1]==0)
return true;
845 if (atRZ >
lenRZ*1.2)
return false;
851 if (normSign*qacb.
dot(v) >= 0)
return false;
853 if (distFromSurface < 0)
855 if (atRZ >
lenRZ+surfTolerance)
return false;
883 *i1 =
PhiSegment( std::atan2( p.
y() + s1*v.
y(), p.
x() + s1*v.
x() ) );
886 return (*i1 < 0) ? 0 : 1;
892 *i2 =
PhiSegment( std::atan2( p.
y() + s2*v.
y(), p.
x() + s2*v.
x() ) );
893 if (*i1 == *i2)
return 0;
897 if (*i2 < 0)
return 0;
902 if (*i2 < 0)
return 1;
915 if (iPhi >= 0)
return iPhi;
931 return (d2 < d1) ? 0 :
numSide-1;
1056 if (pcDotRZ < -
lenRZ)
1063 if (pcDotPhi < -lenPhiZ)
1068 G4double distOutPhi = pcDotPhi+lenPhiZ;
1069 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1073 else if (pcDotPhi > lenPhiZ)
1078 G4double distOutPhi = pcDotPhi-lenPhiZ;
1079 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1089 distOut2 = distOutZ*distOutZ;
1093 else if (pcDotRZ >
lenRZ)
1100 if (pcDotPhi < -lenPhiZ)
1105 G4double distOutPhi = pcDotPhi+lenPhiZ;
1106 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1110 else if (pcDotPhi > lenPhiZ)
1115 G4double distOutPhi = pcDotPhi-lenPhiZ;
1116 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1125 distOut2 = distOutZ*distOutZ;
1136 if (pcDotPhi < -lenPhiZ)
1142 distOut2 = distOut*distOut;
1146 else if (pcDotPhi > lenPhiZ)
1152 distOut2 = distOut*distOut;
1161 return std::fabs(distFaceNorm);
1164 return std::sqrt( distFaceNorm*distFaceNorm + distOut2 );
1182 *p4=p2 + lambda1*w + lambda2*v;
1183 return 0.5*(v.
cross(w)).mag();
1202 if( (chose>=0.) && (chose < aOne) )
1213 if( fSurfaceArea==0. )
1239 return fSurfaceArea;
1248 std::vector<G4double>areas;
1249 std::vector<G4ThreeVector>points;
1267 points.push_back(point1);
1268 areas.push_back(result1);
1280 if(chose>=Achose1 && chose<Achose2)
1282 point1=points[i] ;
break;
1284 ++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]