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

#include <G4SubtractionSolid.hh>

+ Inheritance 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 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 46 of file G4SubtractionSolid.hh.

Constructor & Destructor Documentation

◆ G4SubtractionSolid() [1/5]

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

Definition at line 51 of file G4SubtractionSolid.cc.

54 : G4BooleanSolid(pName,pSolidA,pSolidB)
55{
56}

◆ G4SubtractionSolid() [2/5]

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

Definition at line 62 of file G4SubtractionSolid.cc.

67 : G4BooleanSolid(pName,pSolidA,pSolidB,rotMatrix,transVector)
68{
69}

◆ G4SubtractionSolid() [3/5]

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

Definition at line 75 of file G4SubtractionSolid.cc.

79 : G4BooleanSolid(pName,pSolidA,pSolidB,transform)
80{
81}

◆ ~G4SubtractionSolid()

G4SubtractionSolid::~G4SubtractionSolid ( )
virtual

Definition at line 97 of file G4SubtractionSolid.cc.

98{
99}

◆ G4SubtractionSolid() [4/5]

G4SubtractionSolid::G4SubtractionSolid ( __void__ &  a)

Definition at line 88 of file G4SubtractionSolid.cc.

90{
91}

◆ G4SubtractionSolid() [5/5]

G4SubtractionSolid::G4SubtractionSolid ( const G4SubtractionSolid rhs)

Definition at line 105 of file G4SubtractionSolid.cc.

106 : G4BooleanSolid (rhs)
107{
108}

Member Function Documentation

◆ BoundingLimits()

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

Reimplemented from G4VSolid.

Definition at line 133 of file G4SubtractionSolid.cc.

135{
136 // Since it is unclear how the shape of the first solid will be changed
137 // after subtraction, just return its original bounding box.
138 //
139 fPtrSolidA->BoundingLimits(pMin,pMax);
140
141 // Check correctness of the bounding box
142 //
143 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
144 {
145 std::ostringstream message;
146 message << "Bad bounding box (min >= max) for solid: "
147 << GetName() << " !"
148 << "\npMin = " << pMin
149 << "\npMax = " << pMax;
150 G4Exception("G4SubtractionSolid::BoundingLimits()", "GeomMgt0001",
151 JustWarning, message);
152 DumpInfo();
153 }
154}
@ 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
G4VSolid * fPtrSolidA
G4String GetName() const
void DumpInfo() const
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:653

◆ CalculateExtent()

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

Implements G4VSolid.

Definition at line 161 of file G4SubtractionSolid.cc.

166{
167 // Since we cannot be sure how much the second solid subtracts
168 // from the first, we must use the first solid's extent!
169
170 return fPtrSolidA->CalculateExtent( pAxis, pVoxelLimit,
171 pTransform, pMin, pMax );
172}
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0

◆ Clone()

G4VSolid * G4SubtractionSolid::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 533 of file G4SubtractionSolid.cc.

534{
535 return new G4SubtractionSolid(*this);
536}

◆ ComputeDimensions()

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

Reimplemented from G4VSolid.

Definition at line 543 of file G4SubtractionSolid.cc.

546{
547}

◆ CreatePolyhedron()

G4Polyhedron * G4SubtractionSolid::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 564 of file G4SubtractionSolid.cc.

565{
567 // Stack components and components of components recursively
568 // See G4BooleanSolid::StackPolyhedron
570 G4Polyhedron* result = new G4Polyhedron(*top);
571 if (processor.execute(*result)) { return result; }
572 else { return nullptr; }
573}
G4Polyhedron * StackPolyhedron(HepPolyhedronProcessor &, const G4VSolid *) const
#define processor
Definition: xmlparse.cc:617

◆ DescribeYourselfTo()

void G4SubtractionSolid::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 554 of file G4SubtractionSolid.cc.

555{
556 scene.AddSolid (*this);
557}
virtual void AddSolid(const G4Box &)=0

