Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4UnionSolid Class Reference

#include <G4UnionSolid.hh>

+ Inheritance diagram for G4UnionSolid:

Public Member Functions

 G4UnionSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
 
 G4UnionSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB, G4RotationMatrix *rotMatrix, const G4ThreeVector &transVector)
 
 G4UnionSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB, const G4Transform3D &transform)
 
 ~G4UnionSolid () override
 
G4GeometryType GetEntityType () const override
 
G4VSolidClone () const override
 
 G4UnionSolid (__void__ &)
 
 G4UnionSolid (const G4UnionSolid &rhs)
 
G4UnionSolidoperator= (const G4UnionSolid &rhs)
 
void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const override
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const override
 
EInside Inside (const G4ThreeVector &p) const override
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const override
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const override
 
G4double DistanceToIn (const G4ThreeVector &p) const override
 
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
 
G4double DistanceToOut (const G4ThreeVector &p) const override
 
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const override
 
G4PolyhedronCreatePolyhedron () const override
 
G4double GetCubicVolume () final
 
- Public Member Functions inherited from G4BooleanSolid
 G4BooleanSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
 
 G4BooleanSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB, G4RotationMatrix *rotMatrix, const G4ThreeVector &transVector)
 
 G4BooleanSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB, const G4Transform3D &transform)
 
 ~G4BooleanSolid () override
 
const G4VSolidGetConstituentSolid (G4int no) const override
 
G4VSolidGetConstituentSolid (G4int no) override
 
G4double GetSurfaceArea () override
 
G4PolyhedronGetPolyhedron () const override
 
std::ostream & StreamInfo (std::ostream &os) const override
 
G4int GetCubVolStatistics () const
 
G4double GetCubVolEpsilon () const
 
void SetCubVolStatistics (G4int st)
 
void SetCubVolEpsilon (G4double ep)
 
G4int GetAreaStatistics () const
 
G4double GetAreaAccuracy () const
 
void SetAreaStatistics (G4int st)
 
void SetAreaAccuracy (G4double ep)
 
G4ThreeVector GetPointOnSurface () const override
 
 G4BooleanSolid (__void__ &)
 
 G4BooleanSolid (const G4BooleanSolid &rhs)
 
G4BooleanSolidoperator= (const G4BooleanSolid &rhs)
 
- Public Member Functions inherited from G4VSolid
 G4VSolid (const G4String &name)
 
virtual ~G4VSolid ()
 
G4bool operator== (const G4VSolid &s) const
 
G4String GetName () const
 
void SetName (const G4String &name)
 
G4double GetTolerance () const
 
void DumpInfo () const
 
virtual G4VisExtent GetExtent () const
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
 G4VSolid (__void__ &)
 
 G4VSolid (const G4VSolid &rhs)
 
G4VSolidoperator= (const G4VSolid &rhs)
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4BooleanSolid
static void SetExternalBooleanProcessor (G4VBooleanProcessor *extProcessor)
 
static G4VBooleanProcessorGetExternalBooleanProcessor ()
 
- Protected Member Functions inherited from G4BooleanSolid
void GetListOfPrimitives (std::vector< std::pair< G4VSolid *, G4Transform3D > > &, const G4Transform3D &) const
 
G4PolyhedronStackPolyhedron (HepPolyhedronProcessor &, const G4VSolid *) const
 
