Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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)
 
void Extent (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=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
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
 
G4VSolidfPtrSolidB
 
- Protected Attributes inherited from G4VSolid
G4double kCarTolerance
 

Detailed Description

Definition at line 53 of file G4SubtractionSolid.hh.

Constructor & Destructor Documentation

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::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::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 ( )
virtual

Definition at line 106 of file G4SubtractionSolid.cc.

107 {
108 }
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)
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
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

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

Implements G4VSolid.

Definition at line 169 of file G4SubtractionSolid.cc.

174 {
175  // Since we cannot be sure how much the second solid subtracts
176  // from the first, we must use the first solid's extent!
177 
178  return fPtrSolidA->CalculateExtent( pAxis, pVoxelLimit,
179  pTransform, pMin, pMax );
180 }
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:

G4VSolid * G4SubtractionSolid::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 552 of file G4SubtractionSolid.cc.

553 {
554  return new G4SubtractionSolid(*this);
555 }
G4SubtractionSolid(const G4String &pName, G4VSolid *pSolidA, G4VSolid *pSolidB)

Here is the call graph for this function:

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

Reimplemented from G4VSolid.

Definition at line 562 of file G4SubtractionSolid.cc.

565 {
566 }
G4Polyhedron * G4SubtractionSolid::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 583 of file G4SubtractionSolid.cc.

584 {
586  // Stack components and components of components recursively
587  // See G4BooleanSolid::StackPolyhedron
588  G4Polyhedron* top = StackPolyhedron(processor, this);
589  G4Polyhedron* result = new G4Polyhedron(*top);
590  if (processor.execute(*result)) { return result; }
591  else { return 0; }
592 }
G4double G4ParticleHPJENDLHEData::G4double result
#define processor
Definition: xmlparse.cc:617
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
bool execute(HepPolyhedron &)

Here is the call graph for this function:

void G4SubtractionSolid::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 573 of file G4SubtractionSolid.cc.

574 {
575  scene.AddSolid (*this);
576 }
virtual void AddSolid(const G4Box &)=0

Here is the call graph for this function:

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

Implements G4VSolid.

Definition at line 284 of file G4SubtractionSolid.cc.

286 {
287  G4double dist = 0.0, dist2 = 0.0, disTmp = 0.0;
288 
289 #ifdef G4BOOLDEBUG
290  if( Inside(p) == kInside )
291  {
292  G4cout << "WARNING - Invalid call in "
293  << "G4SubtractionSolid::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  << "G4SubtractionSolid::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  // if( // ( fPtrSolidA->Inside(p) != kOutside) && // case1:p in both A&B
306  if ( fPtrSolidB->Inside(p) != kOutside ) // start: out of B
307  {
308  dist = fPtrSolidB->DistanceToOut(p,v) ; // ,calcNorm,validNorm,n) ;
309 
310  if( fPtrSolidA->Inside(p+dist*v) != kInside )
311  {
312  G4int count1=0;
313  do // Loop checking, 13.08.2015, G.Cosmo
314  {
315  disTmp = fPtrSolidA->DistanceToIn(p+dist*v,v) ;
316 
317  if(disTmp == kInfinity)
318  {
319  return kInfinity ;
320  }
321  dist += disTmp ;
322 
323  if( Inside(p+dist*v) == kOutside )
324  {
325  disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) ;
326  dist2 = dist+disTmp;
327  if (dist == dist2) { return dist; } // no progress
328  dist = dist2 ;
329  count1++;
330  if( count1 > 1000 ) // Infinite loop detected
331  {
332  G4String nameB = fPtrSolidB->GetName();
333  if(fPtrSolidB->GetEntityType()=="G4DisplacedSolid")
334  {
335  nameB = (dynamic_cast<G4DisplacedSolid*>(fPtrSolidB))
336  ->GetConstituentMovedSolid()->GetName();
337  }
338  std::ostringstream message;
339  message << "Illegal condition caused by solids: "
340  << fPtrSolidA->GetName() << " and " << nameB << G4endl;
341  message.precision(16);
342  message << "Looping detected in point " << p+dist*v
343  << ", from original point " << p
344  << " and direction " << v << G4endl
345  << "Computed candidate distance: " << dist << "*mm. ";
346  message.precision(6);
347  DumpInfo();
348  G4Exception("G4SubtractionSolid::DistanceToIn(p,v)",
349  "GeomSolids1001", JustWarning, message,
350  "Returning candidate distance.");
351  return dist;
352  }
353  }
354  }
355  while( Inside(p+dist*v) == kOutside ) ;
356  }
357  }
358  else // p outside A, start in A
359  {
360  dist = fPtrSolidA->DistanceToIn(p,v) ;
361 
362  if( dist == kInfinity ) // past A, hence past A\B
363  {
364  return kInfinity ;
365  }
366  else
367  {
368  G4int count2=0;
369  while( Inside(p+dist*v) == kOutside ) // pushing loop
370  {
371  disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) ;
372  dist += disTmp ;
373 
374  if( Inside(p+dist*v) == kOutside )
375  {
376  disTmp = fPtrSolidA->DistanceToIn(p+dist*v,v) ;
377 
378  if(disTmp == kInfinity) // past A, hence past A\B
379  {
380  return kInfinity ;
381  }
382  dist2 = dist+disTmp;
383  if (dist == dist2) { return dist; } // no progress
384  dist = dist2 ;
385  count2++;
386  if( count2 > 1000 ) // Infinite loop detected
387  {
388  G4String nameB = fPtrSolidB->GetName();
389  if(fPtrSolidB->GetEntityType()=="G4DisplacedSolid")
390  {
391  nameB = (dynamic_cast<G4DisplacedSolid*>(fPtrSolidB))
392  ->GetConstituentMovedSolid()->GetName();
393  }
394  std::ostringstream message;
395  message << "Illegal condition caused by solids: "
396  << fPtrSolidA->GetName() << " and " << nameB << G4endl;
397  message.precision(16);
398  message << "Looping detected in point " << p+dist*v
399  << ", from original point " << p
400  << " and direction " << v << G4endl
401  << "Computed candidate distance: " << dist << "*mm. ";
402  message.precision(6);
403  DumpInfo();
404  G4Exception("G4SubtractionSolid::DistanceToIn(p,v)",
405  "GeomSolids1001", JustWarning, message,
406  "Returning candidate distance.");
407  return dist;
408  }
409  }
410  } // Loop checking, 13.08.2015, G.Cosmo
411  }
412  }
413 
414  return dist ;
415 }
G4String GetName() const
G4VSolid * fPtrSolidB
static const G4double kInfinity
Definition: geomdefs.hh:42
virtual G4GeometryType GetEntityType() const =0
int G4int
Definition: G4Types.hh:78
void DumpInfo() const
G4GLOB_DLL std::ostream G4cout
virtual EInside Inside(const G4ThreeVector &p) const =0
EInside Inside(const G4ThreeVector &p) const
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:

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

