59 fPMin = pmin - pdelta;
60 fPMax = pmax + pdelta;
78 fPMin = pmin - pdelta;
79 fPMax = pmax + pdelta;
95 fPMin = pmin - pdelta;
96 fPMax = pmax + pdelta;
136 if (
this == &rhs) {
return *
this; }
158 pMin.
set(std::min(minA.
x(),minB.
x()),
159 std::min(minA.
y(),minB.
y()),
160 std::min(minA.
z(),minB.
z()));
162 pMax.
set(std::max(maxA.
x(),maxB.
x()),
163 std::max(maxA.
y(),maxB.
y()),
164 std::max(maxA.
z(),maxB.
z()));
168 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
170 std::ostringstream message;
171 message <<
"Bad bounding box (min >= max) for solid: "
173 <<
"\npMin = " << pMin
174 <<
"\npMax = " << pMax;
175 G4Exception(
"G4UnionSolid::BoundingLimits()",
"GeomMgt0001",
192 G4bool touchesA, touchesB, out ;
193 G4double minA = kInfinity, minB = kInfinity,
194 maxA = -kInfinity, maxB = -kInfinity;
197 pTransform, minA, maxA);
199 pTransform, minB, maxB);
200 if( touchesA || touchesB )
202 pMin = std::min( minA, minB );
203 pMax = std::max( maxA, maxB );
222 if (std::max(p.
z()-fPMax.
z(),fPMin.
z()-p.
z()) > 0)
return kOutside;
225 if (positionA ==
kInside) {
return positionA; }
227 if (positionA ==
kOutside) {
return positionB; }
229 if (positionB ==
kInside) {
return positionB; }
230 if (positionB ==
kOutside) {
return positionA; }
264 return (normalA + normalB).
unit();
268 G4String surf[3] = {
"OUTSIDE",
"SURFACE",
"INSIDE" };
269 std::ostringstream message;
270 G4int oldprc = message.precision(16);
271 message <<
"Invalid call of SurfaceNormal(p) for union solid: "
273 <<
"\nPoint p" << p <<
" is " << surf[
Inside(p)] <<
" !!!";
274 message.precision(oldprc);
275 G4Exception(
"G4UnionSolid::SurfaceNormal()",
"GeomMgt0001",
292 G4cout <<
"WARNING - Invalid call in "
293 <<
"G4UnionSolid::DistanceToIn(p,v)" <<
G4endl
294 <<
" Point p is inside !" <<
G4endl;
297 G4cerr <<
"WARNING - Invalid call in "
298 <<
"G4UnionSolid::DistanceToIn(p,v)" <<
G4endl
299 <<
" Point p is inside !" <<
G4endl;
320 G4cout <<
"WARNING - Invalid call in "
321 <<
"G4UnionSolid::DistanceToIn(p)" <<
G4endl
322 <<
" Point p is inside !" <<
G4endl;
324 G4cerr <<
"WARNING - Invalid call in "
325 <<
"G4UnionSolid::DistanceToIn(p)" <<
G4endl
326 <<
" Point p is inside !" <<
G4endl;
332 G4double safety = std::min(distA,distB) ;
333 if(safety < 0.0) safety = 0.0 ;
363 G4cout <<
"WARNING - Invalid call in "
364 <<
"G4UnionSolid::DistanceToOut(p,v)" <<
G4endl
365 <<
" Point p is outside !" <<
G4endl;
368 G4cerr <<
"WARNING - Invalid call in "
369 <<
"G4UnionSolid::DistanceToOut(p,v)" <<
G4endl
370 <<
" Point p is outside !" <<
G4endl;
435 G4cout <<
"WARNING - Invalid call in "
436 <<
"G4UnionSolid::DistanceToOut(p)" <<
G4endl
437 <<
" Point p is outside !" <<
G4endl;
439 G4cerr <<
"WARNING - Invalid call in "
440 <<
"G4UnionSolid::DistanceToOut(p)" <<
G4endl
441 <<
" Point p is outside !" <<
G4endl;
526 if (
processor.execute(*result)) {
return result; }
527 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
G4double GetRadialTolerance() const
static G4GeometryTolerance * GetInstance()
G4UnionSolid(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
EInside Inside(const G4ThreeVector &p) const
G4UnionSolid & operator=(const G4UnionSolid &rhs)
G4GeometryType GetEntityType() const
G4Polyhedron * CreatePolyhedron() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
void DescribeYourselfTo(G4VGraphicsScene &scene) const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
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