65 return subInstanceManager;
82 : ncorners(0), corners(0)
95 r[0] = tail->
r;
z[0] = tail->
z;
96 r[1] = head->
r;
z[1] = head->
z;
160 zNormEdge[0] /= lAdj;
172 zNormEdge[1] /= lAdj;
181 : startPhi(0.), deltaPhi(0.), phiIsOpen(false), allBehind(false),
182 cone(0), rNorm(0.), zNorm(0.), rS(0.), zS(0.), length(0.),
183 prevRS(0.), prevZS(0.), nextRS(0.), nextZS(0.), ncorners(0), corners(0),
184 kCarTolerance(0.), fSurfaceArea(0.), instanceID(0)
220 if (
this == &source) {
return *
this; }
246 kCarTolerance = source.kCarTolerance;
247 fSurfaceArea = source.fSurfaceArea;
292 G4double normSign = outgoing ? +1 : -1;
300 if (nside == 0)
return false;
312 if (normSign*v.dot(normal) > 0)
329 if (normSign*v.dot(pNormal) > 0)
335 distFromSurface = -normSign*
DistanceAway( p,
false, distOutside2 );
336 if (distOutside2 < surfTolerance*surfTolerance)
338 if (distFromSurface > -surfTolerance)
350 distFromSurface = s1;
363 if (nside==1)
return false;
375 if (normSign*v.dot(normal) > 0)
380 if (normSign*v.dot(pNormal) > 0)
383 distFromSurface = -normSign*
DistanceAway( p,
false, distOutside2 );
384 if (distOutside2 < surfTolerance*surfTolerance)
386 if (distFromSurface > -surfTolerance)
394 distFromSurface = s2;
413 G4double normSign = outgoing ? -1 : +1;
420 if (distFrom > -0.5*kCarTolerance )
426 return std::sqrt( distFrom*distFrom + distOut2 );
428 return std::fabs(distFrom);
435 if (distFrom > -0.5*kCarTolerance)
439 return std::sqrt( distFrom*distFrom + distOut2 );
441 return std::fabs(distFrom);
458 G4double distFrom[2], distOut2[2], dist2[2];
461 distFrom[0] =
DistanceAway( p,
false, distOut2[0], edgeRZnorm );
462 distFrom[1] =
DistanceAway( p,
true, distOut2[1], edgeRZnorm+1 );
464 dist2[0] = distFrom[0]*distFrom[0] + distOut2[0];
465 dist2[1] = distFrom[1]*distFrom[1] + distOut2[1];
470 G4int i = std::fabs(dist2[0]) < std::fabs(dist2[1]) ? 0 : 1;
472 *bestDistance = std::sqrt( dist2[i] );
477 if ( (std::fabs(edgeRZnorm[i]) < tolerance)
478 && (distOut2[i] < tolerance*tolerance) )
480 else if (edgeRZnorm[i] < 0)
499 *bestDistance = std::sqrt( dFrom*dFrom + dOut2 );
546 if (bd > ad) ad = bd;
547 if (cd > ad) ad = cd;
548 if (dd > ad) ad = dd;
604 G4double rFudge = 1.0/std::cos(0.5*sigPhi);
734 cosPhi = std::cos(phi),
735 sinPhi = std::sin(phi);
738 v1( r1*cosPhi, r1*sinPhi, z1 ),
753 cosPhi = std::cos(phi),
754 sinPhi = std::sin(phi);
817 }
while( --numPhi > 0 );
831 a1(
r[1]*cosPhi,
r[1]*sinPhi,
z[1] ),
832 b0( r0*cosPhi, r0*sinPhi,
z[0] ),
833 b1( r1*cosPhi, r1*sinPhi,
z[1] );
941 if (opposite) rx = -rx;
946 G4double deltaR = rx -
r[0], deltaZ = zx -
z[0];
971 if (edgeRZnorm) *edgeRZnorm = answer;
991 if (d2 < d1) d1 = d2;
998 distOutside2 += dist*dist;
1001 *edgeRZnorm =
std::max(std::fabs(*edgeRZnorm),std::fabs(dist));
1025 if (!
cone->
HitOn( rx, hit.
z() ))
return false;
1029 G4double phiTolerant = 2.0*kCarTolerance/(rx+kCarTolerance);
1047 qb = qx - corners[3];
1050 if (normSign*qacb.
dot(v) < 0)
return false;
1052 else if (phi < phiTolerant)
1056 qb = qx - corners[0];
1059 if (normSign*qacb.
dot(v) < 0)
return false;
1093 G4double deter = tx1*ty2 - tx2*ty1;
1095 G4double s1 = ((x2-x1)*ty2 - tx2*(y2-y1))/deter;
1096 G4double s2 = ((x2-x1)*ty1 - tx1*(y2-y1))/deter;
1102 x = 0.5*( x1+s1*tx1 + x2+s2*tx2 );
1103 y = 0.5*( y1+s1*ty1 + y2+s2*ty2 );
1113 fSurfaceArea = (
r[0]+
r[1])* std::sqrt(
sqr(
r[0]-
r[1])+
sqr(
z[0]-
z[1]));
1116 return fSurfaceArea;
1126 dr=
r[1]-
r[0];dz=
z[1]-
z[0];
1147 zz = z[0]+(rr-r[0])*dz/dr;
G4ThreeVector GetPointOnFace()
CLHEP::Hep3Vector G4ThreeVector
double dot(const Hep3Vector &) const
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)
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()
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)
Hep3Vector cross(const Hep3Vector &) const
G4double Distance(const G4ThreeVector &p, G4bool outgoing)
G4PolyconeSide & operator=(const G4PolyconeSide &source)
const G4double kMeshAngleDefault
static G4GeometryTolerance * GetInstance()
const G4int kMaxMeshSections