Import Geant4 2.0.0 source tree
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4IntersectionSolid.cc,v 1.8 2000/06/24 14:27:41 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
// History:
|
||||
@@ -20,7 +30,6 @@
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4NURBS.hh"
|
||||
#include "G4NURBSbox.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -123,7 +132,6 @@ EInside G4IntersectionSolid::Inside(const G4ThreeVector& p) const
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
G4ThreeVector
|
||||
G4IntersectionSolid::SurfaceNormal( const G4ThreeVector& p ) const
|
||||
@@ -335,13 +343,36 @@ G4IntersectionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
G4bool *validNorm,
|
||||
G4ThreeVector *n ) const
|
||||
{
|
||||
G4bool validNormA, validNormB;
|
||||
G4ThreeVector nA, nB;
|
||||
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4cout << "Position:" << G4endl << G4endl;
|
||||
G4cout << "p.x() = " << p.x()/mm << " mm" << G4endl;
|
||||
G4cout << "p.y() = " << p.y()/mm << " mm" << G4endl;
|
||||
G4cout << "p.z() = " << p.z()/mm << " mm" << G4endl << G4endl;
|
||||
G4cout << "Direction:" << G4endl << G4endl;
|
||||
G4cout << "v.x() = " << v.x() << G4endl;
|
||||
G4cout << "v.y() = " << v.y() << G4endl;
|
||||
G4cout << "v.z() = " << v.z() << G4endl << G4endl;
|
||||
G4Exception("Invalid call in G4IntersectionSolid::DistanceToOut(p,v), point p is outside") ;
|
||||
}
|
||||
G4double distA = fPtrSolidA->DistanceToOut(p,v,calcNorm,validNorm,n) ;
|
||||
G4double distB = fPtrSolidB->DistanceToOut(p,v,calcNorm,validNorm,n) ;
|
||||
G4double distA = fPtrSolidA->DistanceToOut(p,v,calcNorm,&validNormA,&nA) ;
|
||||
G4double distB = fPtrSolidB->DistanceToOut(p,v,calcNorm,&validNormB,&nB) ;
|
||||
|
||||
G4double dist = G4std::min(distA,distB) ;
|
||||
|
||||
if( calcNorm ){
|
||||
if (distA < distB ) {
|
||||
*validNorm = validNormA;
|
||||
*n = nA;
|
||||
}else{
|
||||
*validNorm = validNormB;
|
||||
*n = nB;
|
||||
}
|
||||
}
|
||||
|
||||
return dist ;
|
||||
// return G4std::min(fPtrSolidA->DistanceToOut(p,v,calcNorm,validNorm,n),
|
||||
// fPtrSolidB->DistanceToOut(p,v,calcNorm,validNorm,n) ) ;
|
||||
@@ -384,17 +415,7 @@ G4IntersectionSolid::ComputeDimensions( G4VPVParameterisation* p,
|
||||
void
|
||||
G4IntersectionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
G4VisExtent
|
||||
G4IntersectionSolid::GetExtent () const
|
||||
{
|
||||
return G4VisExtent(-1.0,1.0,-1.0,1.0,-1.0,1.0) ;
|
||||
scene.AddThis (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -404,7 +425,12 @@ G4IntersectionSolid::GetExtent () const
|
||||
G4Polyhedron*
|
||||
G4IntersectionSolid::CreatePolyhedron () const
|
||||
{
|
||||
return new G4PolyhedronBox (1.0, 1.0, 1.0);
|
||||
G4Polyhedron* pA = fPtrSolidA->CreatePolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->CreatePolyhedron();
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->intersect(*pB));
|
||||
delete pB;
|
||||
delete pA;
|
||||
return resultant;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
@@ -414,10 +440,7 @@ G4IntersectionSolid::CreatePolyhedron () const
|
||||
G4NURBS*
|
||||
G4IntersectionSolid::CreateNURBS () const
|
||||
{
|
||||
return new G4NURBSbox (1.0, 1.0, 1.0);
|
||||
// Take into account boolean operation - see CreatePolyhedron.
|
||||
// return new G4NURBSbox (1.0, 1.0, 1.0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user