116 if (
this == &rhs) {
return *
this; }
137 pMin.
set(std::max(minA.
x(),minB.
x()),
138 std::max(minA.
y(),minB.
y()),
139 std::max(minA.
z(),minB.
z()));
141 pMax.
set(std::min(maxA.
x(),maxB.
x()),
142 std::min(maxA.
y(),maxB.
y()),
143 std::min(maxA.
z(),maxB.
z()));
147 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
149 std::ostringstream message;
150 message <<
"Bad bounding box (min >= max) for solid: "
152 <<
"\npMin = " << pMin
153 <<
"\npMax = " << pMax;
154 G4Exception(
"G4IntersectionSolid::BoundingLimits()",
"GeomMgt0001",
181 pMin = std::max( minA, minB );
182 pMax = std::min( maxA, maxB );
200 if(positionA ==
kOutside)
return positionA;
203 if(positionA ==
kInside)
return positionB;
205 if(positionB ==
kOutside)
return positionB;
224 G4cout <<
"WARNING - Invalid call in "
225 <<
"G4IntersectionSolid::SurfaceNormal(p)" <<
G4endl
226 <<
" Point p is outside !" <<
G4endl;
228 G4cerr <<
"WARNING - Invalid call in "
229 <<
"G4IntersectionSolid::SurfaceNormal(p)" <<
G4endl
230 <<
" Point p is outside !" <<
G4endl;
256 G4cout <<
"WARNING - Invalid call in "
257 <<
"G4IntersectionSolid::SurfaceNormal(p)" <<
G4endl
258 <<
" Point p is out of surface !" <<
G4endl;
260 G4cerr <<
"WARNING - Invalid call in "
261 <<
"G4IntersectionSolid::SurfaceNormal(p)" <<
G4endl
262 <<
" Point p is out of surface !" <<
G4endl;
282 G4cout <<
"WARNING - Invalid call in "
283 <<
"G4IntersectionSolid::DistanceToIn(p,v)" <<
G4endl
284 <<
" Point p is inside !" <<
G4endl;
287 G4cerr <<
"WARNING - Invalid call in "
288 <<
"G4IntersectionSolid::DistanceToIn(p,v)" <<
G4endl
289 <<
" Point p is inside !" <<
G4endl;
302 G4bool doA =
true, doB =
true;
304 static const std::size_t max_trials=10000;
305 for (std::size_t trial=0; trial<max_trials; ++trial)
317 if( dA1 == kInfinity )
return kInfinity;
335 if(dB1 == kInfinity)
return kInfinity;
348 if( dB1 < dA2 )
return dB1;
358 if( dA1 < dB2 )
return dA1;
369 G4Exception(
"G4IntersectionSolid::DistanceToIn(p,v)",
371 "Reached maximum number of iterations! Returning zero.");
387 G4cout <<
"WARNING - Invalid call in "
388 <<
"G4IntersectionSolid::DistanceToIn(p)" <<
G4endl
389 <<
" Point p is inside !" <<
G4endl;
391 G4cerr <<
"WARNING - Invalid call in "
392 <<
"G4IntersectionSolid::DistanceToIn(p)" <<
G4endl
393 <<
" Point p is inside !" <<
G4endl;
431 G4bool validNormA, validNormB;
445 G4cout <<
"WARNING - Invalid call in "
446 <<
"G4IntersectionSolid::DistanceToOut(p,v)" <<
G4endl
447 <<
" Point p is outside !" <<
G4endl;
450 G4cerr <<
"WARNING - Invalid call in "
451 <<
"G4IntersectionSolid::DistanceToOut(p,v)" <<
G4endl
452 <<
" Point p is outside !" <<
G4endl;
460 G4double dist = std::min(distA,distB) ;
466 *validNorm = validNormA;
471 *validNorm = validNormB;
489 G4cout <<
"WARNING - Invalid call in "
490 <<
"G4IntersectionSolid::DistanceToOut(p)" <<
G4endl
491 <<
" Point p is outside !" <<
G4endl;
493 G4cerr <<
"WARNING - Invalid call in "
494 <<
"G4IntersectionSolid::DistanceToOut(p)" <<
G4endl
495 <<
" Point p is outside !" <<
G4endl;
522 return G4String(
"G4IntersectionSolid");
556 if (processor.
execute(*result)) {
return result; }
557 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
void set(double x, double y, double z)
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
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
virtual ~G4IntersectionSolid()
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4IntersectionSolid & operator=(const G4IntersectionSolid &rhs)
G4IntersectionSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
G4GeometryType GetEntityType() const
G4Polyhedron * CreatePolyhedron() const
EInside Inside(const G4ThreeVector &p) const
void DescribeYourselfTo(G4VGraphicsScene &scene) const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) 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
bool execute(HepPolyhedron &)