◆ DistanceToIn() [1/2]

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

Implements G4VSolid.

Definition at line 405 of file G4SubtractionSolid.cc.

406{
407 G4double dist = 0.0;
408
409#ifdef G4BOOLDEBUG
410 if( Inside(p) == kInside )
411 {
412 G4cout << "WARNING - Invalid call in "
413 << "G4SubtractionSolid::DistanceToIn(p)" << G4endl
414 << " Point p is inside !" << G4endl;
415 G4cout << " p = " << p << G4endl;
416 G4cerr << "WARNING - Invalid call in "
417 << "G4SubtractionSolid::DistanceToIn(p)" << G4endl
418 << " Point p is inside !" << G4endl;
419 G4cerr << " p = " << p << G4endl;
420 }
421#endif
422
423 if( ( fPtrSolidA->Inside(p) != kOutside) && // case 1
424 ( fPtrSolidB->Inside(p) != kOutside) )
425 {
426 dist = fPtrSolidB->DistanceToOut(p);
427 }
428 else
429 {
430 dist = fPtrSolidA->DistanceToIn(p);
431 }
432
433 return dist;
434}
double G4double
Definition: G4Types.hh:83
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4VSolid * fPtrSolidB
EInside Inside(const G4ThreeVector &p) const
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 G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
@ kInside
Definition: geomdefs.hh:70
@ kOutside
Definition: geomdefs.hh:68

◆ DistanceToIn() [2/2]

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

Implements G4VSolid.

Definition at line 265 of file G4SubtractionSolid.cc.

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

◆ DistanceToOut() [1/2]

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

Implements G4VSolid.

Definition at line 495 of file G4SubtractionSolid.cc.

496{
497 G4double dist=0.0;
498
499 if( Inside(p) == kOutside )
500 {
501#ifdef G4BOOLDEBUG
502 G4cout << "WARNING - Invalid call in "
503 << "G4SubtractionSolid::DistanceToOut(p)" << G4endl
504 << " Point p is outside" << G4endl;
505 G4cout << " p = " << p << G4endl;
506 G4cerr << "WARNING - Invalid call in "
507 << "G4SubtractionSolid::DistanceToOut(p)" << G4endl
508 << " Point p is outside" << G4endl;
509 G4cerr << " p = " << p << G4endl;
510#endif
511 }
512 else
513 {
514 dist= std::min(fPtrSolidA->DistanceToOut(p),
515 fPtrSolidB->DistanceToIn(p) ) ;
516 }
517 return dist;
518}

◆ DistanceToOut() [2/2]

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

Implements G4VSolid.

Definition at line 441 of file G4SubtractionSolid.cc.

446{
447#ifdef G4BOOLDEBUG
448 if( Inside(p) == kOutside )
449 {
450 G4cout << "Position:" << G4endl << G4endl;
451 G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
452 G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
453 G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
454 G4cout << "Direction:" << G4endl << G4endl;
455 G4cout << "v.x() = " << v.x() << G4endl;
456 G4cout << "v.y() = " << v.y() << G4endl;
457 G4cout << "v.z() = " << v.z() << G4endl << G4endl;
458 G4cout << "WARNING - Invalid call in "
459 << "G4SubtractionSolid::DistanceToOut(p,v)" << G4endl
460 << " Point p is outside !" << G4endl;
461 G4cout << " p = " << p << G4endl;
462 G4cout << " v = " << v << G4endl;
463 G4cerr << "WARNING - Invalid call in "
464 << "G4SubtractionSolid::DistanceToOut(p,v)" << G4endl
465 << " Point p is outside !" << G4endl;
466 G4cerr << " p = " << p << G4endl;
467 G4cerr << " v = " << v << G4endl;
468 }
469#endif
470
471 G4double distout;
472 G4double distA = fPtrSolidA->DistanceToOut(p,v,calcNorm,validNorm,n) ;
473 G4double distB = fPtrSolidB->DistanceToIn(p,v) ;
474 if(distB < distA)
475 {
476 if(calcNorm)
477 {
478 *n = -(fPtrSolidB->SurfaceNormal(p+distB*v)) ;
479 *validNorm = false ;
480 }
481 distout= distB ;
482 }
483 else
484 {
485 distout= distA ;
486 }
487 return distout;
488}
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0

