117 if (
this == &rhs) {
return *
this; }
141 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
143 std::ostringstream message;
144 message <<
"Bad bounding box (min >= max) for solid: "
146 <<
"\npMin = " << pMin
147 <<
"\npMax = " << pMax;
148 G4Exception(
"G4SubtractionSolid::BoundingLimits()",
"GeomMgt0001",
168 return fPtrSolidA->CalculateExtent( pAxis, pVoxelLimit,
169 pTransform, pMin, pMax );
179 if (positionA ==
kOutside) {
return positionA; }
182 if (positionB ==
kOutside) {
return positionA; }
210 G4cout <<
"WARNING - Invalid call [1] in "
211 <<
"G4SubtractionSolid::SurfaceNormal(p)" <<
G4endl
212 <<
" Point p is outside !" <<
G4endl;
214 G4cerr <<
"WARNING - Invalid call [1] in "
215 <<
"G4SubtractionSolid::SurfaceNormal(p)" <<
G4endl
216 <<
" Point p is outside !" <<
G4endl;
244 G4cout <<
"WARNING - Invalid call [2] in "
245 <<
"G4SubtractionSolid::SurfaceNormal(p)" <<
G4endl
246 <<
" Point p is inside !" <<
G4endl;
248 G4cerr <<
"WARNING - Invalid call [2] in "
249 <<
"G4SubtractionSolid::SurfaceNormal(p)" <<
G4endl
250 <<
" Point p is inside !" <<
G4endl;
266 G4double dist = 0.0, dist2 = 0.0, disTmp = 0.0;
271 G4cout <<
"WARNING - Invalid call in "
272 <<
"G4SubtractionSolid::DistanceToIn(p,v)" <<
G4endl
273 <<
" Point p is inside !" <<
G4endl;
276 G4cerr <<
"WARNING - Invalid call in "
277 <<
"G4SubtractionSolid::DistanceToIn(p,v)" <<
G4endl
278 <<
" Point p is inside !" <<
G4endl;
294 disTmp =
fPtrSolidA->DistanceToIn(p+dist*v,v) ;
296 if(disTmp == kInfinity)
304 disTmp =
fPtrSolidB->DistanceToOut(p+dist*v,v) ;
306 if (dist == dist2) {
return dist; }
312 if(
fPtrSolidB->GetEntityType()==
"G4DisplacedSolid")
315 ->GetConstituentMovedSolid()->GetName();
317 std::ostringstream message;
318 message <<
"Illegal condition caused by solids: "
320 message.precision(16);
321 message <<
"Looping detected in point " << p+dist*v
322 <<
", from original point " << p
323 <<
" and direction " << v <<
G4endl
324 <<
"Computed candidate distance: " << dist <<
"*mm. ";
325 message.precision(6);
327 G4Exception(
"G4SubtractionSolid::DistanceToIn(p,v)",
329 "Returning candidate distance.");
341 if( dist == kInfinity )
349 disTmp =
fPtrSolidB->DistanceToOut(p+dist*v,v) ;
354 disTmp =
fPtrSolidA->DistanceToIn(p+dist*v,v) ;
356 if(disTmp == kInfinity)
361 if (dist == dist2) {
return dist; }
367 if(
fPtrSolidB->GetEntityType()==
"G4DisplacedSolid")
370 ->GetConstituentMovedSolid()->GetName();
372 std::ostringstream message;
373 message <<
"Illegal condition caused by solids: "
375 message.precision(16);
376 message <<
"Looping detected in point " << p+dist*v
377 <<
", from original point " << p
378 <<
" and direction " << v <<
G4endl
379 <<
"Computed candidate distance: " << dist <<
"*mm. ";
380 message.precision(6);
382 G4Exception(
"G4SubtractionSolid::DistanceToIn(p,v)",
384 "Returning candidate distance.");
408 G4cout <<
"WARNING - Invalid call in "
409 <<
"G4SubtractionSolid::DistanceToIn(p)" <<
G4endl
410 <<
" Point p is inside !" <<
G4endl;
412 G4cerr <<
"WARNING - Invalid call in "
413 <<
"G4SubtractionSolid::DistanceToIn(p)" <<
G4endl
414 <<
" Point p is inside !" <<
G4endl;
454 G4cout <<
"WARNING - Invalid call in "
455 <<
"G4SubtractionSolid::DistanceToOut(p,v)" <<
G4endl
456 <<
" Point p is outside !" <<
G4endl;
459 G4cerr <<
"WARNING - Invalid call in "
460 <<
"G4SubtractionSolid::DistanceToOut(p,v)" <<
G4endl
461 <<
" Point p is outside !" <<
G4endl;
474 *n = -(
fPtrSolidB->SurfaceNormal(p+distB*v)) ;
498 G4cout <<
"WARNING - Invalid call in "
499 <<
"G4SubtractionSolid::DistanceToOut(p)" <<
G4endl
500 <<
" Point p is outside" <<
G4endl;
502 G4cerr <<
"WARNING - Invalid call in "
503 <<
"G4SubtractionSolid::DistanceToOut(p)" <<
G4endl
504 <<
" Point p is outside" <<
G4endl;
522 return {
"G4SubtractionSolid"};
544 G4Exception(
"G4SubtractionSolid::ComputeDimensions()",
546 "Method not applicable in this context!");
572 if (processor.
execute(*result))
600 bminA.
x() >= bmaxB.
x() || bminA.
y() >= bmaxB.
y() || bminA.
z() >= bmaxB.
z() ||
601 bminB.
x() >= bmaxA.
x() || bminB.
y() >= bmaxA.
y() || bminB.
z() >= bmaxA.
z();
G4TemplateAutoLock< G4RecursiveMutex > G4RecursiveAutoLock
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::HepRotation G4RotationMatrix
#define G4MUTEX_INITIALIZER
std::recursive_mutex G4RecursiveMutex
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
void SetCubVolEpsilon(G4double ep)
G4double GetCubVolEpsilon() const
G4double GetCubicVolume() override
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
G4int GetCubVolStatistics() const
G4int GetNumOfConstituents() const override
static G4VBooleanProcessor * fExternalBoolProcessor
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
void SetCubVolStatistics(G4int st)
G4DisplacedSolid is a solid that has been shifted from its original frame of reference to a new one....
G4IntersectionSolid is a solid describing the Boolean intersection of two solids.
G4SubtractionSolid is a solid describing the Boolean subtraction of two solids.
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
G4double GetCubicVolume() final
G4VSolid * Clone() const override
G4SubtractionSolid & operator=(const G4SubtractionSolid &rhs)
EInside Inside(const G4ThreeVector &p) const override
G4GeometryType GetEntityType() const override
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const override
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
G4SubtractionSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
G4Polyhedron * CreatePolyhedron() const override
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
virtual void AddSolid(const G4Box &)=0
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(const G4String &name)
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...
bool execute(HepPolyhedron &)