106 if (
this == &rhs) {
return *
this; }
127 pMin.
set(std::max(minA.
x(),minB.
x()),
128 std::max(minA.
y(),minB.
y()),
129 std::max(minA.
z(),minB.
z()));
131 pMax.
set(std::min(maxA.
x(),maxB.
x()),
132 std::min(maxA.
y(),maxB.
y()),
133 std::min(maxA.
z(),maxB.
z()));
137 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
139 std::ostringstream message;
140 message <<
"Bad bounding box (min >= max) for solid: "
142 <<
"\npMin = " << pMin
143 <<
"\npMax = " << pMax;
144 G4Exception(
"G4IntersectionSolid::BoundingLimits()",
"GeomMgt0001",
165 ->CalculateExtent( pAxis, pVoxelLimit, pTransform, minA, maxA);
167 ->CalculateExtent( pAxis, pVoxelLimit, pTransform, minB, maxB);
171 pMin = std::max( minA, minB );
172 pMax = std::min( maxA, maxB );
190 if(positionA ==
kOutside) {
return positionA; }
193 if(positionA ==
kInside) {
return positionB; }
195 if(positionB ==
kOutside) {
return positionB; }
215 G4cout <<
"WARNING - Invalid call in "
216 <<
"G4IntersectionSolid::SurfaceNormal(p)" <<
G4endl
217 <<
" Point p is outside !" <<
G4endl;
219 G4cerr <<
"WARNING - Invalid call in "
220 <<
"G4IntersectionSolid::SurfaceNormal(p)" <<
G4endl
221 <<
" Point p is outside !" <<
G4endl;
247 G4cout <<
"WARNING - Invalid call in "
248 <<
"G4IntersectionSolid::SurfaceNormal(p)" <<
G4endl
249 <<
" Point p is out of surface !" <<
G4endl;
251 G4cerr <<
"WARNING - Invalid call in "
252 <<
"G4IntersectionSolid::SurfaceNormal(p)" <<
G4endl
253 <<
" Point p is out of surface !" <<
G4endl;
273 G4cout <<
"WARNING - Invalid call in "
274 <<
"G4IntersectionSolid::DistanceToIn(p,v)" <<
G4endl
275 <<
" Point p is inside !" <<
G4endl;
278 G4cerr <<
"WARNING - Invalid call in "
279 <<
"G4IntersectionSolid::DistanceToIn(p,v)" <<
G4endl
280 <<
" Point p is inside !" <<
G4endl;
293 G4bool doA =
true, doB =
true;
295 static const std::size_t max_trials=10000;
296 for (std::size_t trial=0; trial<max_trials; ++trial)
308 if( dA1 == kInfinity ) {
return kInfinity; }
326 if(dB1 == kInfinity) {
return kInfinity; }
339 if( dB1 < dA2 ) {
return dB1; }
349 if( dA1 < dB2 ) {
return dA1; }
360 G4Exception(
"G4IntersectionSolid::DistanceToIn(p,v)",
362 "Reached maximum number of iterations! Returning zero.");
378 G4cout <<
"WARNING - Invalid call in "
379 <<
"G4IntersectionSolid::DistanceToIn(p)" <<
G4endl
380 <<
" Point p is inside !" <<
G4endl;
382 G4cerr <<
"WARNING - Invalid call in "
383 <<
"G4IntersectionSolid::DistanceToIn(p)" <<
G4endl
384 <<
" Point p is inside !" <<
G4endl;
422 G4bool validNormA, validNormB;
436 G4cout <<
"WARNING - Invalid call in "
437 <<
"G4IntersectionSolid::DistanceToOut(p,v)" <<
G4endl
438 <<
" Point p is outside !" <<
G4endl;
441 G4cerr <<
"WARNING - Invalid call in "
442 <<
"G4IntersectionSolid::DistanceToOut(p,v)" <<
G4endl
443 <<
" Point p is outside !" <<
G4endl;
451 G4double dist = std::min(distA,distB) ;
457 *validNorm = validNormA;
462 *validNorm = validNormB;
480 G4cout <<
"WARNING - Invalid call in "
481 <<
"G4IntersectionSolid::DistanceToOut(p)" <<
G4endl
482 <<
" Point p is outside !" <<
G4endl;
484 G4cerr <<
"WARNING - Invalid call in "
485 <<
"G4IntersectionSolid::DistanceToOut(p)" <<
G4endl
486 <<
" Point p is outside !" <<
G4endl;
506 G4Exception(
"G4IntersectionSolid::ComputeDimensions()",
508 "Method not applicable in this context!");
517 return {
"G4IntersectionSolid"};
553 if (processor.
execute(*result))
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::HepRotation G4RotationMatrix
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
static G4VBooleanProcessor * fExternalBoolProcessor
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
G4IntersectionSolid is a solid describing the Boolean intersection of two solids.
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4GeometryType GetEntityType() const override
G4Polyhedron * CreatePolyhedron() const override
G4IntersectionSolid & operator=(const G4IntersectionSolid &rhs)
G4IntersectionSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
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
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
EInside Inside(const G4ThreeVector &p) const override
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
G4VSolid * Clone() 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 &)