◆ GetEntityType()

G4GeometryType G4SubtractionSolid::GetEntityType ( ) const
virtual

Reimplemented from G4BooleanSolid.

Definition at line 524 of file G4SubtractionSolid.cc.

525{
526 return G4String("G4SubtractionSolid");
527}

◆ Inside()

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

Implements G4VSolid.

Definition at line 178 of file G4SubtractionSolid.cc.

179{
180 EInside positionA = fPtrSolidA->Inside(p);
181 if (positionA == kOutside) return positionA; // outside A
182
183 EInside positionB = fPtrSolidB->Inside(p);
184 if (positionB == kOutside) return positionA;
185
186 if (positionB == kInside) return kOutside;
187 if (positionA == kInside) return kSurface; // surface B
188
189 // Point is on both surfaces
190 //
191 static const G4double rtol = 1000*kCarTolerance;
192
193 return ((fPtrSolidA->SurfaceNormal(p) -
194 fPtrSolidB->SurfaceNormal(p)).mag2() > rtol) ? kSurface : kOutside;
195}
G4double kCarTolerance
Definition: G4VSolid.hh:302
EInside
Definition: geomdefs.hh:67
@ kSurface
Definition: geomdefs.hh:69

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

◆ operator=()

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

Definition at line 115 of file G4SubtractionSolid.cc.

116{
117 // Check assignment to self
118 //
119 if (this == &rhs) { return *this; }
120
121 // Copy base class data
122 //
124
125 return *this;
126}
G4BooleanSolid & operator=(const G4BooleanSolid &rhs)

◆ SurfaceNormal()

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

Implements G4VSolid.

Definition at line 202 of file G4SubtractionSolid.cc.

203{
204 G4ThreeVector normal;
205
206 EInside InsideA = fPtrSolidA->Inside(p);
207 EInside InsideB = fPtrSolidB->Inside(p);
208
209 if( InsideA == kOutside )
210 {
211#ifdef G4BOOLDEBUG
212 G4cout << "WARNING - Invalid call [1] in "
213 << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
214 << " Point p is outside !" << G4endl;
215 G4cout << " p = " << p << G4endl;
216 G4cerr << "WARNING - Invalid call [1] in "
217 << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
218 << " Point p is outside !" << G4endl;
219 G4cerr << " p = " << p << G4endl;
220#endif
221 normal = fPtrSolidA->SurfaceNormal(p) ;
222 }
223 else if( InsideA == kSurface &&
224 InsideB != kInside )
225 {
226 normal = fPtrSolidA->SurfaceNormal(p) ;
227 }
228 else if( InsideA == kInside &&
229 InsideB != kOutside )
230 {
231 normal = -fPtrSolidB->SurfaceNormal(p) ;
232 }
233 else
234 {
236 {
237 normal = fPtrSolidA->SurfaceNormal(p) ;
238 }
239 else
240 {
241 normal = -fPtrSolidB->SurfaceNormal(p) ;
242 }
243#ifdef G4BOOLDEBUG
244 if(Inside(p) == kInside)
245 {
246 G4cout << "WARNING - Invalid call [2] in "
247 << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
248 << " Point p is inside !" << G4endl;
249 G4cout << " p = " << p << G4endl;
250 G4cerr << "WARNING - Invalid call [2] in "
251 << "G4SubtractionSolid::SurfaceNormal(p)" << G4endl
252 << " Point p is inside !" << G4endl;
253 G4cerr << " p = " << p << G4endl;
254 }
255#endif
256 }
257 return normal;
258}

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