111 if (
this == &rhs) {
return *
this; }
116 fshapeName = rhs.fshapeName;
141 std::ostringstream message;
142 message <<
"Illegal call to G4VSolid::ComputeDimensions()" <<
G4endl
143 <<
"Method not overloaded by derived class !";
144 G4Exception(
"G4VSolid::ComputeDimensions()",
"GeomMgt0003",
154 std::ostringstream message;
155 message <<
"Not implemented for solid: "
157 <<
"Returning origin.";
158 G4Exception(
"G4VSolid::GetPointOnSurface()",
"GeomMgt1001",
190 G4int cubVolStatistics = 1000000;
206 G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume,halfepsilon;
223 if(nStat < 100) nStat = 100;
227 for(
auto i = 0; i < nStat; ++i )
237 * (maxZ-minZ+
epsilon)*iInside/nStat;
252 G4int stat = 1000000;
267 static const G4double s2 = 1./std::sqrt(2.);
268 static const G4double s3 = 1./std::sqrt(3.);
321 G4int npoints = (nstat < 1000) ? 1000 : nstat;
323 G4double eps = (ell > 0) ? ell : coeff * std::min(std::min(dX, dY), dZ);
338 for(
auto i = 0; i < npoints; ++i)
356 if (icase == 0)
continue;
372 if (icase == 0)
continue;
375 if (dist == kInfinity)
continue;
379 if (dist < eps) ++icount;
381 return dX*dY*dZ*icount/npoints/dd;
393 std::ostringstream message;
394 message <<
"Clone() method not implemented for type: "
396 <<
"Returning NULL pointer!";
415 const G4int pSectionIndex,
423 polygon.push_back((*pVertices)[pSectionIndex]);
424 polygon.push_back((*pVertices)[pSectionIndex+1]);
425 polygon.push_back((*pVertices)[pSectionIndex+2]);
426 polygon.push_back((*pVertices)[pSectionIndex+3]);
445 const G4int pSectionIndex,
452 polygon.push_back((*pVertices)[pSectionIndex]);
453 polygon.push_back((*pVertices)[pSectionIndex+4]);
454 polygon.push_back((*pVertices)[pSectionIndex+5]);
455 polygon.push_back((*pVertices)[pSectionIndex+1]);
459 polygon.push_back((*pVertices)[pSectionIndex+1]);
460 polygon.push_back((*pVertices)[pSectionIndex+5]);
461 polygon.push_back((*pVertices)[pSectionIndex+6]);
462 polygon.push_back((*pVertices)[pSectionIndex+2]);
466 polygon.push_back((*pVertices)[pSectionIndex+2]);
467 polygon.push_back((*pVertices)[pSectionIndex+6]);
468 polygon.push_back((*pVertices)[pSectionIndex+7]);
469 polygon.push_back((*pVertices)[pSectionIndex+3]);
473 polygon.push_back((*pVertices)[pSectionIndex+3]);
474 polygon.push_back((*pVertices)[pSectionIndex+7]);
475 polygon.push_back((*pVertices)[pSectionIndex+4]);
476 polygon.push_back((*pVertices)[pSectionIndex]);
499 noLeft = (
G4int)pPolygon.size();
503 for (i=0; i<noLeft; ++i)
505 component = pPolygon[i].operator()(pAxis);
507 if (component < pMin)
511 if (component > pMax)
551 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
555 if ( outputPolygon.empty() )
return;
559 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
561 if ( pPolygon.empty() )
return;
562 else outputPolygon.clear();
568 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
575 if ( outputPolygon.empty() )
return;
579 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
581 if ( pPolygon.empty() )
return;
582 else outputPolygon.clear();
588 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
595 if ( outputPolygon.empty() )
return;
599 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
617 auto noVertices = (
G4int)pPolygon.size();
620 for (i = 0 ; i < noVertices ; ++i )
622 vStart = pPolygon[i];
623 if ( i == noVertices-1 ) vEnd = pPolygon[0];
624 else vEnd = pPolygon[i+1];
626 if ( pVoxelLimit.
Inside(vStart) )
628 if (pVoxelLimit.
Inside(vEnd))
632 outputPolygon.push_back(vEnd);
639 outputPolygon.push_back(vEnd);
644 if (pVoxelLimit.
Inside(vEnd))
649 outputPolygon.push_back(vStart);
650 outputPolygon.push_back(vEnd);
667 std::ostringstream message;
668 message <<
"Not implemented for solid: "
670 <<
"\nReturning infinite boundinx box.";
671 G4Exception(
"G4VSolid::BoundingLimits()",
"GeomMgt1001",
674 pMin.
set(-kInfinity,-kInfinity,-kInfinity);
675 pMax.
set( kInfinity, kInfinity, kInfinity);
const G4double kCarTolerance
std::vector< G4ThreeVector > G4ThreeVectorList
G4double epsilon(G4double density, G4double temperature)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
std::ostream & operator<<(std::ostream &os, const G4VSolid &e)
Output solid information to given ostream.
std::vector< G4ThreeVector > G4ThreeVectorList
double dot(const Hep3Vector &) const
void set(double x, double y, double z)
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
static void Register(G4VSolid *pSolid)
void SetMapValid(G4bool val)
static void DeRegister(G4VSolid *pSolid)
static G4SolidStore * GetInstance()
G4double EstimateSurfaceArea(G4int nStat, G4double ell) const
virtual G4VSolid * Clone() const
virtual const G4VSolid * GetConstituentSolid(G4int no) const
virtual std::ostream & StreamInfo(std::ostream &os) const =0
void ClipBetweenSections(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
G4double EstimateCubicVolume(G4int nStat, G4double epsilon) const
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
virtual G4VisExtent GetExtent() const
G4VSolid(const G4String &name)
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
void SetName(const G4String &name)
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
virtual G4ThreeVector GetPointOnSurface() const
void ClipPolygon(G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual G4Polyhedron * GetPolyhedron() const
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
virtual G4Polyhedron * CreatePolyhedron() const
G4VSolid & operator=(const G4VSolid &rhs)
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
virtual const G4DisplacedSolid * GetDisplacedSolidPtr() const
virtual G4double GetCubicVolume()
void ClipCrossSection(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
virtual G4double GetSurfaceArea()
void CalculateClippedPolygonExtent(G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
virtual G4GeometryType GetEntityType() const =0
void SetYmin(G4double ymin)
void SetYmax(G4double ymax)
void SetXmax(G4double xmax)
void SetXmin(G4double xmin)
void SetZmax(G4double zmax)
void SetZmin(G4double zmin)
G4bool IsYLimited() const
G4bool ClipToLimits(G4ThreeVector &pStart, G4ThreeVector &pEnd) const
G4double GetMinZExtent() const
void AddLimit(const EAxis pAxis, const G4double pMin, const G4double pMax)
G4bool IsXLimited() const
G4double GetMaxYExtent() const
G4bool Inside(const G4ThreeVector &pVec) const
G4double GetMaxZExtent() const
G4double GetMinYExtent() const
G4double GetMinXExtent() const
G4bool IsZLimited() const
G4double GetMaxXExtent() const