Import Geant4 7.1.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.4 2004/06/11 14:17:17 gcosmo Exp $
|
||||
# $Id: GNUmakefile,v 1.6 2005/05/09 13:44:58 gcosmo Exp $
|
||||
# ----------------------------------------------------------------
|
||||
# GNUmakefile for geometry/CSG library. Gabriele Cosmo, 16/11/96.
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
$Id: History,v 1.48 2004/10/10 10:50:44 johna Exp $
|
||||
$Id: History,v 1.52 2005/05/09 13:46:03 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -20,6 +20,34 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
May 04, 2005 V.Grichine geom-bool-V07-00-03
|
||||
- Make the new implementation of Inside() with surface-normal for
|
||||
edges/vertices the deafult one.
|
||||
Removed G4NEW_SURF_NORMAL compilation flag.
|
||||
|
||||
Mar 23, 2005 J.Allison geom-bool-V07-00-02
|
||||
- Added test for Number-Of-Rotation-Steps in GetPolyhedron()
|
||||
for G4DisplacedSolid and G4BooleanSolid. Requires tag "greps-V07-00-02".
|
||||
|
||||
Mar 10, 2005 V.Grichine geom-bool-V07-00-01
|
||||
- Modified Inside(p) G4SubtractionSolid and G4UnionSolid, to fix
|
||||
inconsistency for non-zero sum of surface-normals.
|
||||
Available only through activation of G4NEW_SURF_NORMAL compilation flag.
|
||||
- Updated unit tests.
|
||||
|
||||
Mar 03, 2005 J.Allison
|
||||
- Changed AddThis() to AddSolid() in the concrete implementations of
|
||||
DescribeYourselfTo(G4VGraphicsScene&) for all solids. Use the
|
||||
newly available CreatePolyhedron() for components of Boolean
|
||||
solids, instead of GetPolyhedron().
|
||||
|
||||
Feb 22, 2005 V.Grichine geom-bool-V07-00-00
|
||||
- Fix in G4IntersectionSolid::DistanceToIn(p,v) to allow for correct
|
||||
simmetrical treatment of the solids' intersection. Algorithm reviewed
|
||||
as proposed by D.Bazzacco in problem report #723.
|
||||
- New unit test testBoolSurfaceInOut.cc for checking dIn-dOut and AB,
|
||||
BA booleans on surface.
|
||||
|
||||
Oct 10, 2004 J.Allison geom-bool-V06-02-01
|
||||
- Added GetPolyhedron, a smart access function that creates a G4Polyhedron
|
||||
on request and stores for future access. A null pointer means "not
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4BooleanSolid.hh,v 1.11 2004/10/10 10:50:46 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// class G4BooleanSolid
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4BooleanSolid.icc,v 1.1 2004/09/22 09:27:47 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4DisplacedSolid.hh,v 1.16 2004/10/10 10:50:48 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// class G4DisplacedSolid
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4IntersectionSolid.hh,v 1.7 2003/11/03 17:48:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// class G4IntersectionSolid
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SubtractionSolid.hh,v 1.7 2003/11/03 17:48:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// class G4SubtractionSolid
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UnionSolid.hh,v 1.8 2003/11/03 17:48:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// class G4UnionSolid
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4BooleanSolid.cc,v 1.14 2004/10/13 13:19:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4BooleanSolid.cc,v 1.16 2005/04/04 09:44:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// Implementation for the abstract base class for solids created by boolean
|
||||
// operations between other solids
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "G4BooleanSolid.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4Polyhedron.hh"
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -91,6 +92,7 @@ G4BooleanSolid::~G4BooleanSolid()
|
||||
{
|
||||
((G4DisplacedSolid*)fPtrSolidB)->CleanTransformations();
|
||||
}
|
||||
delete fpPolyhedron;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -171,9 +173,12 @@ std::ostream& G4BooleanSolid::StreamInfo(std::ostream& os) const
|
||||
|
||||
G4Polyhedron* G4BooleanSolid::GetPolyhedron () const
|
||||
{
|
||||
if (!fpPolyhedron)
|
||||
{
|
||||
fpPolyhedron = CreatePolyhedron();
|
||||
}
|
||||
if (!fpPolyhedron ||
|
||||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
|
||||
fpPolyhedron->GetNumberOfRotationSteps())
|
||||
{
|
||||
delete fpPolyhedron;
|
||||
fpPolyhedron = CreatePolyhedron();
|
||||
}
|
||||
return fpPolyhedron;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DisplacedSolid.cc,v 1.21 2004/10/13 13:19:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4DisplacedSolid.cc,v 1.23 2005/03/23 17:16:31 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// Implementation for G4DisplacedSolid class for boolean
|
||||
// operations between other solids
|
||||
@@ -103,6 +103,7 @@ G4DisplacedSolid::G4DisplacedSolid( const G4String& pName,
|
||||
G4DisplacedSolid::~G4DisplacedSolid()
|
||||
{
|
||||
CleanTransformations();
|
||||
delete fpPolyhedron;
|
||||
}
|
||||
|
||||
G4GeometryType G4DisplacedSolid::GetEntityType() const
|
||||
@@ -361,7 +362,7 @@ std::ostream& G4DisplacedSolid::StreamInfo(std::ostream& os) const
|
||||
void
|
||||
G4DisplacedSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
{
|
||||
scene.AddThis (*this);
|
||||
scene.AddSolid (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -395,9 +396,12 @@ G4DisplacedSolid::CreateNURBS () const
|
||||
|
||||
G4Polyhedron* G4DisplacedSolid::GetPolyhedron () const
|
||||
{
|
||||
if (!fpPolyhedron)
|
||||
{
|
||||
fpPolyhedron = CreatePolyhedron();
|
||||
}
|
||||
if (!fpPolyhedron ||
|
||||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
|
||||
fpPolyhedron->GetNumberOfRotationSteps())
|
||||
{
|
||||
delete fpPolyhedron;
|
||||
fpPolyhedron = CreatePolyhedron();
|
||||
}
|
||||
return fpPolyhedron;
|
||||
}
|
||||
|
||||
@@ -21,17 +21,19 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4IntersectionSolid.cc,v 1.21 2003/11/03 17:48:45 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4IntersectionSolid.cc,v 1.24 2005/03/03 16:04:14 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 12.09.98 V.Grichine: first implementation
|
||||
// 29.07.99 V.Grichine: modifications in DistanceToIn(p,v)
|
||||
// 16.03.01 V.Grichine: modifications in CalculateExtent() and Inside()
|
||||
// 17.02.05 V.Grichine: bug was fixed in DistanceToIn(p,v) based on algorithm
|
||||
// proposed by Dino Bazzacco <dino.bazzacco@pd.infn.it>
|
||||
// 29.05.01 V.Grichine: bug was fixed in DistanceToIn(p,v)
|
||||
// 16.03.01 V.Grichine: modifications in CalculateExtent() and Inside()
|
||||
// 29.07.99 V.Grichine: modifications in DistanceToIn(p,v)
|
||||
// 12.09.98 V.Grichine: first implementation
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -218,7 +220,7 @@ G4double
|
||||
G4IntersectionSolid::DistanceToIn( const G4ThreeVector& p,
|
||||
const G4ThreeVector& v ) const
|
||||
{
|
||||
G4double dist = 0.0, disTmp = 0.0 ;
|
||||
G4double dist = 0.0;
|
||||
if( Inside(p) == kInside )
|
||||
{
|
||||
#ifdef G4BOOLDEBUG
|
||||
@@ -234,146 +236,77 @@ G4IntersectionSolid::DistanceToIn( const G4ThreeVector& p,
|
||||
G4cerr << " v = " << v << G4endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
else // if( Inside(p) == kSurface )
|
||||
{
|
||||
if( fPtrSolidA->Inside(p) != kOutside )
|
||||
EInside wA = fPtrSolidA->Inside(p);
|
||||
EInside wB = fPtrSolidB->Inside(p);
|
||||
|
||||
G4ThreeVector pA = p, pB = p;
|
||||
G4double dA = 0., dA1=0., dA2=0.;
|
||||
G4double dB = 0., dB1=0., dB2=0.;
|
||||
G4bool doA = true, doB = true;
|
||||
|
||||
while(true)
|
||||
{
|
||||
do
|
||||
if(doA)
|
||||
{
|
||||
if( fPtrSolidB->Inside(p+dist*v) == kInside )
|
||||
// find next valid range for A
|
||||
|
||||
dA1 = 0.;
|
||||
|
||||
if( wA != kInside )
|
||||
{
|
||||
disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) ;
|
||||
dA1 = fPtrSolidA->DistanceToIn(pA, v);
|
||||
|
||||
if( dA1 == kInfinity ) return kInfinity;
|
||||
|
||||
pA += dA1*v;
|
||||
}
|
||||
else
|
||||
{
|
||||
disTmp = fPtrSolidB->DistanceToIn(p+dist*v,v) ;
|
||||
}
|
||||
if( disTmp != kInfinity )
|
||||
{
|
||||
dist += disTmp ;
|
||||
if(Inside(p+dist*v) == kOutside )
|
||||
{
|
||||
if( fPtrSolidA->Inside(p+dist*v) == kInside )
|
||||
{
|
||||
disTmp = fPtrSolidA->DistanceToOut(p+dist*v,v) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
disTmp = fPtrSolidA->DistanceToIn(p+dist*v,v) ;
|
||||
}
|
||||
if( disTmp != kInfinity )
|
||||
{
|
||||
dist += disTmp ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity ;
|
||||
}
|
||||
dA2 = dA1 + fPtrSolidA->DistanceToOut(pA, v);
|
||||
}
|
||||
while( Inside(p+dist*v) == kOutside ) ;
|
||||
// while( fPtrSolidB->Inside(p) != kOutside ) ;
|
||||
}
|
||||
else if( fPtrSolidB->Inside(p) != kOutside )
|
||||
{
|
||||
do
|
||||
dA1 += dA;
|
||||
dA2 += dA;
|
||||
|
||||
if(doB)
|
||||
{
|
||||
if( fPtrSolidA->Inside(p+dist*v) == kInside )
|
||||
// find next valid range for B
|
||||
|
||||
dB1 = 0.;
|
||||
if(wB != kInside)
|
||||
{
|
||||
disTmp = fPtrSolidA->DistanceToOut(p+dist*v,v) ;
|
||||
dB1 = fPtrSolidB->DistanceToIn(pB, v);
|
||||
|
||||
if(dB1 == kInfinity) return kInfinity;
|
||||
|
||||
pB += dB1*v;
|
||||
}
|
||||
else
|
||||
{
|
||||
disTmp = fPtrSolidA->DistanceToIn(p+dist*v,v) ;
|
||||
}
|
||||
if( disTmp != kInfinity )
|
||||
{
|
||||
dist += disTmp ;
|
||||
if(Inside(p+dist*v) == kOutside )
|
||||
{
|
||||
if( fPtrSolidB->Inside(p+dist*v) == kInside )
|
||||
{
|
||||
disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
disTmp = fPtrSolidB->DistanceToIn(p+dist*v,v) ;
|
||||
}
|
||||
if( disTmp != kInfinity )
|
||||
{
|
||||
dist += disTmp ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity ;
|
||||
}
|
||||
dB2 = dB1 + fPtrSolidB->DistanceToOut(pB, v);
|
||||
}
|
||||
while( Inside(p+dist*v) == kOutside ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
dB1 += dB;
|
||||
dB2 += dB;
|
||||
|
||||
// check if they overlap
|
||||
|
||||
if( dA1 < dB1 )
|
||||
{
|
||||
if( fPtrSolidB->Inside(p+dist*v) == kInside )
|
||||
{
|
||||
disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
disTmp = fPtrSolidB->DistanceToIn(p+dist*v,v) ;
|
||||
}
|
||||
if( disTmp != kInfinity )
|
||||
{
|
||||
dist += disTmp ;
|
||||
if(Inside(p+dist*v) == kOutside )
|
||||
{
|
||||
if( fPtrSolidA->Inside(p+dist*v) == kInside )
|
||||
{
|
||||
disTmp = fPtrSolidA->DistanceToOut(p+dist*v,v) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
disTmp = fPtrSolidA->DistanceToIn(p+dist*v,v) ;
|
||||
}
|
||||
if( disTmp != kInfinity )
|
||||
{
|
||||
dist += disTmp ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInfinity ;
|
||||
}
|
||||
if( dB1 < dA2 ) return dB1;
|
||||
|
||||
dA = dA2;
|
||||
pA = p + dA*v; // continue from here
|
||||
wA = kSurface;
|
||||
doA = true;
|
||||
doB = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( dA1 < dB2 ) return dA1;
|
||||
|
||||
dB = dB2;
|
||||
pB = p + dB*v; // continue from here
|
||||
wB = kSurface;
|
||||
doB = true;
|
||||
doA = false;
|
||||
}
|
||||
while( Inside(p+dist*v) == kOutside ) ;
|
||||
}
|
||||
}
|
||||
return dist ;
|
||||
@@ -535,7 +468,7 @@ G4GeometryType G4IntersectionSolid::GetEntityType() const
|
||||
void
|
||||
G4IntersectionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
{
|
||||
scene.AddThis (*this);
|
||||
scene.AddSolid (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -545,11 +478,9 @@ G4IntersectionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
G4Polyhedron*
|
||||
G4IntersectionSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4Polyhedron* pA = fPtrSolidA->CreatePolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->CreatePolyhedron();
|
||||
G4Polyhedron* pA = fPtrSolidA->GetPolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->GetPolyhedron();
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->intersect(*pB));
|
||||
delete pB;
|
||||
delete pA;
|
||||
return resultant;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SubtractionSolid.cc,v 1.21 2004/02/27 08:38:09 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4SubtractionSolid.cc,v 1.25 2005/05/09 13:44:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -116,8 +116,8 @@ G4SubtractionSolid::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
EInside G4SubtractionSolid::Inside( const G4ThreeVector& p ) const
|
||||
{
|
||||
EInside positionA = fPtrSolidA->Inside(p) ;
|
||||
EInside positionB = fPtrSolidB->Inside(p) ;
|
||||
EInside positionA = fPtrSolidA->Inside(p);
|
||||
EInside positionB = fPtrSolidB->Inside(p);
|
||||
|
||||
if(positionA == kInside && positionB == kOutside)
|
||||
{
|
||||
@@ -125,16 +125,13 @@ EInside G4SubtractionSolid::Inside( const G4ThreeVector& p ) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if((positionA == kInside && positionB == kSurface) ||
|
||||
(positionB == kOutside && positionA == kSurface) ||
|
||||
(positionA == kSurface && positionB == kSurface) )
|
||||
{
|
||||
return kSurface ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kOutside ;
|
||||
}
|
||||
if(( positionA == kInside && positionB == kSurface) ||
|
||||
( positionB == kOutside && positionA == kSurface) ||
|
||||
( positionA == kSurface && positionB == kSurface &&
|
||||
( fPtrSolidA->SurfaceNormal(p) -
|
||||
fPtrSolidB->SurfaceNormal(p) ).mag2() >
|
||||
1000*kRadTolerance ) ) return kSurface;
|
||||
else return kOutside;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +429,7 @@ G4SubtractionSolid::ComputeDimensions( G4VPVParameterisation*,
|
||||
void
|
||||
G4SubtractionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
{
|
||||
scene.AddThis (*this);
|
||||
scene.AddSolid (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -442,11 +439,9 @@ G4SubtractionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
G4Polyhedron*
|
||||
G4SubtractionSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4Polyhedron* pA = fPtrSolidA->CreatePolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->CreatePolyhedron();
|
||||
G4Polyhedron* pA = fPtrSolidA->GetPolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->GetPolyhedron();
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->subtract(*pB));
|
||||
delete pB;
|
||||
delete pA;
|
||||
return resultant;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UnionSolid.cc,v 1.25 2004/02/27 08:38:09 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4UnionSolid.cc,v 1.29 2005/05/09 13:44:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
@@ -130,25 +130,20 @@ G4UnionSolid::CalculateExtent( const EAxis pAxis,
|
||||
|
||||
EInside G4UnionSolid::Inside( const G4ThreeVector& p ) const
|
||||
{
|
||||
EInside positionA = fPtrSolidA->Inside(p) ;
|
||||
EInside positionB = fPtrSolidB->Inside(p) ;
|
||||
|
||||
if( positionA == kInside || positionB == kInside )
|
||||
{
|
||||
return kInside ;
|
||||
}
|
||||
EInside positionA = fPtrSolidA->Inside(p);
|
||||
EInside positionB = fPtrSolidB->Inside(p);
|
||||
|
||||
if( positionA == kInside || positionB == kInside ||
|
||||
( positionA == kSurface && positionB == kSurface &&
|
||||
( fPtrSolidA->SurfaceNormal(p) +
|
||||
fPtrSolidB->SurfaceNormal(p) ).mag2() <
|
||||
1000*kRadTolerance ) ) return kInside;
|
||||
else
|
||||
{
|
||||
if((positionA != kInside && positionB == kSurface) ||
|
||||
(positionB != kInside && positionA == kSurface) ||
|
||||
(positionA == kSurface && positionB == kSurface) )
|
||||
{
|
||||
return kSurface ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kOutside ;
|
||||
}
|
||||
if( ( positionA != kInside && positionB == kSurface ) ||
|
||||
( positionB != kInside && positionA == kSurface ) ||
|
||||
( positionA == kSurface && positionB == kSurface ) ) return kSurface;
|
||||
else return kOutside;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +423,7 @@ G4UnionSolid::ComputeDimensions( G4VPVParameterisation*,
|
||||
void
|
||||
G4UnionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
{
|
||||
scene.AddThis (*this);
|
||||
scene.AddSolid (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -438,11 +433,9 @@ G4UnionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
G4Polyhedron*
|
||||
G4UnionSolid::CreatePolyhedron () const
|
||||
{
|
||||
G4Polyhedron* pA = fPtrSolidA->CreatePolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->CreatePolyhedron();
|
||||
G4Polyhedron* pA = fPtrSolidA->GetPolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->GetPolyhedron();
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->add(*pB));
|
||||
delete pB;
|
||||
delete pA;
|
||||
return resultant;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user