- Protected Member Functions inherited from G4VSolid
void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipCrossSection (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipBetweenSections (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipPolygon (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
 
- Protected Attributes inherited from G4BooleanSolid
G4VSolidfPtrSolidA = nullptr
 
G4VSolidfPtrSolidB = nullptr
 
G4double fCubicVolume = -1.0
 
G4double fSurfaceArea = -1.0
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 
- Static Protected Attributes inherited from G4BooleanSolid
static G4VBooleanProcessorfExternalBoolProcessor = nullptr
 

Detailed Description

Definition at line 45 of file G4UnionSolid.hh.

Constructor & Destructor Documentation

◆ G4UnionSolid() [1/5]

G4UnionSolid::G4UnionSolid ( const G4String & pName,
G4VSolid * pSolidA,
G4VSolid * pSolidB )

Definition at line 54 of file G4UnionSolid.cc.

57 : G4BooleanSolid(pName,pSolidA,pSolidB)
58{
59 Init();
60}
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)

Referenced by Clone().

◆ G4UnionSolid() [2/5]

G4UnionSolid::G4UnionSolid ( const G4String & pName,
G4VSolid * pSolidA,
G4VSolid * pSolidB,
G4RotationMatrix * rotMatrix,
const G4ThreeVector & transVector )

Definition at line 66 of file G4UnionSolid.cc.

71 : G4BooleanSolid(pName,pSolidA,pSolidB,rotMatrix,transVector)
72
73{
74 Init();
75}

◆ G4UnionSolid() [3/5]

G4UnionSolid::G4UnionSolid ( const G4String & pName,
G4VSolid * pSolidA,
G4VSolid * pSolidB,
const G4Transform3D & transform )

Definition at line 81 of file G4UnionSolid.cc.

85 : G4BooleanSolid(pName,pSolidA,pSolidB,transform)
86{
87 Init();
88}

◆ ~G4UnionSolid()

G4UnionSolid::~G4UnionSolid ( )
overridedefault

◆ G4UnionSolid() [4/5]

G4UnionSolid::G4UnionSolid ( __void__ & a)

Definition at line 95 of file G4UnionSolid.cc.

97{
98}

◆ G4UnionSolid() [5/5]

G4UnionSolid::G4UnionSolid ( const G4UnionSolid & rhs)

Definition at line 111 of file G4UnionSolid.cc.

112 : G4BooleanSolid (rhs)
113{
114 fPMin = rhs.fPMin;
115 fPMax = rhs.fPMax;
116 halfCarTolerance=0.5*kCarTolerance;
117}
G4double kCarTolerance
Definition G4VSolid.hh:299

Member Function Documentation

◆ BoundingLimits()

void G4UnionSolid::BoundingLimits ( G4ThreeVector & pMin,
G4ThreeVector & pMax ) const
overridevirtual

Reimplemented from G4VSolid.

Definition at line 158 of file G4UnionSolid.cc.

160{
161 G4ThreeVector minA,maxA, minB,maxB;
162 fPtrSolidA->BoundingLimits(minA,maxA);
163 fPtrSolidB->BoundingLimits(minB,maxB);
164
165 pMin.set(std::min(minA.x(),minB.x()),
166 std::min(minA.y(),minB.y()),
167 std::min(minA.z(),minB.z()));
168
169 pMax.set(std::max(maxA.x(),maxB.x()),
170 std::max(maxA.y(),maxB.y()),
171 std::max(maxA.z(),maxB.z()));
172
173 // Check correctness of the bounding box
174 //
175 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
176 {
177 std::ostringstream message;
178 message << "Bad bounding box (min >= max) for solid: "
179 << GetName() << " !"
180 << "\npMin = " << pMin
181 << "\npMax = " << pMax;
182 G4Exception("G4UnionSolid::BoundingLimits()", "GeomMgt0001",
183 JustWarning, message);
184 DumpInfo();
185 }
186}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
double z() const
double x() const
double y() const
void set(double x, double y, double z)
G4VSolid * fPtrSolidA
G4VSolid * fPtrSolidB
G4String GetName() const
void DumpInfo() const
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition G4VSolid.cc:665

◆ CalculateExtent()

G4bool G4UnionSolid::CalculateExtent ( const EAxis pAxis,
const G4VoxelLimits & pVoxelLimit,
const G4AffineTransform & pTransform,
G4double & pMin,
G4double & pMax ) const
overridevirtual

Implements G4VSolid.

Definition at line 193 of file G4UnionSolid.cc.

198{
199 G4bool touchesA, touchesB, out ;
200 G4double minA = kInfinity, minB = kInfinity,
201 maxA = -kInfinity, maxB = -kInfinity;
202
203 touchesA = fPtrSolidA->CalculateExtent( pAxis, pVoxelLimit,
204 pTransform, minA, maxA);
205 touchesB = fPtrSolidB->CalculateExtent( pAxis, pVoxelLimit,
206 pTransform, minB, maxB);
207 if( touchesA || touchesB )
208 {
209 pMin = std::min( minA, minB );
210 pMax = std::max( maxA, maxB );
211 out = true ;
212 }
213 else
214 {
215 out = false ;
216 }
217
218 return out ; // It exists in this slice if either one does.
219}
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0

◆ Clone()

G4VSolid * G4UnionSolid::Clone ( ) const
overridevirtual

Reimplemented from G4VSolid.

Definition at line 495 of file G4UnionSolid.cc.

496{
497 return new G4UnionSolid(*this);
498}
G4UnionSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)

◆ ComputeDimensions()

void G4UnionSolid::ComputeDimensions ( G4VPVParameterisation * p,
const G4int n,
const G4VPhysicalVolume * pRep )
overridevirtual

Reimplemented from G4VSolid.

Definition at line 505 of file G4UnionSolid.cc.

508{
509}

◆ CreatePolyhedron()

G4Polyhedron * G4UnionSolid::CreatePolyhedron ( ) const
overridevirtual

Reimplemented from G4VSolid.

Definition at line 526 of file G4UnionSolid.cc.

527{
528 if (fExternalBoolProcessor == nullptr)
529 {
530 HepPolyhedronProcessor processor;
531 // Stack components and components of components recursively
532 // See G4BooleanSolid::StackPolyhedron
533 G4Polyhedron* top = StackPolyhedron(processor, this);
534 auto result = new G4Polyhedron(*top);
535 if (processor.execute(*result))
536 {
537 return result;
538 }
539 else
540 {
541 return nullptr;
542 }
543 }
544 else
545 {
549 }
550}
G4Polyhedron * GetPolyhedron() const override
const G4VSolid * GetConstituentSolid(G4int no) const override
static G4VBooleanProcessor * fExternalBoolProcessor
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
virtual G4PolyhedronArbitrary * Union(G4Polyhedron *, G4Polyhedron *)
bool execute(HepPolyhedron &)

◆ DescribeYourselfTo()

void G4UnionSolid::DescribeYourselfTo ( G4VGraphicsScene & scene) const
overridevirtual

Implements G4VSolid.

Definition at line 516 of file G4UnionSolid.cc.

517{
518 scene.AddSolid (*this);
519}
virtual void AddSolid(const G4Box &)=0

◆ DistanceToIn() [1/2]

G4double G4UnionSolid::DistanceToIn ( const G4ThreeVector & p) const
overridevirtual

Implements G4VSolid.

Definition at line 322 of file G4UnionSolid.cc.

323{
324#ifdef G4BOOLDEBUG
325 if( Inside(p) == kInside )
326 {
327 G4cout << "WARNING - Invalid call in "
328 << "G4UnionSolid::DistanceToIn(p)" << G4endl
329 << " Point p is inside !" << G4endl;
330 G4cout << " p = " << p << G4endl;
331 G4cerr << "WARNING - Invalid call in "
332 << "G4UnionSolid::DistanceToIn(p)" << G4endl
333 << " Point p is inside !" << G4endl;
334 G4cerr << " p = " << p << G4endl;
335 }
336#endif
337 G4double distA = fPtrSolidA->DistanceToIn(p) ;
338 G4double distB = fPtrSolidB->DistanceToIn(p) ;
339 G4double safety = std::min(distA,distB) ;
340 if(safety < 0.0) safety = 0.0 ;
341 return safety ;
342}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
EInside Inside(const G4ThreeVector &p) const override
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
@ kInside
Definition geomdefs.hh:70

◆ DistanceToIn() [2/2]

G4double G4UnionSolid::DistanceToIn ( const G4ThreeVector & p,
const G4ThreeVector & v ) const
overridevirtual

Implements G4VSolid.

Definition at line 293 of file G4UnionSolid.cc.

295{
296#ifdef G4BOOLDEBUG
297 if( Inside(p) == kInside )
298 {
299 G4cout << "WARNING - Invalid call in "
300 << "G4UnionSolid::DistanceToIn(p,v)" << G4endl
301 << " Point p is inside !" << G4endl;
302 G4cout << " p = " << p << G4endl;
303 G4cout << " v = " << v << G4endl;
304 G4cerr << "WARNING - Invalid call in "
305 << "G4UnionSolid::DistanceToIn(p,v)" << G4endl
306 << " Point p is inside !" << G4endl;
307 G4cerr << " p = " << p << G4endl;
308 G4cerr << " v = " << v << G4endl;
309 }
310#endif
311
312 return std::min(fPtrSolidA->DistanceToIn(p,v),
313 fPtrSolidB->DistanceToIn(p,v) ) ;
314}

◆ DistanceToOut() [1/2]

G4double G4UnionSolid::DistanceToOut ( const G4ThreeVector & p) const
overridevirtual

Implements G4VSolid.

Definition at line 436 of file G4UnionSolid.cc.

437{
438 G4double distout = 0.0;
439 if( Inside(p) == kOutside )
440 {
441#ifdef G4BOOLDEBUG
442 G4cout << "WARNING - Invalid call in "
443 << "G4UnionSolid::DistanceToOut(p)" << G4endl
444 << " Point p is outside !" << G4endl;
445 G4cout << " p = " << p << G4endl;
446 G4cerr << "WARNING - Invalid call in "
447 << "G4UnionSolid::DistanceToOut(p)" << G4endl
448 << " Point p is outside !" << G4endl;
449 G4cerr << " p = " << p << G4endl;
450#endif
451 }
452 else
453 {
454 EInside positionA = fPtrSolidA->Inside(p) ;
455 EInside positionB = fPtrSolidB->Inside(p) ;
456
457 // Is this equivalent ??
458 // if( ! ( (positionA == kOutside)) &&
459 // (positionB == kOutside)) )
460 if((positionA == kInside && positionB == kInside ) ||
461 (positionA == kInside && positionB == kSurface ) ||
462 (positionA == kSurface && positionB == kInside ) )
463 {
464 distout= std::max(fPtrSolidA->DistanceToOut(p),
466 }
467 else
468 {
469 if(positionA == kOutside)
470 {
471 distout= fPtrSolidB->DistanceToOut(p) ;
472 }
473 else
474 {
475 distout= fPtrSolidA->DistanceToOut(p) ;
476 }
477 }
478 }
479 return distout;
480}
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
EInside
Definition geomdefs.hh:67
@ kOutside
Definition geomdefs.hh:68
@ kSurface
Definition geomdefs.hh:69

◆ DistanceToOut() [2/2]

G4double G4UnionSolid::DistanceToOut ( const G4ThreeVector & p,
const G4ThreeVector & v,
const G4bool calcNorm = false,
G4bool * validNorm = nullptr,
G4ThreeVector * n = nullptr ) const
overridevirtual

Implements G4VSolid.

Definition at line 349 of file G4UnionSolid.cc.

354{
355 G4double dist = 0.0, disTmp = 0.0 ;
356 G4ThreeVector normTmp;
357 G4ThreeVector* nTmp = &normTmp;
358
359 if( Inside(p) == kOutside )
360 {
361#ifdef G4BOOLDEBUG
362 G4cout << "Position:" << G4endl << G4endl;
363 G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
364 G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
365 G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
366 G4cout << "Direction:" << G4endl << G4endl;
367 G4cout << "v.x() = " << v.x() << G4endl;
368 G4cout << "v.y() = " << v.y() << G4endl;
369 G4cout << "v.z() = " << v.z() << G4endl << G4endl;
370 G4cout << "WARNING - Invalid call in "
371 << "G4UnionSolid::DistanceToOut(p,v)" << G4endl
372 << " Point p is outside !" << G4endl;
373 G4cout << " p = " << p << G4endl;
374 G4cout << " v = " << v << G4endl;
375 G4cerr << "WARNING - Invalid call in "
376 << "G4UnionSolid::DistanceToOut(p,v)" << G4endl
377 << " Point p is outside !" << G4endl;
378 G4cerr << " p = " << p << G4endl;
379 G4cerr << " v = " << v << G4endl;
380#endif
381 }
382 else
383 {
384 EInside positionA = fPtrSolidA->Inside(p) ;
385
386 if( positionA != kOutside )
387 {
388 do // Loop checking, 13.08.2015, G.Cosmo
389 {
390 disTmp = fPtrSolidA->DistanceToOut(p+dist*v,v,calcNorm,
391 validNorm,nTmp);
392 dist += disTmp ;
393
394 if(fPtrSolidB->Inside(p+dist*v) != kOutside)
395 {
396 disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v,calcNorm,
397 validNorm,nTmp);
398 dist += disTmp ;
399 }
400 }
401 while( (fPtrSolidA->Inside(p+dist*v) != kOutside)
402 && (disTmp > halfCarTolerance) );
403 }
404 else // if( positionB != kOutside )
405 {
406 do // Loop checking, 13.08.2015, G.Cosmo
407 {
408 disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v,calcNorm,
409 validNorm,nTmp);
410 dist += disTmp ;
411
412 if(fPtrSolidA->Inside(p+dist*v) != kOutside)
413 {
414 disTmp = fPtrSolidA->DistanceToOut(p+dist*v,v,calcNorm,
415 validNorm,nTmp);
416 dist += disTmp ;
417 }
418 }
419 while( (fPtrSolidB->Inside(p+dist*v) != kOutside)
420 && (disTmp > halfCarTolerance) );
421 }
422 }
423 if( calcNorm )
424 {
425 *validNorm = false ;
426 *n = *nTmp ;
427 }
428 return dist ;
429}