Implements G4VSolid.

Definition at line 424 of file G4SubtractionSolid.cc.

425 {
426  G4double dist=0.0;
427 
428 #ifdef G4BOOLDEBUG
429  if( Inside(p) == kInside )
430  {
431  G4cout << "WARNING - Invalid call in "
432  << "G4SubtractionSolid::DistanceToIn(p)" << G4endl
433  << " Point p is inside !" << G4endl;
434  G4cout << " p = " << p << G4endl;
435  G4cerr << "WARNING - Invalid call in "
436  << "G4SubtractionSolid::DistanceToIn(p)" << G4endl
437  << " Point p is inside !" << G4endl;
438  G4cerr << " p = " << p << G4endl;
439  }
440 #endif
441 
442  if( ( fPtrSolidA->Inside(p) != kOutside) && // case 1
443  ( fPtrSolidB->Inside(p) != kOutside) )
444  {
445  dist= fPtrSolidB->DistanceToOut(p) ;
446  }
447  else
448  {
449  dist= fPtrSolidA->DistanceToIn(p) ;
450  }
451 
452  return dist;
453 }
G4VSolid * fPtrSolidB
G4GLOB_DLL std::ostream G4cout
virtual EInside Inside(const G4ThreeVector &p) const =0
EInside Inside(const G4ThreeVector &p) const
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:

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 460 of file G4SubtractionSolid.cc.

465 {
466 #ifdef G4BOOLDEBUG
467  if( Inside(p) == kOutside )
468  {
469  G4cout << "Position:" << G4endl << G4endl;
470  G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
471  G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
472  G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
473  G4cout << "Direction:" << G4endl << G4endl;
474  G4cout << "v.x() = " << v.x() << G4endl;
475  G4cout << "v.y() = " << v.y() << G4endl;
476  G4cout << "v.z() = " << v.z() << G4endl << G4endl;
477  G4cout << "WARNING - Invalid call in "
478  << "G4SubtractionSolid::DistanceToOut(p,v)" << G4endl
479  << " Point p is outside !" << G4endl;
480  G4cout << " p = " << p << G4endl;
481  G4cout << " v = " << v << G4endl;
482  G4cerr << "WARNING - Invalid call in "
483  << "G4SubtractionSolid::DistanceToOut(p,v)" << G4endl
484  << " Point p is outside !" << G4endl;
485  G4cerr << " p = " << p << G4endl;
486  G4cerr << " v = " << v << G4endl;
487  }
488 #endif
489 
490  G4double distout;
491  G4double distA = fPtrSolidA->DistanceToOut(p,v,calcNorm,validNorm,n) ;
492  G4double distB = fPtrSolidB->DistanceToIn(p,v) ;
493  if(distB < distA)
494  {
495  if(calcNorm)
496  {
497  *n = -(fPtrSolidB->SurfaceNormal(p+distB*v)) ;
498  *validNorm = false ;
499  }
500  distout= distB ;
501  }
502  else
503  {
504  distout= distA ;
505  }
506  return distout;
507 }
G4VSolid * fPtrSolidB
static constexpr double mm
Definition: G4SIunits.hh:115
double x() const
double z() const
G4GLOB_DLL std::ostream G4cout
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
EInside Inside(const G4ThreeVector &p) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
double y() 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
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

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

Implements G4VSolid.

