112 if (
this == &rhs) {
return *
this; }
117 fshapeName = rhs.fshapeName;
140 std::ostringstream message;
141 message <<
"Illegal call to G4VSolid::ComputeDimensions()" <<
G4endl
142 <<
"Method not overloaded by derived class !";
143 G4Exception(
"G4VSolid::ComputeDimensions()",
"GeomMgt0003",
153 std::ostringstream message;
154 message <<
"Not implemented for solid: "
156 <<
"Returning origin.";
157 G4Exception(
"G4VSolid::GetPointOnSurface()",
"GeomMgt1001",
216 G4int cubVolStatistics = 1000000;
232 G4double px, py, pz, volume, halfepsilon;
233 G4double minX=0., maxX=0., minY=0., maxY=0., minZ=0., maxZ=0.;
247 if(nStat < 100) { nStat = 100; }
252 for(
auto i = 0; i < nStat; ++i )
262 * (maxZ-minZ+
epsilon)*iInside/nStat;
277 G4int stat = 1000000;
292 static const G4double s2 = 1./std::sqrt(2.);
293 static const G4double s3 = 1./std::sqrt(3.);
346 G4int npoints = (nstat < 1000) ? 1000 : nstat;
348 G4double eps = (ell > 0) ? ell : coeff * std::min(std::min(dX, dY), dZ);
364 for(
auto i = 0; i < npoints; ++i)
382 if (icase == 0) {
continue; }
398 if (icase == 0) {
continue; }
401 if (dist == kInfinity) {
continue; }
405 if (dist < eps) { ++icount; }
407 return dX*dY*dZ*icount/npoints/dd;
419 std::ostringstream message;
420 message <<
"Clone() method not implemented for type: "
422 <<
"Returning NULL pointer!";
441 const G4int pSectionIndex,
449 polygon.push_back((*pVertices)[pSectionIndex]);
450 polygon.push_back((*pVertices)[pSectionIndex+1]);
451 polygon.push_back((*pVertices)[pSectionIndex+2]);
452 polygon.push_back((*pVertices)[pSectionIndex+3]);
471 const G4int pSectionIndex,
478 polygon.push_back((*pVertices)[pSectionIndex]);
479 polygon.push_back((*pVertices)[pSectionIndex+4]);
480 polygon.push_back((*pVertices)[pSectionIndex+5]);
481 polygon.push_back((*pVertices)[pSectionIndex+1]);
485 polygon.push_back((*pVertices)[pSectionIndex+1]);
486 polygon.push_back((*pVertices)[pSectionIndex+5]);
487 polygon.push_back((*pVertices)[pSectionIndex+6]);
488 polygon.push_back((*pVertices)[pSectionIndex+2]);
492 polygon.push_back((*pVertices)[pSectionIndex+2]);
493 polygon.push_back((*pVertices)[pSectionIndex+6]);
494 polygon.push_back((*pVertices)[pSectionIndex+7]);
495 polygon.push_back((*pVertices)[pSectionIndex+3]);
499 polygon.push_back((*pVertices)[pSectionIndex+3]);
500 polygon.push_back((*pVertices)[pSectionIndex+7]);
501 polygon.push_back((*pVertices)[pSectionIndex+4]);
502 polygon.push_back((*pVertices)[pSectionIndex]);
525 noLeft = (
G4int)pPolygon.size();
529 for (i=0; i<noLeft; ++i)
531 component = pPolygon[i].operator()(pAxis);
533 if (component < pMin)
537 if (component > pMax)
577 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
581 if ( outputPolygon.empty() ) {
return; }
585 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
587 if ( pPolygon.empty() ) {
return; }
588 outputPolygon.clear();
594 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
601 if ( outputPolygon.empty() ) {
return; }
605 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
607 if ( pPolygon.empty() ) {
return; }
608 outputPolygon.clear();
614 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
621 if ( outputPolygon.empty() ) {
return; }
625 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
643 auto noVertices = (
G4int)pPolygon.size();
646 for (i = 0 ; i < noVertices ; ++i )
648 vStart = pPolygon[i];
649 if ( i == noVertices-1 ) { vEnd = pPolygon[0]; }
650 else { vEnd = pPolygon[i+1]; }
652 if ( pVoxelLimit.
Inside(vStart) )
654 if (pVoxelLimit.
Inside(vEnd))
658 outputPolygon.push_back(vEnd);
665 outputPolygon.push_back(vEnd);
670 if (pVoxelLimit.
Inside(vEnd))
675 outputPolygon.push_back(vStart);
676 outputPolygon.push_back(vEnd);
693 std::ostringstream message;
694 message <<
"Not implemented for solid: "
696 <<
"\nReturning infinite boundinx box.";
697 G4Exception(
"G4VSolid::BoundingLimits()",
"GeomMgt1001",
700 pMin.
set(-kInfinity,-kInfinity,-kInfinity);
701 pMax.
set( kInfinity, kInfinity, kInfinity);
std::vector< G4ThreeVector > G4ThreeVectorList
G4double epsilon(G4double density, G4double temperature)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double G4QuickRand(uint32_t seed=0)
CLHEP::Hep3Vector G4ThreeVector
std::ostream & operator<<(std::ostream &os, const G4VSolid &e)
std::vector< G4ThreeVector > G4ThreeVectorList
double dot(const Hep3Vector &) const
void set(double x, double y, double z)
G4DisplacedSolid is a solid that has been shifted from its original frame of reference to a new one....
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
static void Register(G4VSolid *pSolid)
void SetMapValid(G4bool val)
static void DeRegister(G4VSolid *pSolid)
static G4SolidStore * GetInstance()
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
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
virtual G4bool IsFaceted() 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 G4int GetNumOfConstituents() const
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
G4double EstimateSurfaceArea(G4int nStat, G4double epsilon) 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)
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...
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