84 : ncorners(0), corners(0)
97 r[0] = tail->
r;
z[0] = tail->
z;
98 r[1] = head->
r;
z[1] = head->
z;
162 zNormEdge[0] /= lAdj;
174 zNormEdge[1] /= lAdj;
183 : startPhi(0.), deltaPhi(0.), phiIsOpen(false), allBehind(false),
184 cone(0), rNorm(0.), zNorm(0.), rS(0.), zS(0.), length(0.),
185 prevRS(0.), prevZS(0.), nextRS(0.), nextZS(0.), ncorners(0), corners(0),
186 kCarTolerance(0.), fSurfaceArea(0.), instanceID(0)
222 if (
this == &source) {
return *
this; }
294 G4double normSign = outgoing ? +1 : -1;
302 if (nside == 0)
return false;
314 if (normSign*v.dot(normal) > 0)
331 if (normSign*v.dot(pNormal) > 0)
337 distFromSurface = -normSign*
DistanceAway( p,
false, distOutside2 );
338 if (distOutside2 < surfTolerance*surfTolerance)
340 if (distFromSurface > -surfTolerance)
352 distFromSurface = s1;
365 if (nside==1)
return false;
377 if (normSign*v.dot(normal) > 0)
382 if (normSign*v.dot(pNormal) > 0)
385 distFromSurface = -normSign*
DistanceAway( p,
false, distOutside2 );
386 if (distOutside2 < surfTolerance*surfTolerance)
388 if (distFromSurface > -surfTolerance)
396 distFromSurface = s2;
418 G4double normSign = outgoing ? -1 : +1;
431 return std::sqrt( distFrom*distFrom + distOut2 );
433 return std::fabs(distFrom);
444 return std::sqrt( distFrom*distFrom + distOut2 );
446 return std::fabs(distFrom);
464 dist2 = distFrom*distFrom + distOut2;
466 *bestDistance = std::sqrt( dist2);
470 if ( (std::fabs(edgeRZnorm) < tolerance)
471 && (distOut2< tolerance*tolerance) )
473 else if (edgeRZnorm < 0)
492 *bestDistance = std::sqrt( dFrom*dFrom + dOut2 );
519 while( phi <
startPhi ) phi += twopi;
539 if (bd > ad) ad = bd;
540 if (
cd > ad) ad =
cd;
541 if (dd > ad) ad = dd;
596 G4double rFudge = 1.0/std::cos(0.5*sigPhi);
726 cosPhi = std::cos(phi),
727 sinPhi = std::sin(phi);
730 v1( r1*cosPhi, r1*sinPhi, z1 ),
745 cosPhi = std::cos(phi),
746 sinPhi = std::sin(phi);
774 polygon.
SetNormal( deltaV.cross(v1-v0).unit() );
796 polygon.
SetNormal( deltaV.cross(v0-v2).unit() );
809 }
while( --numPhi > 0 );
823 a1(
r[1]*cosPhi,
r[1]*sinPhi,
z[1] ),
824 b0( r0*cosPhi, r0*sinPhi,
z[0] ),
825 b1( r1*cosPhi, r1*sinPhi,
z[1] );
935 if (opposite) rx = -rx;
940 G4double deltaR = rx -
r[0], deltaZ = zx -
z[0];
965 if (edgeRZnorm) *edgeRZnorm = answer;
974 while( phi <
startPhi ) phi += twopi;
982 while( phi >
startPhi ) phi -= twopi;
985 if (d2 < d1) d1 =
d2;
992 distOutside2 += dist*dist;
995 *edgeRZnorm =
std::max(std::fabs(*edgeRZnorm),std::fabs(dist));
1017 G4double rx = p.perp(), zx = p.z();
1023 if (rx < 0) part = -1;
1028 G4double deltaR = rx -
r[0]*part, deltaZ = zx -
z[0];
1048 deltaR = rx -
r[1]*part;
1056 if (edgeRZnorm) *edgeRZnorm = answer;
1065 while( phi <
startPhi ) phi += twopi;
1073 while( phi >
startPhi ) phi -= twopi;
1076 if (d2 < d1) d1 =
d2;
1083 distOutside2 += dist*dist;
1086 *edgeRZnorm =
std::max(std::fabs(*edgeRZnorm),std::fabs(dist));
1110 if (!
cone->
HitOn( rx, hit.z() ))
return false;
1121 while( phi <
startPhi-phiTolerant ) phi += twopi;
1132 qb = qx - corners[3];
1135 if (normSign*qacb.dot(v) < 0)
return false;
1137 else if (phi < phiTolerant)
1141 qb = qx - corners[0];
1144 if (normSign*qacb.dot(v) < 0)
return false;
1178 G4double deter = tx1*ty2 - tx2*ty1;
1180 G4double s1 = ((x2-x1)*ty2 - tx2*(y2-y1))/deter;
1181 G4double s2 = ((x2-x1)*ty1 - tx1*(y2-y1))/deter;
1187 x = 0.5*( x1+s1*tx1 + x2+s2*tx2 );
1188 y = 0.5*( y1+s1*ty1 + y2+s2*ty2 );
1213 dr=
r[1]-
r[0];dz=
z[1]-
z[0];
1234 zz = z[0]+(rr-r[0])*dz/dr;
G4ThreeVector GetPointOnFace()
static G4GEOM_DLL G4PlSideManager subInstanceManager
static const G4double kInfinity
CLHEP::Hep3Vector G4ThreeVector
G4bool Intersect(const G4ThreeVector &p, const G4ThreeVector &v, G4bool outgoing, G4double surfTolerance, G4double &distance, G4double &distFromSurface, G4ThreeVector &normal, G4bool &isAllBehind)
G4double GetSurfaceTolerance() const
void SetNormal(const G4ThreeVector &newNormal)
virtual G4bool PartialClip(const G4VoxelLimits &voxelLimit, const EAxis IgnoreMe)
virtual void AddVertexInOrder(const G4ThreeVector vertex)
static const G4double tolerance
EInside Inside(const G4ThreeVector &p, G4double tolerance, G4double *bestDistance)
virtual void ClearAllVertices()
G4bool HitOn(const G4double r, const G4double z)
G4double Extent(const G4ThreeVector axis)
G4ThreeVector Normal(const G4ThreeVector &p, G4double *bestDistance)
G4int LineHitsCone(const G4ThreeVector &p, const G4ThreeVector &v, G4double *s1, G4double *s2)
const G4int kMinMeshSections
G4int CreateSubInstance()
void CopyStuff(const G4PolyconeSide &source)
static void FindLineIntersect(G4double x1, G4double y1, G4double tx1, G4double ty1, G4double x2, G4double y2, G4double tx2, G4double ty2, G4double &x, G4double &y)
virtual ~G4PolyconeSide()
static double normal(HepRandomEngine *eptr)
void CalculateExtent(const EAxis axis, const G4VoxelLimits &voxelLimit, const G4AffineTransform &tranform, G4SolidExtentList &extentList)
G4PolyconeSide(const G4PolyconeSideRZ *prevRZ, const G4PolyconeSideRZ *tail, const G4PolyconeSideRZ *head, const G4PolyconeSideRZ *nextRZ, G4double phiStart, G4double deltaPhi, G4bool phiIsOpen, G4bool isAllBehind=false)
void AddSurface(const G4ClippablePolygon &surface)
static const G4PlSideManager & GetSubInstanceManager()
G4IntersectingCone * cone
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double GetPhi(const G4ThreeVector &p)
G4double DistanceAway(const G4ThreeVector &p, G4bool opposite, G4double &distOutside2, G4double *rzNorm=0)
G4bool PointOnCone(const G4ThreeVector &hit, G4double normSign, const G4ThreeVector &p, const G4ThreeVector &v, G4ThreeVector &normal)
G4double Distance(const G4ThreeVector &p, G4bool outgoing)
G4PolyconeSide & operator=(const G4PolyconeSide &source)
const G4double kMeshAngleDefault
static G4GeometryTolerance * GetInstance()
const G4int kMaxMeshSections