Geant4  10.02.p03
G4SubtractionSolid Class Reference

#include <G4SubtractionSolid.hh>

Inheritance diagram for G4SubtractionSolid:
Collaboration diagram for G4SubtractionSolid:

Public Member Functions

 G4SubtractionSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
 
 G4SubtractionSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB, G4RotationMatrix *rotMatrix, const G4ThreeVector &transVector)
 
 G4SubtractionSolid (const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB, const G4Transform3D &transform)
 
virtual ~G4SubtractionSolid ()
 
G4GeometryType GetEntityType () const
 
G4VSolidClone () const
 
 G4SubtractionSolid (__void__ &)
 
 G4SubtractionSolid (const G4SubtractionSolid &rhs)
 
G4SubtractionSolidoperator= (const G4SubtractionSolid &rhs)
 
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=0, G4ThreeVector *n=0) 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 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
 
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

- Protected Member Functions inherited from G4BooleanSolid
G4PolyhedronStackPolyhedron (HepPolyhedronProcessor &, const G4VSolid *) const
 
G4double GetAreaRatio () 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
 
G4VSolidfPtrSolidB
 
G4double fAreaRatio
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Detailed Description

Definition at line 53 of file G4SubtractionSolid.hh.

Constructor & Destructor Documentation

◆ G4SubtractionSolid() [1/5]

G4SubtractionSolid::G4SubtractionSolid ( const G4String pName,
G4VSolid pSolidA,
G4VSolid pSolidB 
)

Definition at line 60 of file G4SubtractionSolid.cc.

63  : G4BooleanSolid(pName,pSolidA,pSolidB)
64 {
65 }
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
Here is the caller graph for this function:

◆ G4SubtractionSolid() [2/5]

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

Definition at line 71 of file G4SubtractionSolid.cc.

76  : G4BooleanSolid(pName,pSolidA,pSolidB,rotMatrix,transVector)
77 {
78 }
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)

◆ G4SubtractionSolid() [3/5]

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

Definition at line 84 of file G4SubtractionSolid.cc.

88  : G4BooleanSolid(pName,pSolidA,pSolidB,transform)
89 {
90 }
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)

◆ ~G4SubtractionSolid()

G4SubtractionSolid::~G4SubtractionSolid ( )
virtual

Definition at line 106 of file G4SubtractionSolid.cc.

107 {
108 }

◆ G4SubtractionSolid() [4/5]

G4SubtractionSolid::G4SubtractionSolid ( __void__ &  a)

Definition at line 97 of file G4SubtractionSolid.cc.

98  : G4BooleanSolid(a)
99 {
100 }
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)

◆ G4SubtractionSolid() [5/5]

G4SubtractionSolid::G4SubtractionSolid ( const G4SubtractionSolid rhs)

Definition at line 114 of file G4SubtractionSolid.cc.

115  : G4BooleanSolid (rhs)
116 {
117 }
G4BooleanSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)

Member Function Documentation

◆ CalculateExtent()

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

Implements G4VSolid.

Definition at line 142 of file G4SubtractionSolid.cc.

147 {
148  // Since we cannot be sure how much the second solid subtracts
149  // from the first, we must use the first solid's extent!
150 
151  return fPtrSolidA->CalculateExtent( pAxis, pVoxelLimit,
152  pTransform, pMin, pMax );
153 }
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
G4VSolid * fPtrSolidA
Here is the call graph for this function:

◆ Clone()

G4VSolid * G4SubtractionSolid::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 527 of file G4SubtractionSolid.cc.

528 {
529  return new G4SubtractionSolid(*this);
530 }
G4SubtractionSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)
Here is the call graph for this function:

◆ ComputeDimensions()

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

Reimplemented from G4VSolid.

Definition at line 537 of file G4SubtractionSolid.cc.

540 {
541 }

◆ CreatePolyhedron()

G4Polyhedron * G4SubtractionSolid::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 558 of file G4SubtractionSolid.cc.

559 {
561  // Stack components and components of components recursively
562  // See G4BooleanSolid::StackPolyhedron
563  G4Polyhedron* top = StackPolyhedron(processor, this);
564  G4Polyhedron* result = new G4Polyhedron(*top);
565  if (processor.execute(*result)) { return result; }
566  else { return 0; }
567 }
#define processor
Definition: xmlparse.cc:617
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
bool execute(HepPolyhedron &)
Here is the call graph for this function:

◆ DescribeYourselfTo()

void G4SubtractionSolid::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 548 of file G4SubtractionSolid.cc.

549 {
550  scene.AddSolid (*this);
551 }
virtual void AddSolid(const G4Box &)=0
Here is the call graph for this function:

◆ DistanceToIn() [1/2]

