119 if (
this == &rhs) {
return *
this; }
143 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
145 std::ostringstream message;
146 message <<
"Bad bounding box (min >= max) for solid: "
148 <<
"\npMin = " << pMin
149 <<
"\npMax = " << pMax;
150 G4Exception(
"G4SubtractionSolid::BoundingLimits()",
"GeomMgt0001",
171 pTransform, pMin, pMax );
181 if (positionA ==
kOutside)
return positionA;
184 if (positionB ==
kOutside)
return positionA;
212 G4cout <<
"WARNING - Invalid call [1] in "
213 <<
"G4SubtractionSolid::SurfaceNormal(p)" <<
G4endl
214 <<
" Point p is outside !" <<
G4endl;
216 G4cerr <<
"WARNING - Invalid call [1] in "
217 <<
"G4SubtractionSolid::SurfaceNormal(p)" <<
G4endl
218 <<
" Point p is outside !" <<
G4endl;
246 G4cout <<
"WARNING - Invalid call [2] in "
247 <<
"G4SubtractionSolid::SurfaceNormal(p)" <<
G4endl
248 <<
" Point p is inside !" <<
G4endl;
250 G4cerr <<
"WARNING - Invalid call [2] in "
251 <<
"G4SubtractionSolid::SurfaceNormal(p)" <<
G4endl
252 <<
" Point p is inside !" <<
G4endl;
268 G4double dist = 0.0, dist2 = 0.0, disTmp = 0.0;
273 G4cout <<
"WARNING - Invalid call in "
274 <<
"G4SubtractionSolid::DistanceToIn(p,v)" <<
G4endl
275 <<
" Point p is inside !" <<
G4endl;
278 G4cerr <<
"WARNING - Invalid call in "
279 <<
"G4SubtractionSolid::DistanceToIn(p,v)" <<
G4endl
280 <<
" Point p is inside !" <<
G4endl;
298 if(disTmp == kInfinity)
308 if (dist == dist2) {
return dist; }
317 ->GetConstituentMovedSolid()->GetName();
319 std::ostringstream message;
320 message <<
"Illegal condition caused by solids: "
322 message.precision(16);
323 message <<
"Looping detected in point " << p+dist*v
324 <<
", from original point " << p
325 <<
" and direction " << v <<
G4endl
326 <<
"Computed candidate distance: " << dist <<
"*mm. ";
327 message.precision(6);
329 G4Exception(
"G4SubtractionSolid::DistanceToIn(p,v)",
331 "Returning candidate distance.");
343 if( dist == kInfinity )
359 if(disTmp == kInfinity)
364 if (dist == dist2) {
return dist; }
373 ->GetConstituentMovedSolid()->GetName();
375 std::ostringstream message;
376 message <<
"Illegal condition caused by solids: "
378 message.precision(16);
379 message <<
"Looping detected in point " << p+dist*v
380 <<
", from original point " << p
381 <<
" and direction " << v <<
G4endl
382 <<
"Computed candidate distance: " << dist <<
"*mm. ";
383 message.precision(6);
385 G4Exception(
"G4SubtractionSolid::DistanceToIn(p,v)",
387 "Returning candidate distance.");
412 G4cout <<
"WARNING - Invalid call in "
413 <<
"G4SubtractionSolid::DistanceToIn(p)" <<
G4endl
414 <<
" Point p is inside !" <<
G4endl;
416 G4cerr <<
"WARNING - Invalid call in "
417 <<
"G4SubtractionSolid::DistanceToIn(p)" <<
G4endl
418 <<
" Point p is inside !" <<
G4endl;
458 G4cout <<
"WARNING - Invalid call in "
459 <<
"G4SubtractionSolid::DistanceToOut(p,v)" <<
G4endl
460 <<
" Point p is outside !" <<
G4endl;
463 G4cerr <<
"WARNING - Invalid call in "
464 <<
"G4SubtractionSolid::DistanceToOut(p,v)" <<
G4endl
465 <<
" Point p is outside !" <<
G4endl;
502 G4cout <<
"WARNING - Invalid call in "
503 <<
"G4SubtractionSolid::DistanceToOut(p)" <<
G4endl
504 <<
" Point p is outside" <<
G4endl;
506 G4cerr <<
"WARNING - Invalid call in "
507 <<
"G4SubtractionSolid::DistanceToOut(p)" <<
G4endl
508 <<
" Point p is outside" <<
G4endl;
526 return G4String(
"G4SubtractionSolid");
571 if (
processor.execute(*result)) {
return result; }
572 else {
return nullptr; }
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 * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
virtual ~G4SubtractionSolid()
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
G4SubtractionSolid & operator=(const G4SubtractionSolid &rhs)
void DescribeYourselfTo(G4VGraphicsScene &scene) const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4Polyhedron * CreatePolyhedron() const
G4GeometryType GetEntityType() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const
G4SubtractionSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
EInside Inside(const G4ThreeVector &p) const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
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 G4GeometryType GetEntityType() const =0