◆ GetCubicVolume()

G4double G4UnionSolid::GetCubicVolume ( )
finalvirtual

Reimplemented from G4BooleanSolid.

Definition at line 556 of file G4UnionSolid.cc.

557{
558 if( fCubicVolume != -1.0 )
559 {
560 return fCubicVolume;
561 }
562 G4double cubVolumeA = fPtrSolidA->GetCubicVolume();
563 G4double cubVolumeB = fPtrSolidB->GetCubicVolume();
564
565 G4ThreeVector bminA, bmaxA, bminB, bmaxB;
566 fPtrSolidA->BoundingLimits(bminA, bmaxA);
567 fPtrSolidB->BoundingLimits(bminB, bmaxB);
568
569 G4double intersection = 0.;
570 G4bool canIntersect =
571 bminA.x() < bmaxB.x() && bminA.y() < bmaxB.y() && bminA.z() < bmaxB.z() &&
572 bminB.x() < bmaxA.x() && bminB.y() < bmaxA.y() && bminB.z() < bmaxA.z();
573 if ( canIntersect )
574 {
575 G4IntersectionSolid intersectVol( "Temporary-Intersection-for-Union",
577 intersectVol.SetCubVolStatistics(100000);
578 intersection = intersectVol.GetCubicVolume();
579 }
580
581 fCubicVolume = cubVolumeA + cubVolumeB - intersection;
582
583 return fCubicVolume;
584}
virtual G4double GetCubicVolume()
Definition G4VSolid.cc:188

◆ GetEntityType()

G4GeometryType G4UnionSolid::GetEntityType ( ) const
overridevirtual

Reimplemented from G4BooleanSolid.

Definition at line 486 of file G4UnionSolid.cc.

487{
488 return {"G4UnionSolid"};
489}

◆ Inside()

EInside G4UnionSolid::Inside ( const G4ThreeVector & p) const
overridevirtual

Implements G4VSolid.

Definition at line 227 of file G4UnionSolid.cc.

228{
229 if (std::max(p.z()-fPMax.z(), fPMin.z()-p.z()) > 0) { return kOutside; }
230
231 EInside positionA = fPtrSolidA->Inside(p);
232 if (positionA == kInside) { return positionA; } // inside A
233 EInside positionB = fPtrSolidB->Inside(p);
234 if (positionA == kOutside) { return positionB; }
235
236 if (positionB == kInside) { return positionB; } // inside B
237 if (positionB == kOutside) { return positionA; } // surface A
238
239 // Both points are on surface
240 //
241 static const G4double rtol
243
244 return ((fPtrSolidA->SurfaceNormal(p) +
245 fPtrSolidB->SurfaceNormal(p)).mag2() < rtol) ? kInside : kSurface;
246}
G4double GetRadialTolerance() const
static G4GeometryTolerance * GetInstance()
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0

Referenced by DistanceToIn(), DistanceToIn(), DistanceToOut(), DistanceToOut(), and SurfaceNormal().

◆ operator=()

G4UnionSolid & G4UnionSolid::operator= ( const G4UnionSolid & rhs)

Definition at line 123 of file G4UnionSolid.cc.

124{
125 // Check assignment to self
126 //
127 if (this == &rhs) { return *this; }
128
129 // Copy base class data
130 //
132
133 fPMin = rhs.fPMin;
134 fPMax = rhs.fPMax;
135 halfCarTolerance = rhs.halfCarTolerance;
136
137 return *this;
138}
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)