G4double G4SubtractionSolid::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const
virtual

Implements G4VSolid.

Definition at line 259 of file G4SubtractionSolid.cc.

261 {
262  G4double dist = 0.0, dist2 = 0.0, disTmp = 0.0;
263 
264 #ifdef G4BOOLDEBUG
265  if( Inside(p) == kInside )
266  {
267  G4cout << "WARNING - Invalid call in "
268  << "G4SubtractionSolid::DistanceToIn(p,v)" << G4endl
269  << " Point p is inside !" << G4endl;
270  G4cout << " p = " << p << G4endl;
271  G4cout << " v = " << v << G4endl;
272  G4cerr << "WARNING - Invalid call in "
273  << "G4SubtractionSolid::DistanceToIn(p,v)" << G4endl
274  << " Point p is inside !" << G4endl;
275  G4cerr << " p = " << p << G4endl;
276  G4cerr << " v = " << v << G4endl;
277  }
278 #endif
279 
280  // if( // ( fPtrSolidA->Inside(p) != kOutside) && // case1:p in both A&B
281  if ( fPtrSolidB->Inside(p) != kOutside ) // start: out of B
282  {
283  dist = fPtrSolidB->DistanceToOut(p,v) ; // ,calcNorm,validNorm,n) ;
284 
285  if( fPtrSolidA->Inside(p+dist*v) != kInside )
286  {
287  G4int count1=0;
288  do // Loop checking, 13.08.2015, G.Cosmo
289  {
290  disTmp = fPtrSolidA->DistanceToIn(p+dist*v,v) ;
291 
292  if(disTmp == kInfinity)
293  {
294  return kInfinity ;
295  }
296  dist += disTmp ;
297 
298  if( Inside(p+dist*v) == kOutside )
299  {
300  disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) ;
301  dist2 = dist+disTmp;
302  if (dist == dist2) { return dist; } // no progress
303  dist = dist2 ;
304  count1++;
305  if( count1 > 1000 ) // Infinite loop detected
306  {
307  G4String nameB = fPtrSolidB->GetName();
308  if(fPtrSolidB->GetEntityType()=="G4DisplacedSolid")
309  {
310  nameB = (dynamic_cast<G4DisplacedSolid*>(fPtrSolidB))
311  ->GetConstituentMovedSolid()->GetName();
312  }
313  std::ostringstream message;
314  message << "Illegal condition caused by solids: "
315  << fPtrSolidA->GetName() << " and " << nameB << G4endl;
316  message.precision(16);
317  message << "Looping detected in point " << p+dist*v
318  << ", from original point " << p
319  << " and direction " << v << G4endl
320  << "Computed candidate distance: " << dist << "*mm. ";
321  message.precision(6);
322  DumpInfo();
323  G4Exception("G4SubtractionSolid::DistanceToIn(p,v)",
324  "GeomSolids1001", JustWarning, message,
325  "Returning candidate distance.");
326  return dist;
327  }
328  }
329  }
330  while( Inside(p+dist*v) == kOutside ) ;
331  }
332  }
333  else // p outside A, start in A
334  {
335  dist = fPtrSolidA->DistanceToIn(p,v) ;
336 
337  if( dist == kInfinity ) // past A, hence past A\B
338  {
339  return kInfinity ;
340  }
341  else
342  {
343  G4int count2=0;
344  while( Inside(p+dist*v) == kOutside ) // pushing loop
345  {
346  disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) ;
347  dist += disTmp ;
348 
349  if( Inside(p+dist*v) == kOutside )
350  {
351  disTmp = fPtrSolidA->DistanceToIn(p+dist*v,v) ;
352 
353  if(disTmp == kInfinity) // past A, hence past A\B
354  {
355  return kInfinity ;
356  }
357  dist2 = dist+disTmp;
358  if (dist == dist2) { return dist; } // no progress
359  dist = dist2 ;
360  count2++;
361  if( count2 > 1000 ) // Infinite loop detected
362  {
363  G4String nameB = fPtrSolidB->GetName();
364  if(fPtrSolidB->GetEntityType()=="G4DisplacedSolid")
365  {
366  nameB = (dynamic_cast<G4DisplacedSolid*>(fPtrSolidB))
367  ->GetConstituentMovedSolid()->GetName();
368  }
369  std::ostringstream message;
370  message << "Illegal condition caused by solids: "
371  << fPtrSolidA->GetName() << " and " << nameB << G4endl;
372  message.precision(16);
373  message << "Looping detected in point " << p+dist*v
374  << ", from original point " << p
375  << " and direction " << v << G4endl
376  << "Computed candidate distance: " << dist << "*mm. ";
377  message.precision(6);
378  DumpInfo();
379  G4Exception("G4SubtractionSolid::DistanceToIn(p,v)",
380  "GeomSolids1001", JustWarning, message,
381  "Returning candidate distance.");
382  return dist;
383  }
384  }
385  } // Loop checking, 13.08.2015, G.Cosmo
386  }
387  }
388 
389  return dist ;
390 }
G4VSolid * fPtrSolidB
EInside Inside(const G4ThreeVector &p) const
static const G4double kInfinity
Definition: geomdefs.hh:42
virtual G4GeometryType GetEntityType() const =0
int G4int
Definition: G4Types.hh:78
G4String GetName() const
void DumpInfo() const
G4GLOB_DLL std::ostream G4cout
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4VSolid * fPtrSolidA
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:

◆ DistanceToIn() [2/2]

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

Implements G4VSolid.

Definition at line 399 of file G4SubtractionSolid.cc.

400 {
401  G4double dist=0.0;
402 
403 #ifdef G4BOOLDEBUG
404  if( Inside(p) == kInside )
405  {
406  G4cout << "WARNING - Invalid call in "
407  << "G4SubtractionSolid::DistanceToIn(p)" << G4endl
408  << " Point p is inside !" << G4endl;
409  G4cout << " p = " << p << G4endl;
410  G4cerr << "WARNING - Invalid call in "
411  << "G4SubtractionSolid::DistanceToIn(p)" << G4endl
412  << " Point p is inside !" << G4endl;
413  G4cerr << " p = " << p << G4endl;
414  }
415 #endif
416 
417  if( ( fPtrSolidA->Inside(p) != kOutside) && // case 1
418  ( fPtrSolidB->Inside(p) != kOutside) )
419  {
420  dist= fPtrSolidB->DistanceToOut(p) ;
421  }
422  else
423  {
424  dist= fPtrSolidA->DistanceToIn(p) ;
425  }
426 
427  return dist;
428 }
G4VSolid * fPtrSolidB
EInside Inside(const G4ThreeVector &p) const
G4GLOB_DLL std::ostream G4cout
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4VSolid * fPtrSolidA
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:

◆ DistanceToOut() [1/2]

G4double G4SubtractionSolid::DistanceToOut ( const G4ThreeVector p,
const G4ThreeVector v,
const G4bool  calcNorm = false,
G4bool validNorm = 0,
G4ThreeVector n = 0 
) const
virtual

Implements G4VSolid.

Definition at line 435 of file G4SubtractionSolid.cc.

440 {
441 #ifdef G4BOOLDEBUG
442  if( Inside(p) == kOutside )
443  {
444  G4cout << "Position:" << G4endl << G4endl;
445  G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
446  G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
447  G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
448  G4cout << "Direction:" << G4endl << G4endl;
449  G4cout << "v.x() = " << v.x() << G4endl;
450  G4cout << "v.y() = " << v.y() << G4endl;
451  G4cout << "v.z() = " << v.z() << G4endl << G4endl;
452  G4cout << "WARNING - Invalid call in "
453  << "G4SubtractionSolid::DistanceToOut(p,v)" << G4endl
454  << " Point p is outside !" << G4endl;
455  G4cout << " p = " << p << G4endl;
456  G4cout << " v = " << v << G4endl;
457  G4cerr << "WARNING - Invalid call in "
458  << "G4SubtractionSolid::DistanceToOut(p,v)" << G4endl
459  << " Point p is outside !" << G4endl;
460  G4cerr << " p = " << p << G4endl;
461  G4cerr << " v = " << v << G4endl;
462  }
463 #endif
464 
465  G4double distout;
466  G4double distA = fPtrSolidA->DistanceToOut(p,v,calcNorm,validNorm,n) ;
467  G4double distB = fPtrSolidB->DistanceToIn(p,v) ;
468  if(distB < distA)
469  {
470  if(calcNorm)
471  {
472  *n = -(fPtrSolidB->SurfaceNormal(p+distB*v)) ;
473  *validNorm = false ;
474  }
475  distout= distB ;
476  }
477  else
478  {
479  distout= distA ;
480  }
481  return distout;
482 }
G4VSolid * fPtrSolidB
EInside Inside(const G4ThreeVector &p) const
G4GLOB_DLL std::ostream G4cout
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
double x() const
double y() const
double z() const
G4VSolid * fPtrSolidA
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
static const double mm
Definition: G4SIunits.hh:114
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:

◆ DistanceToOut() [2/2]

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

Implements G4VSolid.

Definition at line 489 of file G4SubtractionSolid.cc.