Definition at line 514 of file G4SubtractionSolid.cc.

515 {
516  G4double dist=0.0;
517 
518  if( Inside(p) == kOutside )
519  {
520 #ifdef G4BOOLDEBUG
521  G4cout << "WARNING - Invalid call in "
522  << "G4SubtractionSolid::DistanceToOut(p)" << G4endl
523  << " Point p is outside" << G4endl;
524  G4cout << " p = " << p << G4endl;
525  G4cerr << "WARNING - Invalid call in "
526  << "G4SubtractionSolid::DistanceToOut(p)" << G4endl
527  << " Point p is outside" << G4endl;
528  G4cerr << " p = " << p << G4endl;
529 #endif
530  }
531  else
532  {
534  fPtrSolidB->DistanceToIn(p) ) ;
535  }
536  return dist;
537 }
G4VSolid * fPtrSolidB
G4GLOB_DLL std::ostream G4cout
EInside Inside(const G4ThreeVector &p) const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
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:

void G4SubtractionSolid::Extent ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 142 of file G4SubtractionSolid.cc.

143 {
144  // Since it is unclear how the shape of the first solid will be changed
145  // after subtraction, just return its original bounding box.
146  //
147  fPtrSolidA->Extent(pMin,pMax);
148 
149  // Check correctness of the bounding box
150  //
151  if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
152  {
153  std::ostringstream message;
154  message << "Bad bounding box (min >= max) for solid: "
155  << GetName() << " !"
156  << "\npMin = " << pMin
157  << "\npMax = " << pMax;
158  G4Exception("G4SubtractionSolid::Extent()", "GeomMgt0001",
159  JustWarning, message);
160  DumpInfo();
161  }
162 }
G4String GetName() const
double x() const
double z() const
void DumpInfo() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double y() const
G4VSolid * fPtrSolidA
virtual void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:626

Here is the call graph for this function:

G4GeometryType G4SubtractionSolid::GetEntityType ( ) const
virtual

Reimplemented from G4BooleanSolid.

Definition at line 543 of file G4SubtractionSolid.cc.

544 {
545  return G4String("G4SubtractionSolid");
546 }
EInside G4SubtractionSolid::Inside ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 186 of file G4SubtractionSolid.cc.

187 {
188  EInside positionA = fPtrSolidA->Inside(p);
189  if (positionA == kOutside) return kOutside;
190 
191  EInside positionB = fPtrSolidB->Inside(p);
192 
193  if(positionA == kInside && positionB == kOutside)
194  {
195  return kInside ;
196  }
197  else
198  {
199  static const G4double rtol
201  if(( positionA == kInside && positionB == kSurface) ||
202  ( positionB == kOutside && positionA == kSurface) ||
203  ( positionA == kSurface && positionB == kSurface &&
204  ( fPtrSolidA->SurfaceNormal(p) -
205  fPtrSolidB->SurfaceNormal(p) ).mag2() > rtol ) )
206  {
207  return kSurface;
208  }
209  else
210  {
211  return kOutside;
212  }
213  }
214 }
G4VSolid * fPtrSolidB
virtual EInside Inside(const G4ThreeVector &p) const =0
G4double GetRadialTolerance() const
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:

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:

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

Implements G4VSolid.

Definition at line 221 of file G4SubtractionSolid.cc.

222 {
224 
225  EInside InsideA = fPtrSolidA->Inside(p);
226  EInside InsideB = fPtrSolidB->Inside(p);
227 
228  if( InsideA == kOutside )
229  {
230 #ifdef G4BOOLDEBUG
231  G4cout << "WARNING - Invalid call [1] in "
232  << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
233  << " Point p is outside !" << G4endl;
234  G4cout << " p = " << p << G4endl;
235  G4cerr << "WARNING - Invalid call [1] in "
236  << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
237  << " Point p is outside !" << G4endl;
238  G4cerr << " p = " << p << G4endl;
239 #endif
240  normal = fPtrSolidA->SurfaceNormal(p) ;
241  }
242  else if( InsideA == kSurface &&
243  InsideB != kInside )
244  {
245  normal = fPtrSolidA->SurfaceNormal(p) ;
246  }
247  else if( InsideA == kInside &&
248  InsideB != kOutside )
249  {
250  normal = -fPtrSolidB->SurfaceNormal(p) ;
251  }
252  else
253  {
255  {
256  normal = fPtrSolidA->SurfaceNormal(p) ;
257  }
258  else
259  {
260  normal = -fPtrSolidB->SurfaceNormal(p) ;
261  }
262 #ifdef G4BOOLDEBUG
263  if(Inside(p) == kInside)
264  {
265  G4cout << "WARNING - Invalid call [2] in "
266  << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
267  << " Point p is inside !" << G4endl;
268  G4cout << " p = " << p << G4endl;
269  G4cerr << "WARNING - Invalid call [2] in "
270  << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
271  << " Point p is inside !" << G4endl;
272  G4cerr << " p = " << p << G4endl;
273  }
274 #endif
275  }
276  return normal;
277 }
G4VSolid * fPtrSolidB
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
EInside Inside(const G4ThreeVector &p) const
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: