Geant4 10.7.0
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)
 
virtual ~G4UnionSolid ()
 
G4GeometryType GetEntityType () const
 
G4VSolidClone () const
 
 G4UnionSolid (__void__ &)
 
 G4UnionSolid (const G4UnionSolid &rhs)
 
G4UnionSolidoperator= (const G4UnionSolid &rhs)
 
void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
 
EInside Inside (const G4ThreeVector &p) const
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 
G4double DistanceToIn (const G4ThreeVector &p) const
 
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const
 
G4double DistanceToOut (const G4ThreeVector &p) const
 
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4PolyhedronCreatePolyhedron () const
 
- 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)
 
virtual ~G4BooleanSolid ()
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
G4double GetCubicVolume ()
 
G4double GetSurfaceArea ()
 
virtual G4GeometryType GetEntityType () const
 
virtual G4PolyhedronGetPolyhedron () const
 
std::ostream & StreamInfo (std::ostream &os) const
 
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
 
 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
 
virtual void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
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 G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const =0
 
virtual G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const =0
 
virtual G4double DistanceToIn (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 G4double DistanceToOut (const G4ThreeVector &p) const =0
 
virtual void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
virtual G4double GetCubicVolume ()
 
virtual G4double GetSurfaceArea ()
 
virtual G4GeometryType GetEntityType () const =0
 
virtual G4ThreeVector GetPointOnSurface () const
 
virtual G4VSolidClone () const
 
virtual std::ostream & StreamInfo (std::ostream &os) const =0
 
void DumpInfo () const
 
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const =0
 
virtual G4VisExtent GetExtent () const
 
virtual G4PolyhedronCreatePolyhedron () const
 
virtual G4PolyhedronGetPolyhedron () const
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
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

- 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
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

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 51 of file G4UnionSolid.cc.

54 : G4BooleanSolid(pName,pSolidA,pSolidB)
55{
57 G4ThreeVector pmin, pmax;
58 BoundingLimits(pmin, pmax);
59 fPMin = pmin - pdelta;
60 fPMax = pmax + pdelta;
61}
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4double kCarTolerance
Definition: G4VSolid.hh:302

◆ G4UnionSolid() [2/5]

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

Definition at line 67 of file G4UnionSolid.cc.

72 : G4BooleanSolid(pName,pSolidA,pSolidB,rotMatrix,transVector)
73
74{
76 G4ThreeVector pmin, pmax;
77 BoundingLimits(pmin, pmax);
78 fPMin = pmin - pdelta;
79 fPMax = pmax + pdelta;
80}

◆ G4UnionSolid() [3/5]

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

Definition at line 86 of file G4UnionSolid.cc.

90 : G4BooleanSolid(pName,pSolidA,pSolidB,transform)
91{
93 G4ThreeVector pmin, pmax;
94 BoundingLimits(pmin, pmax);
95 fPMin = pmin - pdelta;
96 fPMax = pmax + pdelta;
97}

◆ ~G4UnionSolid()

G4UnionSolid::~G4UnionSolid ( )
virtual

Definition at line 113 of file G4UnionSolid.cc.

114{
115}

◆ G4UnionSolid() [4/5]

G4UnionSolid::G4UnionSolid ( __void__ &  a)

Definition at line 104 of file G4UnionSolid.cc.

105 : G4BooleanSolid(a)
106{
107}

◆ G4UnionSolid() [5/5]

G4UnionSolid::G4UnionSolid ( const G4UnionSolid rhs)

Definition at line 121 of file G4UnionSolid.cc.

122 : G4BooleanSolid (rhs)
123{
124 fPMin = rhs.fPMin;
125 fPMax = rhs.fPMax;
126}

Member Function Documentation

◆ BoundingLimits()

void G4UnionSolid::BoundingLimits ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 151 of file G4UnionSolid.cc.

153{
154 G4ThreeVector minA,maxA, minB,maxB;
155 fPtrSolidA->BoundingLimits(minA,maxA);
156 fPtrSolidB->BoundingLimits(minB,maxB);
157
158 pMin.set(std::min(minA.x(),minB.x()),
159 std::min(minA.y(),minB.y()),
160 std::min(minA.z(),minB.z()));
161
162 pMax.set(std::max(maxA.x(),maxB.x()),
163 std::max(maxA.y(),maxB.y()),
164 std::max(maxA.z(),maxB.z()));
165
166 // Check correctness of the bounding box
167 //
168 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
169 {
170 std::ostringstream message;
171 message << "Bad bounding box (min >= max) for solid: "
172 << GetName() << " !"
173 << "\npMin = " << pMin
174 << "\npMax = " << pMax;
175 G4Exception("G4UnionSolid::BoundingLimits()", "GeomMgt0001",
176 JustWarning, message);
177 DumpInfo();
178 }
179}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
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:653

Referenced by G4UnionSolid().

◆ CalculateExtent()

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

Implements G4VSolid.

Definition at line 186 of file G4UnionSolid.cc.

191{
192 G4bool touchesA, touchesB, out ;
193 G4double minA = kInfinity, minB = kInfinity,
194 maxA = -kInfinity, maxB = -kInfinity;
195
196 touchesA = fPtrSolidA->CalculateExtent( pAxis, pVoxelLimit,
197 pTransform, minA, maxA);
198 touchesB = fPtrSolidB->CalculateExtent( pAxis, pVoxelLimit,
199 pTransform, minB, maxB);
200 if( touchesA || touchesB )
201 {
202 pMin = std::min( minA, minB );
203 pMax = std::max( maxA, maxB );
204 out = true ;
205 }
206 else
207 {
208 out = false ;
209 }
210
211 return out ; // It exists in this slice if either one does.
212}
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
virtual

Reimplemented from G4VSolid.

Definition at line 488 of file G4UnionSolid.cc.

489{
490 return new G4UnionSolid(*this);
491}

◆ ComputeDimensions()

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

Reimplemented from G4VSolid.

Definition at line 498 of file G4UnionSolid.cc.

501{
502}

◆ CreatePolyhedron()

G4Polyhedron * G4UnionSolid::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 519 of file G4UnionSolid.cc.

520{
522 // Stack components and components of components recursively
523 // See G4BooleanSolid::StackPolyhedron
525 G4Polyhedron* result = new G4Polyhedron(*top);
526 if (processor.execute(*result)) { return result; }
527 else { return nullptr; }
528}
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
#define processor
Definition: xmlparse.cc:617

◆ DescribeYourselfTo()

void G4UnionSolid::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 509 of file G4UnionSolid.cc.

510{
511 scene.AddSolid (*this);
512}
virtual void AddSolid(const G4Box &)=0

◆ DistanceToIn() [1/2]

G4double G4UnionSolid::DistanceToIn ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 315 of file G4UnionSolid.cc.

316{
317#ifdef G4BOOLDEBUG
318 if( Inside(p) == kInside )
319 {
320 G4cout << "WARNING - Invalid call in "
321 << "G4UnionSolid::DistanceToIn(p)" << G4endl
322 << " Point p is inside !" << G4endl;
323 G4cout << " p = " << p << G4endl;
324 G4cerr << "WARNING - Invalid call in "
325 << "G4UnionSolid::DistanceToIn(p)" << G4endl
326 << " Point p is inside !" << G4endl;
327 G4cerr << " p = " << p << G4endl;
328 }
329#endif
330 G4double distA = fPtrSolidA->DistanceToIn(p) ;
331 G4double distB = fPtrSolidB->DistanceToIn(p) ;
332 G4double safety = std::min(distA,distB) ;
333 if(safety < 0.0) safety = 0.0 ;
334 return safety ;
335}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
EInside Inside(const G4ThreeVector &p) const
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
virtual

Implements G4VSolid.

Definition at line 286 of file G4UnionSolid.cc.

288{
289#ifdef G4BOOLDEBUG
290 if( Inside(p) == kInside )
291 {
292 G4cout << "WARNING - Invalid call in "
293 << "G4UnionSolid::DistanceToIn(p,v)" << G4endl
294 << " Point p is inside !" << G4endl;
295 G4cout << " p = " << p << G4endl;
296 G4cout << " v = " << v << G4endl;
297 G4cerr << "WARNING - Invalid call in "
298 << "G4UnionSolid::DistanceToIn(p,v)" << G4endl
299 << " Point p is inside !" << G4endl;
300 G4cerr << " p = " << p << G4endl;
301 G4cerr << " v = " << v << G4endl;
302 }
303#endif
304
305 return std::min(fPtrSolidA->DistanceToIn(p,v),
306 fPtrSolidB->DistanceToIn(p,v) ) ;
307}

◆ DistanceToOut() [1/2]

G4double G4UnionSolid::DistanceToOut ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 429 of file G4UnionSolid.cc.

430{
431 G4double distout = 0.0;
432 if( Inside(p) == kOutside )
433 {
434#ifdef G4BOOLDEBUG
435 G4cout << "WARNING - Invalid call in "
436 << "G4UnionSolid::DistanceToOut(p)" << G4endl
437 << " Point p is outside !" << G4endl;
438 G4cout << " p = " << p << G4endl;
439 G4cerr << "WARNING - Invalid call in "
440 << "G4UnionSolid::DistanceToOut(p)" << G4endl
441 << " Point p is outside !" << G4endl;
442 G4cerr << " p = " << p << G4endl;
443#endif
444 }
445 else
446 {
447 EInside positionA = fPtrSolidA->Inside(p) ;
448 EInside positionB = fPtrSolidB->Inside(p) ;
449
450 // Is this equivalent ??
451 // if( ! ( (positionA == kOutside)) &&
452 // (positionB == kOutside)) )
453 if((positionA == kInside && positionB == kInside ) ||
454 (positionA == kInside && positionB == kSurface ) ||
455 (positionA == kSurface && positionB == kInside ) )
456 {
457 distout= std::max(fPtrSolidA->DistanceToOut(p),
459 }
460 else
461 {
462 if(positionA == kOutside)
463 {
464 distout= fPtrSolidB->DistanceToOut(p) ;
465 }
466 else
467 {
468 distout= fPtrSolidA->DistanceToOut(p) ;
469 }
470 }
471 }
472 return distout;
473}
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
virtual

Implements G4VSolid.

Definition at line 342 of file G4UnionSolid.cc.

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

◆ GetEntityType()

G4GeometryType G4UnionSolid::GetEntityType ( ) const
virtual

Reimplemented from G4BooleanSolid.

Definition at line 479 of file G4UnionSolid.cc.

480{
481 return G4String("G4UnionSolid");
482}

◆ Inside()

EInside G4UnionSolid::Inside ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 220 of file G4UnionSolid.cc.

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

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

◆ operator=()

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

Definition at line 132 of file G4UnionSolid.cc.

133{
134 // Check assignment to self
135 //
136 if (this == &rhs) { return *this; }
137
138 // Copy base class data
139 //
141
142 fPMin = rhs.fPMin;
143 fPMax = rhs.fPMax;
144 return *this;
145}
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)

◆ SurfaceNormal()

G4ThreeVector G4UnionSolid::SurfaceNormal ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 246 of file G4UnionSolid.cc.

247{
248 EInside positionA = fPtrSolidA->Inside(p);
249 EInside positionB = fPtrSolidB->Inside(p);
250
251 if (positionA == kSurface &&
252 positionB == kOutside) return fPtrSolidA->SurfaceNormal(p);
253
254 if (positionA == kOutside &&
255 positionB == kSurface) return fPtrSolidB->SurfaceNormal(p);
256
257 if (positionA == kSurface &&
258 positionB == kSurface)
259 {
260 if (Inside(p) == kSurface)
261 {
264 return (normalA + normalB).unit();
265 }
266 }
267#ifdef G4BOOLDEBUG
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: "
272 << GetName() << " !"
273 << "\nPoint p" << p << " is " << surf[Inside(p)] << " !!!";
274 message.precision(oldprc);
275 G4Exception("G4UnionSolid::SurfaceNormal()", "GeomMgt0001",
276 JustWarning, message);
277#endif
278 return fPtrSolidA->SurfaceNormal(p);
279}
int G4int
Definition: G4Types.hh:85
Hep3Vector unit() const

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