490 {
491  G4double dist=0.0;
492 
493  if( Inside(p) == kOutside )
494  {
495 #ifdef G4BOOLDEBUG
496  G4cout << "WARNING - Invalid call in "
497  << "G4SubtractionSolid::DistanceToOut(p)" << G4endl
498  << " Point p is outside" << G4endl;
499  G4cout << " p = " << p << G4endl;
500  G4cerr << "WARNING - Invalid call in "
501  << "G4SubtractionSolid::DistanceToOut(p)" << G4endl
502  << " Point p is outside" << G4endl;
503  G4cerr << " p = " << p << G4endl;
504 #endif
505  }
506  else
507  {
509  fPtrSolidB->DistanceToIn(p) ) ;
510  }
511  return dist;
512 }
G4VSolid * fPtrSolidB
EInside Inside(const G4ThreeVector &p) const
G4GLOB_DLL std::ostream G4cout
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4VSolid * fPtrSolidA
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:

◆ GetEntityType()

G4GeometryType G4SubtractionSolid::GetEntityType ( ) const
virtual

Reimplemented from G4BooleanSolid.

Definition at line 518 of file G4SubtractionSolid.cc.

519 {
520  return G4String("G4SubtractionSolid");
521 }

◆ Inside()

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

Implements G4VSolid.

Definition at line 159 of file G4SubtractionSolid.cc.

160 {
161  EInside positionA = fPtrSolidA->Inside(p);
162  if (positionA == kOutside) return kOutside;
163 
164  EInside positionB = fPtrSolidB->Inside(p);
165 
166  if(positionA == kInside && positionB == kOutside)
167  {
168  return kInside ;
169  }
170  else
171  {
172  static const G4double rtol
174  if(( positionA == kInside && positionB == kSurface) ||
175  ( positionB == kOutside && positionA == kSurface) ||
176  ( positionA == kSurface && positionB == kSurface &&
177  ( fPtrSolidA->SurfaceNormal(p) -
178  fPtrSolidB->SurfaceNormal(p) ).mag2() > rtol ) )
179  {
180  return kSurface;
181  }
182  else
183  {
184  return kOutside;
185  }
186  }
187 }
G4VSolid * fPtrSolidB
G4double GetRadialTolerance() const
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
EInside
Definition: geomdefs.hh:58
G4VSolid * fPtrSolidA
double G4double
Definition: G4Types.hh:76
static G4GeometryTolerance * GetInstance()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

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

Definition at line 124 of file G4SubtractionSolid.cc.

125 {
126  // Check assignment to self
127  //
128  if (this == &rhs) { return *this; }
129 
130  // Copy base class data
131  //
133 
134  return *this;
135 }
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)
Here is the call graph for this function:

◆ SurfaceNormal()

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

Implements G4VSolid.

Definition at line 194 of file G4SubtractionSolid.cc.

195 {
197  EInside insideThis= Inside(p);
198  if( insideThis == kOutside )
199  {
200 #ifdef G4BOOLDEBUG
201  G4cout << "WARNING - Invalid call [1] in "
202  << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
203  << " Point p is outside !" << G4endl;
204  G4cout << " p = " << p << G4endl;
205  G4cerr << "WARNING - Invalid call [1] in "
206  << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
207  << " Point p is outside !" << G4endl;
208  G4cerr << " p = " << p << G4endl;
209 #endif
210  }
211  else
212  {
213  EInside InsideA = fPtrSolidA->Inside(p);
214  EInside InsideB = fPtrSolidB->Inside(p);
215 
216  if( InsideA == kSurface &&
217  InsideB != kInside )
218  {
219  normal = fPtrSolidA->SurfaceNormal(p) ;
220  }
221  else if( InsideA == kInside &&
222  InsideB != kOutside )
223  {
224  normal = -fPtrSolidB->SurfaceNormal(p) ;
225  }
226  else
227  {
229  {
230  normal = fPtrSolidA->SurfaceNormal(p) ;
231  }
232  else
233  {
234  normal = -fPtrSolidB->SurfaceNormal(p) ;
235  }
236 #ifdef G4BOOLDEBUG
237  if(insideThis == kInside)
238  {
239  G4cout << "WARNING - Invalid call [2] in "
240  << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
241  << " Point p is inside !" << G4endl;
242  G4cout << " p = " << p << G4endl;
243  G4cerr << "WARNING - Invalid call [2] in "
244  << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
245  << " Point p is inside !" << G4endl;
246  G4cerr << " p = " << p << G4endl;
247  }
248 #endif
249  }
250  }
251  return normal;
252 }
G4VSolid * fPtrSolidB
EInside Inside(const G4ThreeVector &p) const
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
G4GLOB_DLL std::ostream G4cout
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
EInside
Definition: geomdefs.hh:58
G4VSolid * fPtrSolidA
#define G4endl
Definition: G4ios.hh:61
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const =0
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:

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