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",
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;
296 if(disTmp == kInfinity)
306 if (dist == dist2) {
return dist; }
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 )
357 if(disTmp == kInfinity)
362 if (dist == dist2) {
return dist; }
371 ->GetConstituentMovedSolid()->GetName();
373 std::ostringstream message;
374 message <<
"Illegal condition caused by solids: "
376 message.precision(16);
377 message <<
"Looping detected in point " << p+dist*v
378 <<
", from original point " << p
379 <<
" and direction " << v <<
G4endl
380 <<
"Computed candidate distance: " << dist <<
"*mm. ";
381 message.precision(6);
383 G4Exception(
"G4SubtractionSolid::DistanceToIn(p,v)",
385 "Returning candidate distance.");
410 G4cout <<
"WARNING - Invalid call in "
411 <<
"G4SubtractionSolid::DistanceToIn(p)" <<
G4endl
412 <<
" Point p is inside !" <<
G4endl;
414 G4cerr <<
"WARNING - Invalid call in "
415 <<
"G4SubtractionSolid::DistanceToIn(p)" <<
G4endl
416 <<
" Point p is inside !" <<
G4endl;
456 G4cout <<
"WARNING - Invalid call in "
457 <<
"G4SubtractionSolid::DistanceToOut(p,v)" <<
G4endl
458 <<
" Point p is outside !" <<
G4endl;
461 G4cerr <<
"WARNING - Invalid call in "
462 <<
"G4SubtractionSolid::DistanceToOut(p,v)" <<
G4endl
463 <<
" Point p is outside !" <<
G4endl;
500 G4cout <<
"WARNING - Invalid call in "
501 <<
"G4SubtractionSolid::DistanceToOut(p)" <<
G4endl
502 <<
" Point p is outside" <<
G4endl;
504 G4cerr <<
"WARNING - Invalid call in "
505 <<
"G4SubtractionSolid::DistanceToOut(p)" <<
G4endl
506 <<
" Point p is outside" <<
G4endl;
524 return {
"G4SubtractionSolid"};
570 if (processor.
execute(*result))
606 bminA.
x() < bmaxB.
x() && bminA.
y() < bmaxB.
y() && bminA.
z() < bmaxB.
z() &&
607 bminB.
x() < bmaxA.
x() && bminB.
y() < bmaxA.
y() && bminB.
z() < bmaxA.
z();
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
G4Polyhedron * GetPolyhedron() const override
const G4VSolid * GetConstituentSolid(G4int no) const override
G4double GetCubicVolume() override
static G4VBooleanProcessor * fExternalBoolProcessor
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
void SetCubVolStatistics(G4int st)
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
~G4SubtractionSolid() override
G4Polyhedron * CreatePolyhedron() const override
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
virtual G4PolyhedronArbitrary * Subtraction(G4Polyhedron *, G4Polyhedron *)
virtual void AddSolid(const G4Box &)=0
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
virtual G4double GetCubicVolume()
virtual G4GeometryType GetEntityType() const =0
bool execute(HepPolyhedron &)