◆ SurfaceNormal()

G4ThreeVector G4UnionSolid::SurfaceNormal ( const G4ThreeVector & p) const
overridevirtual

Implements G4VSolid.

Definition at line 253 of file G4UnionSolid.cc.

254{
255 EInside positionA = fPtrSolidA->Inside(p);
256 EInside positionB = fPtrSolidB->Inside(p);
257
258 if (positionA == kSurface &&
259 positionB == kOutside) return fPtrSolidA->SurfaceNormal(p);
260
261 if (positionA == kOutside &&
262 positionB == kSurface) return fPtrSolidB->SurfaceNormal(p);
263
264 if (positionA == kSurface &&
265 positionB == kSurface)
266 {
267 if (Inside(p) == kSurface)
268 {
271 return (normalA + normalB).unit();
272 }
273 }
274#ifdef G4BOOLDEBUG
275 G4String surf[3] = { "OUTSIDE", "SURFACE", "INSIDE" };
276 std::ostringstream message;
277 G4int oldprc = message.precision(16);
278 message << "Invalid call of SurfaceNormal(p) for union solid: "
279 << GetName() << " !"
280 << "\nPoint p" << p << " is " << surf[Inside(p)] << " !!!";
281 message.precision(oldprc);
282 G4Exception("G4UnionSolid::SurfaceNormal()", "GeomMgt0001",
283 JustWarning, message);
284#endif
285 return fPtrSolidA->SurfaceNormal(p);
286}
int G4int
Definition G4Types.hh:85
Hep3Vector unit() const

The documentation for this class was generated from the following files: