Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
+37 -2
View File
@@ -1,5 +1,5 @@
$Id: History,v 1.5 2000/01/19 19:24:25 gcosmo Exp $
$Id: History,v 1.12 2000/06/26 16:16:06 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,7 +20,42 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Gen 19 2000 Gabriele Cosmo geom-solid-bool-V01-00-00
June 26 2000 Vladimir Grichine geom-solid-bool-V01-01-03
- Fixed bug in G4SubtractionSolid::DistanceToOut(p,v,...). validNorm
flag was uncorrectly set to true. Fixes report #102.
June 6 2000 John Apostolakis geom-solid-bool-V01-01-02
- Protecting the use of pointers validNorm and n, if calcNorm is false
June 6 2000 John Allison geom-solid-bool-V01-01-01
- Re-enabled CreatePolyhedron() method from G4UnionSolid, G4IntersectionSolid
and G4SubtractionSolid. Coworks with greps-V01-01-04.
May 26 2000 John Allison geom-solid-bool-V01-01-00
- Disabled CreatePolyhedron() method from G4UnionSolid, G4IntersectionSolid
and G4SubtractionSolid. It now temporarly returns a NULL pointer.
Visualisation of Boolean solids is therefore temporarly disabled, pending
a definitive fix in graphics_reps.
Files G4UnionSolid.cc, G4SubtractionSolid.cc and G4IntersectionSolid.cc
are included in the branch-tag "boolean_nopoly_branch".
Apr 27 2000 Gabriele Cosmo
- Reorganised comments for the Software Reference Manual.
- Added CVS headers and standard G4 header where missing.
Apr 11 2000 John Allison
- CreatePolyhedron implemented for BooleanSolids.
- G4DisplacedSolid: reversed implementation of GetFrameRotation and
GetObjectRotation, removing inappropriate invertion.
- G4DisplacedSolid::GetConstituentMovedSolid() made const.
Jan 19 2000 Gabriele Cosmo geom-solid-bool-V01-00-00
- Syncronized file versions with HEAD (essentially CVS headers changes)
- Fixed cases of G4std::min which were not migrated on the HEAD in files:
@@ -1,11 +1,24 @@
// Class Description
// 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.hh,v 1.3 2000/04/27 09:59:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4BooleanSolid
//
// Class description:
//
// Abstract base class for solids created by boolean operations
// between other solids
// between other solids.
// History:
//
// 10.09.98 V.Grichine, creation according J. Apostolakis's recommendations
// 10.09.98 V.Grichine, creation according J. Apostolakis's recommendations.
#ifndef G4BOOLEANSOLID_HH
@@ -19,41 +32,42 @@
#include "G4Transform3D.hh"
#include "G4AffineTransform.hh"
class G4BooleanSolid: public G4VSolid
class G4BooleanSolid : public G4VSolid
{
public: // With Description
G4BooleanSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ) ;
public: // with description
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,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
G4BooleanSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
const G4Transform3D& transform ) ;
G4BooleanSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
const G4Transform3D& transform ) ;
virtual ~G4BooleanSolid() ;
virtual ~G4BooleanSolid() ;
public: // With Description
// If Solid is made up from a Boolean operation of two solids,
// return the corresponding solid (for no=0 and 1)
// If the solid is not a "Boolean", return 0
virtual const G4VSolid* GetConstituentSolid(G4int no) const;
virtual G4VSolid* GetConstituentSolid(G4int no);
// If Solid is made up from a Boolean operation of two solids,
// return the corresponding solid (for no=0 and 1)
// If the solid is not a "Boolean", return 0.
protected:
G4VSolid* fPtrSolidA ;
G4VSolid* fPtrSolidB ;
protected:
G4VSolid* fPtrSolidA ;
G4VSolid* fPtrSolidB ;
private:
G4bool createdDisplacedSolid; // If & only if this object
// created it, it must delete it
private:
G4bool createdDisplacedSolid;
// If & only if this object created it, it must delete it
} ;
#endif
@@ -1,9 +1,22 @@
// Class description
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// A displaced solid is a solid that has been shifted from its original
// frame of reference to a new one. It is meant to be used only for
// simplifying the implementation of "Boolean solids".
// 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.hh,v 1.7 2000/04/27 09:59:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4DisplacedSolid
//
// Class description:
//
// A displaced solid is a solid that has been shifted from its original
// frame of reference to a new one. It is meant to be used only for
// simplifying the implementation of "Boolean solids".
// History:
//
// 28.10.98 V.Grichine, creation according J. Apostolakis's recommendations
@@ -17,36 +30,36 @@
#include "G4Transform3D.hh"
#include "G4AffineTransform.hh"
class G4DisplacedSolid : public G4VSolid
class G4DisplacedSolid : public G4VSolid
{
public: // With description
G4DisplacedSolid( const G4String& pName,
G4VSolid* pSolid ,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
public: // with description
G4DisplacedSolid( const G4String& pName,
G4VSolid* pSolid ,
const G4Transform3D& transform ) ;
G4DisplacedSolid( const G4String& pName,
G4VSolid* pSolid ,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
public:
G4DisplacedSolid( const G4String& pName,
G4VSolid* pSolid ,
const G4AffineTransform directTransform );
// For use in instantiating a transient instance from a persistent one:
G4DisplacedSolid( const G4String& pName,
G4VSolid* pSolid ,
const G4Transform3D& transform ) ;
public: // With description
virtual ~G4DisplacedSolid() ;
//
// It also has all the methods that a solid requires, eg.
EInside Inside( const G4ThreeVector& p ) const ;
G4DisplacedSolid( const G4String& pName,
G4VSolid* pSolid ,
const G4AffineTransform directTransform );
// For use in instantiating a transient instance from a persistent one.
public:
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const ;
virtual ~G4DisplacedSolid() ;
public: // without description
// It also has all the methods that a solid requires, eg.
EInside Inside( const G4ThreeVector& p ) const ;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const ;
G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const ;
@@ -68,43 +81,46 @@ public:
const G4int n,
const G4VPhysicalVolume* pRep ) ;
public: // With description
public: // with description
virtual G4GeometryType GetEntityType() const
{ return G4String("G4DisplacedSolid"); }
virtual G4GeometryType GetEntityType() const;
// If the Solid is a "G4DisplacedSolid", return a self pointer
// else return 0
virtual const G4DisplacedSolid* GetDisplacedSolidPtr() const ;
virtual G4DisplacedSolid* GetDisplacedSolidPtr();
// If the Solid is a "G4DisplacedSolid",
// return a self pointer else return 0.
// Access methods
G4VSolid* GetConstituentMovedSolid();
G4VSolid* GetConstituentMovedSolid() const;
G4AffineTransform GetTransform() const;
G4AffineTransform GetDirectTransform() const;
// Get the rotation/translation, as applied to the frame of reference
// Access methods.
G4RotationMatrix GetFrameRotation() const;
G4ThreeVector GetFrameTranslation() const;
// Get the rotation/translation, as applied to the frame of reference.
// Get the rotation/translation, as applied to the object
G4RotationMatrix GetObjectRotation() const;
G4ThreeVector GetObjectTranslation() const;
// Get the rotation/translation, as applied to the object.
public: // without description
public:
// For creating graphical representations (ie for visualisation)
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
G4VisExtent GetExtent () const ;
G4Polyhedron* CreatePolyhedron () const ;
G4NURBS* CreateNURBS () const ;
// For creating graphical representations (ie for visualisation).
protected:
G4VSolid* fPtrSolid ;
G4AffineTransform* fPtrTransform ;
G4AffineTransform* fDirectTransform ;
protected:
G4VSolid* fPtrSolid ;
G4AffineTransform* fPtrTransform ;
G4AffineTransform* fDirectTransform ;
private:
} ;
inline G4GeometryType G4DisplacedSolid::GetEntityType() const
{
return G4String("G4DisplacedSolid");
}
#endif
@@ -1,5 +1,20 @@
// Class for description of intersection of two CSG solids
// 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.hh,v 1.3 2000/04/27 09:59:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4IntersectionSolid
//
// Class description:
//
// Class for description of intersection of two CSG solids.
// History:
//
// 12.09.98 V. Grichine, initial design according to J.Apostolakis's
@@ -11,38 +26,41 @@
#include "G4BooleanSolid.hh"
#include "G4VSolid.hh"
// #include "G4PlacedSolid.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4AffineTransform.hh"
class G4IntersectionSolid: public G4BooleanSolid
class G4IntersectionSolid : public G4BooleanSolid
{
public:
G4IntersectionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ) ;
public: // with description
G4IntersectionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
G4IntersectionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ) ;
G4IntersectionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB,
const G4Transform3D& transform ) ;
G4IntersectionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
virtual ~G4IntersectionSolid() ;
G4IntersectionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB,
const G4Transform3D& transform ) ;
virtual ~G4IntersectionSolid() ;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const ;
virtual G4GeometryType GetEntityType() const;
public: // without description
G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const ;
EInside Inside( const G4ThreeVector& p ) const ;
@@ -66,19 +84,16 @@ public:
const G4int n,
const G4VPhysicalVolume* pRep ) ;
virtual G4GeometryType GetEntityType() const
{ return G4String("G4IntersectionSolid"); }
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
G4VisExtent GetExtent () const ;
G4Polyhedron* CreatePolyhedron () const ;
G4NURBS* CreateNURBS () const ;
protected:
private:
} ;
inline G4GeometryType G4IntersectionSolid::GetEntityType() const
{
return G4String("G4IntersectionSolid");
}
#endif
@@ -1,16 +1,30 @@
// Class for description of subtraction of two CSG solids: A - B !!!
// 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.hh,v 1.3 2000/04/27 09:59:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4SubtractionSolid
//
// Class description:
//
// Class for description of subtraction of two CSG solids: A - B.
// History:
//
// 14.10.98 V.Grichine - first implementation
//
// 14.10.98 V.Grichine - first implementation.
#ifndef G4SUBTRACTIONSOLID_HH
#define G4SUBTRACTIONSOLID_HH
#include "G4BooleanSolid.hh"
#include "G4VSolid.hh"
// #include "G4PlacedSolid.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
@@ -18,29 +32,32 @@
#include "G4AffineTransform.hh"
class G4SubtractionSolid: public G4BooleanSolid
class G4SubtractionSolid : public G4BooleanSolid
{
public:
G4SubtractionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ) ;
public: // with description
G4SubtractionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
G4SubtractionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ) ;
G4SubtractionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
const G4Transform3D& transform ) ;
G4SubtractionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
virtual ~G4SubtractionSolid() ;
G4SubtractionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
const G4Transform3D& transform ) ;
virtual ~G4SubtractionSolid() ;
G4bool CalculateExtent(const EAxis pAxis,
virtual G4GeometryType GetEntityType() const ;
public: // without description
G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const ;
@@ -67,19 +84,16 @@ public:
const G4int n,
const G4VPhysicalVolume* pRep ) ;
virtual G4GeometryType GetEntityType() const
{ return G4String("G4SubtractionSolid"); }
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
G4VisExtent GetExtent () const ;
G4Polyhedron* CreatePolyhedron () const ;
G4NURBS* CreateNURBS () const ;
protected:
};
private:
} ;
inline G4GeometryType G4SubtractionSolid::GetEntityType() const
{
return G4String("G4SubtractionSolid");
}
#endif
@@ -1,47 +1,64 @@
// Class for description of intersection of two CSG solids
// 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.hh,v 1.4 2000/04/27 09:59:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4UnionSolid
//
// Class description:
//
// Class for description of union of two CSG solids.
// History:
//
// 12.09.98 V.Grichine
//
// 12.09.98 V.Grichine, created.
#ifndef G4UNIONSOLID_HH
#define G4UNIONSOLID_HH
#include "G4BooleanSolid.hh"
#include "G4VSolid.hh"
// #include "G4PlacedSolid.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
#include "G4Transform3D.hh"
#include "G4AffineTransform.hh"
class G4UnionSolid: public G4BooleanSolid
class G4UnionSolid : public G4BooleanSolid
{
public:
G4UnionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ) ;
public: // with description
G4UnionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
G4UnionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ) ;
G4UnionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
const G4Transform3D& transform ) ;
G4UnionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
G4RotationMatrix* rotMatrix,
const G4ThreeVector& transVector ) ;
virtual ~G4UnionSolid() ;
G4UnionSolid( const G4String& pName,
G4VSolid* pSolidA ,
G4VSolid* pSolidB ,
const G4Transform3D& transform ) ;
virtual ~G4UnionSolid() ;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const ;
virtual G4GeometryType GetEntityType() const ;
public: // without description
G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const ;
EInside Inside( const G4ThreeVector& p ) const ;
@@ -65,19 +82,16 @@ public:
const G4int n,
const G4VPhysicalVolume* pRep ) ;
virtual G4GeometryType GetEntityType() const
{ return G4String("G4UnionSolid"); }
void DescribeYourselfTo ( G4VGraphicsScene& scene ) const ;
G4VisExtent GetExtent () const ;
G4Polyhedron* CreatePolyhedron () const ;
G4NURBS* CreateNURBS () const ;
protected:
};
private:
} ;
inline G4GeometryType G4UnionSolid::GetEntityType() const
{
return G4String("G4UnionSolid");
}
#endif
@@ -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;
}