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: G4BooleanSolid.cc,v 1.3 2000/04/27 09:59:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Implementation for the abstract base class for solids created by boolean
|
||||
// operations between other solids
|
||||
//
|
||||
|
||||
@@ -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: G4DisplacedSolid.cc,v 1.11 2000/04/27 09:59:39 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Implementation for G4DisplacedSolid class for boolean
|
||||
// operations between other solids
|
||||
//
|
||||
@@ -18,7 +28,6 @@
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4NURBS.hh"
|
||||
#include "G4NURBSbox.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -87,7 +96,7 @@ const G4DisplacedSolid* G4DisplacedSolid::GetDisplacedSolidPtr() const
|
||||
G4DisplacedSolid* G4DisplacedSolid::GetDisplacedSolidPtr()
|
||||
{ return this; }
|
||||
|
||||
G4VSolid* G4DisplacedSolid::GetConstituentMovedSolid()
|
||||
G4VSolid* G4DisplacedSolid::GetConstituentMovedSolid() const
|
||||
{ return fPtrSolid; }
|
||||
|
||||
G4AffineTransform G4DisplacedSolid::GetTransform() const
|
||||
@@ -104,8 +113,7 @@ G4AffineTransform G4DisplacedSolid::GetDirectTransform() const
|
||||
|
||||
G4RotationMatrix G4DisplacedSolid::GetFrameRotation() const
|
||||
{
|
||||
G4RotationMatrix InvRotation= fPtrTransform->NetRotation();
|
||||
InvRotation.invert();
|
||||
G4RotationMatrix InvRotation= fDirectTransform->NetRotation();
|
||||
return InvRotation;
|
||||
}
|
||||
|
||||
@@ -117,7 +125,7 @@ G4ThreeVector G4DisplacedSolid::GetFrameTranslation() const
|
||||
///////////////////////////////////////////////////////////////
|
||||
G4RotationMatrix G4DisplacedSolid::GetObjectRotation() const
|
||||
{
|
||||
G4RotationMatrix Rotation= fDirectTransform->NetRotation();
|
||||
G4RotationMatrix Rotation= fPtrTransform->NetRotation();
|
||||
return Rotation;
|
||||
}
|
||||
|
||||
@@ -245,17 +253,7 @@ G4DisplacedSolid::ComputeDimensions( G4VPVParameterisation* p,
|
||||
void
|
||||
G4DisplacedSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
{
|
||||
fPtrSolid->DescribeYourselfTo(scene) ;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
G4VisExtent
|
||||
G4DisplacedSolid::GetExtent () const
|
||||
{
|
||||
return fPtrSolid->GetExtent() ;
|
||||
scene.AddThis (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -265,7 +263,10 @@ G4DisplacedSolid::GetExtent () const
|
||||
G4Polyhedron*
|
||||
G4DisplacedSolid::CreatePolyhedron () const
|
||||
{
|
||||
return fPtrSolid->CreatePolyhedron() ;
|
||||
G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
|
||||
polyhedron->Transform
|
||||
(G4Transform3D(GetObjectRotation(),GetObjectTranslation()));
|
||||
return polyhedron;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
@@ -275,10 +276,7 @@ G4DisplacedSolid::CreatePolyhedron () const
|
||||
G4NURBS*
|
||||
G4DisplacedSolid::CreateNURBS () const
|
||||
{
|
||||
return fPtrSolid->CreateNURBS() ;
|
||||
// Take into account local transformation - see CreatePolyhedron.
|
||||
// return fPtrSolid->CreateNURBS() ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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: G4SubtractionSolid.cc,v 1.8 2000/06/26 16:16:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
// History:
|
||||
@@ -24,7 +34,6 @@
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4NURBS.hh"
|
||||
#include "G4NURBSbox.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -268,7 +277,15 @@ G4SubtractionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
{
|
||||
if( Inside(p) == kOutside )
|
||||
{
|
||||
G4Exception("Invalid call in G4IntersectionSolid::DistanceToOut(p,v), point p is outside") ;
|
||||
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 distout;
|
||||
@@ -286,7 +303,6 @@ G4SubtractionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
else
|
||||
{
|
||||
distout= distA ;
|
||||
*validNorm = true ;
|
||||
}
|
||||
return distout;
|
||||
}
|
||||
@@ -331,17 +347,7 @@ G4SubtractionSolid::ComputeDimensions( G4VPVParameterisation* p,
|
||||
void
|
||||
G4SubtractionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
G4VisExtent
|
||||
G4SubtractionSolid::GetExtent () const
|
||||
{
|
||||
return G4VisExtent(-1.0,1.0,-1.0,1.0,-1.0,1.0) ;
|
||||
scene.AddThis (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -351,7 +357,12 @@ G4SubtractionSolid::GetExtent () const
|
||||
G4Polyhedron*
|
||||
G4SubtractionSolid::CreatePolyhedron () const
|
||||
{
|
||||
return new G4PolyhedronBox (1.0, 1.0, 1.0);
|
||||
G4Polyhedron* pA = fPtrSolidA->CreatePolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->CreatePolyhedron();
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->subtract(*pB));
|
||||
delete pB;
|
||||
delete pA;
|
||||
return resultant;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
@@ -361,10 +372,7 @@ G4SubtractionSolid::CreatePolyhedron () const
|
||||
G4NURBS*
|
||||
G4SubtractionSolid::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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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: G4UnionSolid.cc,v 1.9 2000/06/24 14:27:42 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Implementation of methods for the class G4IntersectionSolid
|
||||
//
|
||||
// History:
|
||||
@@ -22,7 +32,6 @@
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4NURBS.hh"
|
||||
#include "G4NURBSbox.hh"
|
||||
#include "G4VisExtent.hh"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -208,6 +217,14 @@ G4UnionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
|
||||
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") ;
|
||||
}
|
||||
else
|
||||
@@ -256,7 +273,9 @@ G4UnionSolid::DistanceToOut( const G4ThreeVector& p,
|
||||
*n = *nTmp ;
|
||||
}
|
||||
}
|
||||
*validNorm = false ;
|
||||
if( calcNorm )
|
||||
*validNorm = false ;
|
||||
|
||||
return dist ;
|
||||
}
|
||||
|
||||
@@ -321,17 +340,7 @@ G4UnionSolid::ComputeDimensions( G4VPVParameterisation* p,
|
||||
void
|
||||
G4UnionSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
G4VisExtent
|
||||
G4UnionSolid::GetExtent () const
|
||||
{
|
||||
return G4VisExtent(-1.0,1.0,-1.0,1.0,-1.0,1.0) ;
|
||||
scene.AddThis (*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -341,7 +350,12 @@ G4UnionSolid::GetExtent () const
|
||||
G4Polyhedron*
|
||||
G4UnionSolid::CreatePolyhedron () const
|
||||
{
|
||||
return new G4PolyhedronBox (1.0, 1.0, 1.0);
|
||||
G4Polyhedron* pA = fPtrSolidA->CreatePolyhedron();
|
||||
G4Polyhedron* pB = fPtrSolidB->CreatePolyhedron();
|
||||
G4Polyhedron* resultant = new G4Polyhedron (pA->add(*pB));
|
||||
delete pB;
|
||||
delete pA;
|
||||
return resultant;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
@@ -351,10 +365,7 @@ G4UnionSolid::CreatePolyhedron () const
|
||||
G4NURBS*
|
||||
G4UnionSolid::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