95 r[0] = tail->
r;
z[0] = tail->
z;
96 r[1] = head->
r;
z[1] = head->
z;
133 b1(
r[1]*std::cos(phi),
r[1]*std::sin(phi),
z[1] ),
134 c1( prevRZ->
r*std::cos(phi), prevRZ->
r*std::sin(phi), prevRZ->
z ),
135 d1( nextRZ->
r*std::cos(phi), nextRZ->
r*std::sin(phi), nextRZ->
z ),
148 c2 =
G4ThreeVector( prevRZ->
r*std::cos(phi), prevRZ->
r*std::sin(phi), prevRZ->
z );
149 d2 =
G4ThreeVector( nextRZ->
r*std::cos(phi), nextRZ->
r*std::sin(phi), nextRZ->
z );
160 tt = b2 +
b1 - a2 -
a1;
164 tt = b2 -
b1 + a2 -
a1;
168 lenPhi[0] = 0.25*tt.mag();
193 adj = 0.5*(
c1+c2-a1-
a2);
194 adj = adj.cross(a12);
195 adj = adj.unit() + vec->
normal;
200 adj = adj.cross(a12);
201 adj = adj.unit() + vec->
normal;
209 vec->
edges[0] = edge;
213 vec->
edges[1] = edge;
241 edge = vec->
edges[0];
247 edge->
normal = eNorm.unit();
261 }
while( prev=vec, ++vec <
vecs + numSide );
278 normvec = normvec.cross(vec->
normal);
279 if (normvec.dot(vec->
surfPhi) > 0) normvec = -normvec;
291 vec =
vecs + numSide - 1;
294 normvec = normvec.cross(vec->
normal);
295 if (normvec.dot(vec->
surfPhi) < 0) normvec = -normvec;
319 : numSide(0), startPhi(0.), deltaPhi(0.), endPhi(0.),
320 phiIsOpen(false), allBehind(false), cone(0), vecs(0), edges(0),
321 lenRZ(0.), edgeNorm(0.), kCarTolerance(0.), fSurfaceArea(0.), instanceID(0)
357 if (
this == &source)
return *
this;
405 *sourceEdge = source.
edges;
409 }
while( ++sourceEdge, ++edge <
edges + numEdges);
417 *sourceVec = source.
vecs;
477 G4double normSign = outgoing ? +1 : -1;
517 if (dotProd <= 0)
continue;
523 distFromSurface = -normSign*delta.dot(vec->
normal);
525 if (distFromSurface < -surfTolerance)
continue;
539 if (normSign*qc.cross(qd).dot(v) < 0)
continue;
544 if (normSign*qa.cross(qb).dot(v) > 0)
continue;
551 if (
r[0] > 1/
kInfinity && normSign*qa.cross(qc).dot(v) < 0)
return false;
552 if (
r[1] > 1/
kInfinity && normSign*qb.cross(qd).dot(v) > 0)
return false;
559 if (distFromSurface < 0)
564 if (std::fabs(rz) >
lenRZ+surfTolerance)
return false;
567 if (std::fabs(pp) >
lenPhi[0] +
lenPhi[1]*rz + surfTolerance)
return false;
574 distance = distFromSurface/dotProd;
578 }
while( ++vec, ++face <
numSide );
589 G4double normSign = outgoing ? -1 : +1;
639 if ( (std::fabs(norm) < tolerance) && (*bestDistance < 2.0*tolerance) )
704 i1 = iPhi; i2 = iPhi;
719 G4double answer = (*vec)->dot(axis);
720 if (answer > best) best = answer;
721 }
while( ++vec < list+4 );
817 if (dotProd <= 0)
return false;
824 distFromSurface = -normSign*delta.dot(vec.
normal);
826 if (distFromSurface < -surfTolerance)
return false;
832 distance = distFromSurface/dotProd;
854 if (
r[0]==0)
return true;
856 if (atRZ < -
lenRZ*1.2)
return false;
862 if (normSign*qacb.dot(v) < 0)
return false;
864 if (distFromSurface < 0)
866 if (atRZ < -
lenRZ-surfTolerance)
return false;
871 if (
r[1]==0)
return true;
873 if (atRZ >
lenRZ*1.2)
return false;
879 if (normSign*qacb.dot(v) >= 0)
return false;
881 if (distFromSurface < 0)
883 if (atRZ >
lenRZ+surfTolerance)
return false;
913 *i1 =
PhiSegment( std::atan2( p.y() + s1*v.y(), p.x() + s1*v.x() ) );
916 return (*i1 < 0) ? 0 : 1;
922 *i2 =
PhiSegment( std::atan2( p.y() + s2*v.y(), p.x() + s2*v.x() ) );
923 if (*i1 == *i2)
return 0;
927 if (*i2 < 0)
return 0;
932 if (*i2 < 0)
return 1;
947 if (iPhi >= 0)
return iPhi;
963 return (d2 < d1) ? 0 :
numSide-1;
1050 *normDist = vec.
normal.dot(pct);
1095 if (pcDotRZ < -
lenRZ)
1102 if (pcDotPhi < -lenPhiZ)
1107 G4double distOutPhi = pcDotPhi+lenPhiZ;
1108 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1112 else if (pcDotPhi > lenPhiZ)
1117 G4double distOutPhi = pcDotPhi-lenPhiZ;
1118 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1128 distOut2 = distOutZ*distOutZ;
1129 *normDist = pa.dot(vec.
edgeNorm[0]);
1132 else if (pcDotRZ >
lenRZ)
1139 if (pcDotPhi < -lenPhiZ)
1144 G4double distOutPhi = pcDotPhi+lenPhiZ;
1145 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1149 else if (pcDotPhi > lenPhiZ)
1154 G4double distOutPhi = pcDotPhi-lenPhiZ;
1155 distOut2 = distOutPhi*distOutPhi + distOutZ*distOutZ;
1164 distOut2 = distOutZ*distOutZ;
1166 *normDist = pd.dot(vec.
edgeNorm[1]);
1175 if (pcDotPhi < -lenPhiZ)
1181 distOut2 = distOut*distOut;
1185 else if (pcDotPhi > lenPhiZ)
1191 distOut2 = distOut*distOut;
1200 return std::fabs(distFaceNorm);
1203 return std::sqrt( distFaceNorm*distFaceNorm + distOut2 );
1223 *p4=p2 + lambda1*w + lambda2*v;
1224 return 0.5*(v.cross(w)).mag();
1245 if( (chose>=0.) && (chose < aOne) )
1295 std::vector<G4double>areas;
1296 std::vector<G4ThreeVector>points;
1314 points.push_back(point1);
1315 areas.push_back(result1);
1323 Achose1=0;Achose2=0.;
1328 if(chose>=Achose1 && chose<Achose2)
1330 point1=points[i] ;
break;
1332 i++; Achose1=Achose2;
G4PolyhedraSideEdge * edges[2]
G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1, G4ThreeVector p2, G4ThreeVector p3, G4double *Area)
static c2_factory< G4double > c2
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]
static const G4double kInfinity
CLHEP::Hep3Vector G4ThreeVector
EInside Inside(const G4ThreeVector &p, G4double tolerance, G4double *bestDistance)
virtual ~G4PolyhedraSide()
G4int ClosestPhiSegment(G4double phi)
G4double DistanceToOneSide(const G4ThreeVector &p, const G4PolyhedraSideVec &vec, G4double *normDist)
static const G4float tolerance
G4ThreeVector edgeNorm[2]
static const G4PhSideManager & GetSubInstanceManager()
G4double GetSurfaceTolerance() const
const G4double w[NPOINTSGL]
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
static double normal(HepRandomEngine *eptr)
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)
static const double twopi
void AddSurface(const G4ClippablePolygon &surface)
G4int PhiSegment(G4double phi)
static G4GEOM_DLL G4PhSideManager subInstanceManager
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, G4bool outgoing, G4double surfTolerance, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal, G4bool &allBehind)
G4ThreeVector GetPointOnFace()
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()