44 #if !defined(G4GEOM_USE_UBOX) 
   71     std::ostringstream message;
 
   72     message << 
"Dimensions too small for Solid: " << 
GetName() << 
"!" << 
G4endl 
   73             << 
"     hX, hY, hZ = " << pX << 
", " << pY << 
", " << pZ;
 
   84   : 
G4CSGSolid(a), fDx(0.), fDy(0.), fDz(0.), delta(0.)
 
  101   : 
G4CSGSolid(rhs), fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz), delta(rhs.delta)
 
  113    if (
this == &rhs)  { 
return *
this; }
 
  139     std::ostringstream message;
 
  140     message << 
"Dimension X too small for solid: " << 
GetName() << 
"!" 
  143     G4Exception(
"G4Box::SetXHalfLength()", 
"GeomSolids0002",
 
  159     std::ostringstream message;
 
  160     message << 
"Dimension Y too small for solid: " << 
GetName() << 
"!" 
  163     G4Exception(
"G4Box::SetYHalfLength()", 
"GeomSolids0002",
 
  179     std::ostringstream message;
 
  180     message << 
"Dimension Z too small for solid: " << 
GetName() << 
"!" 
  183     G4Exception(
"G4Box::SetZHalfLength()", 
"GeomSolids0002",
 
  223     xMin    = xoffset - 
fDx ;
 
  224     xMax    = xoffset + 
fDx ;
 
  237     yMin    = yoffset - 
fDy ;
 
  238     yMax    = yoffset + 
fDy ;
 
  251     zMin    = zoffset - 
fDz ;
 
  252     zMax    = zoffset + 
fDz ;
 
  288     G4bool existsAfterClip = false ;
 
  301     if (pVoxelLimit.
IsLimited(pAxis) == 
false) 
 
  305         existsAfterClip = true ;
 
  322         existsAfterClip = true ;
 
  357         existsAfterClip = true ;
 
  363     return existsAfterClip;
 
  374   G4ThreeVector q(std::fabs(p.x()), std::fabs(p.y()), std::fabs(p.z()));
 
  411   distx = std::fabs(std::fabs(p.x()) - 
fDx) ;
 
  412   disty = std::fabs(std::fabs(p.y()) - 
fDy) ;
 
  413   distz = std::fabs(std::fabs(p.z()) - 
fDz) ;
 
  425   G4ThreeVector normX(0.,0.,0.), normY(0.,0.,0.), normZ(0.,0.,0.);
 
  432     if ( p.x() >= 0. )  { normX= nX ; }       
 
  440     if ( p.y() >= 0. )  { normY= nY;  }       
 
  448     if ( p.z() >= 0. )  { normZ= nZ;  }       
 
  453   static const G4double invSqrt2 = 1.0 / std::sqrt(2.0); 
 
  454   static const G4double invSqrt3 = 1.0 / std::sqrt(3.0); 
 
  458     if( noSurfaces == 1 )
 
  465       if( noSurfaces == 2 )
 
  468         norm = invSqrt2 * sumnorm; 
 
  473         norm = invSqrt3 * sumnorm; 
 
  481                  "Point p is not on surface !?" );
 
  501   distx = std::fabs(std::fabs(p.x()) - 
fDx) ;
 
  502   disty = std::fabs(std::fabs(p.y()) - 
fDy) ;
 
  503   distz = std::fabs(std::fabs(p.z()) - 
fDz) ;
 
  505   if ( distx <= disty )
 
  507     if ( distx <= distz )     
 
  520     if ( disty <= distz )      
 
  564   safx = std::fabs(p.x()) - 
fDx ;     
 
  565   safy = std::fabs(p.y()) - 
fDy ;
 
  566   safz = std::fabs(p.z()) - 
fDz ;
 
  573   if (    ((p.x()*v.x() >= 0.0) && (safx > -
delta)) 
 
  574        || ((p.y()*v.y() >= 0.0) && (safy > -
delta))
 
  575        || ((p.z()*v.z() >= 0.0) && (safz > -
delta))   ) 
 
  585     stmp = 1.0/std::fabs(v.x()) ;
 
  590       smax = (
fDx+std::fabs(p.x()))*stmp ;
 
  594       if (v.x() < 0)  { sOut = (
fDx + p.x())*stmp ; }
 
  595       else            { sOut = (
fDx - p.x())*stmp ; }
 
  603     stmp = 1.0/std::fabs(v.y()) ;
 
  608       smaxy = (
fDy+std::fabs(p.y()))*stmp ;
 
  610       if (sminy > smin) { smin=sminy ; }
 
  611       if (smaxy < smax) { smax=smaxy ; }
 
  613       if (smin >= (smax-
delta))
 
  620       if (v.y() < 0)  { sOuty = (
fDy + p.y())*stmp ; }
 
  621       else            { sOuty = (
fDy - p.y())*stmp ; }
 
  622       if( sOuty < sOut ) { sOut = sOuty ; }
 
  630     stmp = 1.0/std::fabs(v.z()) ;
 
  635       smaxz = (
fDz+std::fabs(p.z()))*stmp ;
 
  637       if (sminz > smin) { smin = sminz ; }
 
  638       if (smaxz < smax) { smax = smaxz ; }
 
  640       if (smin >= (smax-
delta))
 
  647       if (v.z() < 0)  { sOutz = (
fDz + p.z())*stmp ; }
 
  648       else            { sOutz = (
fDz - p.z())*stmp ; }
 
  649       if( sOutz < sOut ) { sOut = sOutz ; }
 
  653   if (sOut <= (smin + 
delta)) 
 
  657   if (smin < 
delta)  { smin = 0.0 ; }
 
  671   G4double safex, safey, safez, safe = 0.0 ;
 
  673   safex = std::fabs(p.x()) - 
fDx ;
 
  674   safey = std::fabs(p.y()) - 
fDy ;
 
  675   safez = std::fabs(p.z()) - 
fDz ;
 
  677   if (safex > safe) { safe = safex ; }
 
  678   if (safey > safe) { safe = safey ; }
 
  679   if (safez > safe) { safe = safez ; }
 
  699   if (calcNorm) { *validNorm = true ; }  
 
  703     pdist = 
fDx - p.x() ;
 
  718     pdist = 
fDx + p.x() ;
 
  722       snxt = -pdist/v.x() ;
 
  754     pdist = 
fDy + p.y() ;
 
  839         std::ostringstream message;
 
  840         G4int oldprc = message.precision(16);
 
  841         message << 
"Undefined side for valid surface normal to solid." 
  843                 << 
"Position:"  << G4endl << G4endl
 
  844                 << 
"p.x() = "   << p.x()/
mm << 
" mm" << G4endl
 
  845                 << 
"p.y() = "   << p.y()/
mm << 
" mm" << G4endl
 
  846                 << 
"p.z() = "   << p.z()/
mm << 
" mm" << G4endl << G4endl
 
  847                 << 
"Direction:" << G4endl << G4endl
 
  848                 << 
"v.x() = "   << v.x() << G4endl
 
  849                 << 
"v.y() = "   << v.y() << G4endl
 
  850                 << 
"v.z() = "   << v.z() << G4endl << G4endl
 
  851                 << 
"Proposed distance :" << G4endl << G4endl
 
  852                 << 
"snxt = "    << snxt/
mm << 
" mm" << 
G4endl;
 
  853         message.precision(oldprc);
 
  854         G4Exception(
"G4Box::DistanceToOut(p,v,..)", 
"GeomSolids1002",
 
  869   G4double safx1,safx2,safy1,safy2,safz1,safz2,safe=0.0;
 
  881      G4cout.precision(oldprc) ;
 
  882      G4Exception(
"G4Box::DistanceToOut(p)", 
"GeomSolids1002",
 
  887   safx1 = 
fDx - p.x() ;
 
  888   safx2 = 
fDx + p.x() ;
 
  889   safy1 = 
fDy - p.y() ;
 
  890   safy2 = 
fDy + p.y() ;
 
  891   safz1 = 
fDz - p.z() ;
 
  892   safz2 = 
fDz + p.z() ;  
 
  896   if (safx2 < safx1) { safe = safx2; }
 
  897   else               { safe = safx1; }
 
  898   if (safy1 < safe)  { safe = safy1; }
 
  899   if (safy2 < safe)  { safe = safy2; }
 
  900   if (safz1 < safe)  { safe = safz1; }
 
  901   if (safz2 < safe)  { safe = safz2; }
 
  903   if (safe < 0) { safe = 0 ; }
 
  923     vertices->reserve(8);
 
  947                 "Error in allocation of vertices. Out of memory !");
 
  967   G4int oldprc = os.precision(16);
 
  968   os << 
"-----------------------------------------------------------\n" 
  969      << 
"    *** Dump for solid - " << 
GetName() << 
" ***\n" 
  970      << 
"    ===================================================\n" 
  971      << 
" Solid type: G4Box\n" 
  973      << 
"    half length X: " << 
fDx/
mm << 
" mm \n" 
  974      << 
"    half length Y: " << 
fDy/
mm << 
" mm \n" 
  975      << 
"    half length Z: " << 
fDz/
mm << 
" mm \n" 
  976      << 
"-----------------------------------------------------------\n";
 
  977   os.precision(oldprc);
 
  994   sumS   = Sxy + Sxz + Syz;
 
 1005   else if ( ( select - Sxy ) < Sxz ) 
 
 1030   return new G4Box(*
this);
 
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
G4ThreeVector GetPointOnSurface() const 
 
void ClipCrossSection(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const 
 
void SetZHalfLength(G4double dz)
 
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const 
 
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const 
 
static const G4double kInfinity
 
G4double GetMinYExtent() const 
 
CLHEP::Hep3Vector G4ThreeVector
 
G4Box & operator=(const G4Box &rhs)
 
G4bool fRebuildPolyhedron
 
G4bool IsYLimited() const 
 
G4GeometryType GetEntityType() const 
 
void DescribeYourselfTo(G4VGraphicsScene &scene) const 
 
G4Box(const G4String &pName, G4double pX, G4double pY, G4double pZ)
 
G4bool IsXLimited() const 
 
G4VisExtent GetExtent() const 
 
virtual void AddSolid(const G4Box &)=0
 
G4Polyhedron * CreatePolyhedron() const 
 
std::ostream & StreamInfo(std::ostream &os) const 
 
G4double GetMaxXExtent() const 
 
G4double GetMinZExtent() const 
 
G4GLOB_DLL std::ostream G4cout
 
std::vector< G4ThreeVector > G4ThreeVectorList
 
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const 
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const 
 
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const 
 
G4double GetMinXExtent() const 
 
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const 
 
EInside Inside(const G4ThreeVector &p) const 
 
G4double GetMaxZExtent() const 
 
T max(const T t1, const T t2)
brief Return the largest of the two arguments 
 
void SetYHalfLength(G4double dy)
 
T min(const T t1, const T t2)
brief Return the smallest of the two arguments 
 
void SetXHalfLength(G4double dx)
 
G4double GetMaxYExtent() const 
 
G4double GetMaxExtent(const EAxis pAxis) const 
 
G4CSGSolid & operator=(const G4CSGSolid &rhs)
 
G4bool IsZLimited() const 
 
void ClipBetweenSections(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const 
 
G4double GetMinExtent(const EAxis pAxis) const 
 
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const