Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Box.hh,v 2.1 1998/07/12 02:56:49 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Box.hh,v 1.1 1999/01/07 16:07:51 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4Box
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4CSGSolid.hh,v 2.0 1998/07/02 17:01:58 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4CSGSolid.hh,v 1.1 1999/01/07 16:07:51 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4CSGSolid
@@ -4,6 +4,14 @@
// Declaration of a utility class of a polycon that can be clipped
// by a voxel
//
// ----------------------------------------------------------
// 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.
//
#ifndef G4ClippablePolycon_hh
#define G4ClippablePolycon_hh
@@ -23,18 +31,37 @@ typedef RWTValOrderedVector<G4ThreeVector> G4ThreeVectorList;
class G4ClippablePolygon {
public:
G4ClippablePolygon() {;}
~G4ClippablePolygon() {;}
virtual ~G4ClippablePolygon() {;}
void AddVertexInOrder( const G4ThreeVector vertex );
void ClearAllVertices();
virtual void AddVertexInOrder( const G4ThreeVector vertex );
virtual void ClearAllVertices();
void Clip( const G4VoxelLimits &voxelLimit );
virtual void SetNormal( const G4ThreeVector &newNormal ) { normal = newNormal; }
virtual const G4ThreeVector GetNormal() const { return normal; }
void GetExtent( const EAxis axis,
G4double &min, G4double &max );
virtual const G4bool Clip( const G4VoxelLimits &voxelLimit );
virtual const G4bool PartialClip( const G4VoxelLimits &voxelLimit, const EAxis IgnoreMe );
virtual void ClipAlongOneAxis( const G4VoxelLimits &voxelLimit, const EAxis axis );
virtual const G4bool GetExtent( const EAxis axis,
G4double &min, G4double &max ) const;
virtual const G4ThreeVector *GetMinPoint( const EAxis axis ) const;
virtual const G4ThreeVector *GetMaxPoint( const EAxis axis ) const;
virtual const G4int GetNumVertices() const { return vertices.entries(); }
virtual const G4bool Empty() const { return vertices.entries()==0; }
virtual const G4bool InFrontOf( const G4ClippablePolygon &other, EAxis axis ) const;
virtual const G4bool BehindOf( const G4ClippablePolygon &other, EAxis axis ) const;
virtual const G4bool GetPlanerExtent( const G4ThreeVector &pointOnPlane,
const G4ThreeVector &planeNormal,
G4double &min, G4double &max ) const;
private:
protected:
G4ThreeVectorList vertices;
G4ThreeVector normal;
void ClipToSimpleLimits( G4ThreeVectorList& pPolygon,
G4ThreeVectorList& outputPolygon,
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Cons.hh,v 2.0 1998/07/02 17:01:56 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Cons.hh,v 1.1 1999/01/07 16:07:52 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4Cons
//
@@ -5,6 +5,14 @@
// is clearly outside a polyhedra or ploycone or deciding if
// a trajectory is clearly going to miss said shapes.
//
// ----------------------------------------------------------
// 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.
//
#ifndef G4EnclosingCylinder_hh
#define G4EnclosingCylinder_hh
@@ -12,15 +20,17 @@
#include "geomdefs.hh"
#include "G4ThreeVector.hh"
class G4ReduciblePolygon;
class G4EnclosingCylinder {
public:
G4EnclosingCylinder( const G4double r[], const G4double z[], const G4int n,
G4EnclosingCylinder( const G4ReduciblePolygon *rz,
const G4bool phiIsOpen,
const G4double startPhi, const G4double totalPhi );
~G4EnclosingCylinder();
G4bool Outside( const G4ThreeVector &p ) const;
G4bool Misses( const G4ThreeVector &p, const G4ThreeVector &v ) const;
G4bool MustBeOutside( const G4ThreeVector &p ) const;
G4bool ShouldMiss( const G4ThreeVector &p, const G4ThreeVector &v ) const;
protected:
G4double radius; // radius of our cylinder
@@ -34,6 +44,8 @@ class G4EnclosingCylinder {
dx1, dy1;
G4double rx2, ry2,
dx2, dy2;
G4bool concave; // True, if x/y cross section is concave
};
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Hype.hh,v 2.1 1998/07/12 02:56:49 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Hype.hh,v 1.1 1999/01/07 16:07:52 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Para.hh,v 2.0 1998/07/02 17:01:59 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Para.hh,v 1.1 1999/01/07 16:07:52 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4Para
//
@@ -8,13 +8,23 @@
// the z axis. It has boundaries that are straight lines of arbitrary length
// and direction, but with corners aways on the same side of the z axis.
//
// ----------------------------------------------------------
// 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.
//
#ifndef G4PolyPhiFace_hh
#define G4PolyPhiFace_hh
#include "G4VCSGface.hh"
class G4ReduciblePolygon;
typedef struct {
G4double r, z; // position
G4double x, y, r, z; // position
G4double rNorm,
zNorm; // r/z normal
G4ThreeVector norm3D; // 3D normal
@@ -30,9 +40,12 @@ typedef struct {
class G4PolyPhiFace : public G4VCSGface {
public:
G4PolyPhiFace( const G4double *r, const G4double *z, const G4int n,
const G4double phi, const G4double deltaPhi, const G4bool start );
G4PolyPhiFace( const G4ReduciblePolygon *rz,
const G4double phi, const G4double deltaPhi, const G4double phiOther );
virtual ~G4PolyPhiFace();
G4PolyPhiFace( const G4PolyPhiFace &source );
G4PolyPhiFace *operator=( const G4PolyPhiFace &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
const G4bool outgoing, const G4double surfTolerance,
@@ -51,7 +64,11 @@ class G4PolyPhiFace : public G4VCSGface {
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4double &min, G4double &max );
G4SolidExtentList &extentList );
G4VCSGface *Clone() { return new G4PolyPhiFace(*this); }
void Diagnose( G4VSolid *solid );
protected:
G4PolyPhiFaceEdge *edges; // The edges of the face
@@ -62,11 +79,25 @@ class G4PolyPhiFace : public G4VCSGface {
G4ThreeVector surface; // Point on surface
G4double rMin, rMax, // Extent in r
zMin, zMax; // Extent in z
G4bool allBehind; // True if the entire polycone/polyhedra is behind the place
// of this face
G4bool InsideEdgesExact( const G4double r, const G4double z,
const G4double normSign, const G4ThreeVector &p, const G4ThreeVector &v );
G4bool InsideEdges( const G4double r, const G4double z );
G4bool InsideEdges( const G4double r, const G4double z,
G4double *distRZ2, G4PolyPhiFaceVertex **base3Dnorm=0,
G4ThreeVector **head3Dnorm=0 );
inline G4double ExactZOrder( const G4double z,
const G4double qx, const G4double qy, const G4double qz,
const G4ThreeVector &v,
const G4double normSign,
const G4PolyPhiFaceVertex *vert ) const;
void CopyStuff( const G4PolyPhiFace &source );
};
#include "G4PolyPhiFace.icc"
#endif
@@ -0,0 +1,44 @@
//
// G4PolyPhiFace.icc
//
// Implementation of inline methods of G4PolyPhiFace
//
// ----------------------------------------------------------
// 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.
//
//
// ExactZOrder
//
// Decide precisely whether a trajectory passes to the left, right, or exactly
// passes through the z position of a vertex point in our face.
//
// Result is only determined within an arbitrary (positive) factor.
// > 0 to the right
// < 0 to the left
// = 0 exactly on top of
// In 99.9999% of the cases, a trivial calculation is used. In difficult
// cases, a precise, compliant calculation is relied on.
//
inline G4double G4PolyPhiFace::ExactZOrder( const G4double z,
const G4double qx, const G4double qy, const G4double qz,
const G4ThreeVector &v,
const G4double normSign,
const G4PolyPhiFaceVertex *vert ) const {
G4double answer = vert->z - z;
if (fabs(answer) < kCarTolerance) {
G4ThreeVector qa( qx - vert->x + radial.x(),
qy - vert->y + radial.y(), qz - vert->z ),
qb( qx - vert->x, qy - vert->y, qz - vert->z );
G4ThreeVector qacb = qa.cross(qb);
answer = normSign*qacb.dot(v)*(normal.y()*radial.x()-normal.x()*radial.y());
}
return answer;
}
@@ -2,7 +2,15 @@
// G4Polycone.hh
//
// Declaration of a CSG type "PCON" geant volume, inherited from
// class G4CSGSolid
// class G4VCSGSolid
//
// ----------------------------------------------------------
// 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.
//
#ifndef G4Polycone_hh
@@ -11,6 +19,9 @@
#include "G4VCSGfaceted.hh"
#include "G4PolyconeSide.hh"
class G4EnclosingCylinder;
class G4ReduciblePolygon;
class G4VCSGface;
class G4Polycone : public G4VCSGfaceted
@@ -33,6 +44,19 @@ class G4Polycone : public G4VCSGfaceted
virtual ~G4Polycone();
G4Polycone( const G4Polycone &source );
const G4Polycone &operator=( const G4Polycone &source );
//
// A couple overrides to speed things up
//
EInside Inside( const G4ThreeVector &p ) const;
G4double DistanceToIn( const G4ThreeVector &p, const G4ThreeVector &v ) const;
G4double DistanceToIn( const G4ThreeVector &p ) const { return G4VCSGfaceted::DistanceToIn(p); }
//
// The usual G4VCSGface stuff
//
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
@@ -42,6 +66,9 @@ class G4Polycone : public G4VCSGfaceted
G4Polyhedron* CreatePolyhedron() const;
G4NURBS* CreateNURBS() const;
//
// Access routines
//
inline G4double GetStartPhi() const { return startPhi; }
inline G4double GetEndPhi() const { return endPhi; }
inline G4bool IsOpen() const { return phiIsOpen; }
@@ -61,27 +88,34 @@ class G4Polycone : public G4VCSGfaceted
//
// The following is temporary until graphics_reps is brought up to this design
//
typedef struct {
struct G4PolyconeHistorical {
G4PolyconeHistorical() {;}
~G4PolyconeHistorical();
G4PolyconeHistorical( const G4PolyconeHistorical &source );
G4double Start_angle;
G4double Opening_angle;
G4int Num_z_planes;
G4double *Z_values;
G4double *Rmin;
G4double *Rmax;
G4bool exist;
} G4PolyconeKluge;
};
G4PolyconeKluge original_parameters;
G4PolyconeHistorical *original_parameters;
//
// Generic initializer, call by all constructors
// Our quick test
//
G4EnclosingCylinder *enclosingCylinder;
//
// Generic initializer, called by all constructors
//
void Create( const G4double phiStart, // initial phi starting angle
const G4double phiTotal, // total phi angle
const G4int numRZ, // number corners in r,z space
const G4double r[], // r coordinate of these corners
const G4double z[] ); // z coordinate of these corners
G4ReduciblePolygon *rz ); // r/z coordinate of these corners
void CopyStuff( const G4Polycone &source );
};
#endif
@@ -21,13 +21,16 @@ class G4PolyconeSide : public G4VCSGface {
const G4PolyconeSideRZ *head,
const G4PolyconeSideRZ *nextRZ,
const G4double phiStart, const G4double deltaPhi,
const G4bool phiIsOpen );
const G4bool phiIsOpen, const G4bool isAllBehind=false );
virtual ~G4PolyconeSide();
G4PolyconeSide( const G4PolyconeSide &source );
G4PolyconeSide *operator=( const G4PolyconeSide &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
const G4bool outgoing, const G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4ThreeVector &normal, G4bool &isAllBehind );
G4double Distance( const G4ThreeVector &p, const G4bool outgoing );
@@ -41,27 +44,45 @@ class G4PolyconeSide : public G4VCSGface {
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4double &min, G4double &max );
G4SolidExtentList &extentList );
G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
protected:
G4double r[2], z[2]; // r, z parameters, in specified order
G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
deltaPhi; // Delta phi (0 to 2pi), if phiIsOpen
G4bool phiIsOpen; // True if there is a phi slice
G4bool allBehind; // True if the entire solid is "behind" this face
G4IntersectingCone *cone; // Our intersecting utility class
G4double rNorm, zNorm; // Normal to surface in r,z space
G4double rS, zS; // Unit vector along surface in r,z space
G4double length; // Length of face in r,z space
G4double prevRS,
prevZS; // Unit vector along previous polyconeSide
G4double nextRS,
nextZS; // Unit vector along next polyconeSide
G4double rNormEdge[2],
zNormEdge[2]; // Normal to edges
G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen)
G4double DistanceAway( const G4ThreeVector &p, const G4bool opposite,
G4double &distOutside2, G4double *rzNorm );
G4double &distOutside2, G4double *rzNorm=0 );
G4bool PointOnCone( const G4ThreeVector &p, G4ThreeVector &normal );
G4bool PointOnCone( const G4ThreeVector &hit, const G4double normSign,
const G4ThreeVector &p, const G4ThreeVector &v, G4ThreeVector &normal );
void CopyStuff( const G4PolyconeSide &source );
static void FindLineIntersect( const G4double x1, const G4double y1,
const G4double tx1, const G4double ty1,
const G4double x2, const G4double y2,
const G4double tx2, const G4double ty2,
G4double &x, G4double &y );
};
@@ -4,6 +4,14 @@
// Declaration of a CSG type "PCON" geant volume, inherited from
// class G4CSGSolid
//
// ----------------------------------------------------------
// 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.
//
#ifndef G4Polyhedra_hh
#define G4Polyhedra_hh
@@ -12,13 +20,14 @@
#include "G4PolyhedraSide.hh"
class G4EnclosingCylinder;
class G4ReduciblePolygon;
class G4Polyhedra : public G4VCSGfaceted {
public:
G4Polyhedra( G4String name,
const G4double phiStart, // initial phi starting angle
const G4double phiTotal, // total phi angle
const G4double numSide, // number sides
const G4int numSide, // number sides
const G4int numZPlanes, // number of z planes
const G4double zPlane[], // position of z planes
const G4double rInner[], // tangent distance to inner surface
@@ -27,12 +36,15 @@ class G4Polyhedra : public G4VCSGfaceted {
G4Polyhedra( G4String name,
const G4double phiStart, // initial phi starting angle
const G4double phiTotal, // total phi angle
const G4double numSide, // number sides
const G4int numSide, // number sides
const G4int numRZ, // number corners in r,z space
const G4double r[], // r coordinate of these corners
const G4double z[] ); // z coordinate of these corners
virtual ~G4Polyhedra();
G4Polyhedra( const G4Polyhedra &source );
const G4Polyhedra &operator=( const G4Polyhedra &source );
//
// A couple overrides to speed things up
@@ -66,12 +78,16 @@ class G4Polyhedra : public G4VCSGfaceted {
G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
G4bool phiIsOpen; // true if there is a phi segment
G4int numCorner; // number RZ points
G4PolyhedraSideRZ *corners; // corner r,z points
G4PolyhedraSideRZ *corners; // our corners
//
// The following is temporary until graphics_reps is brought up to this design
//
typedef struct {
struct G4PolyhedraHistorical {
G4PolyhedraHistorical() {;}
~G4PolyhedraHistorical();
G4PolyhedraHistorical( const G4PolyhedraHistorical &source );
G4double Start_angle;
G4double Opening_angle;
G4int numSide;
@@ -79,10 +95,9 @@ class G4Polyhedra : public G4VCSGfaceted {
G4double *Z_values;
G4double *Rmin;
G4double *Rmax;
G4bool exist;
} G4PolyhedraKluge;
};
G4PolyhedraKluge original_parameters;
G4PolyhedraHistorical *original_parameters;
//
// Our quick test
@@ -94,10 +109,11 @@ class G4Polyhedra : public G4VCSGfaceted {
//
void Create( const G4double phiStart, // initial phi starting angle
const G4double phiTotal, // total phi angle
const G4double numSide, // number sides
const G4int numRZ, // number corners in r,z space
const G4double r[], // r coordinate of these corners
const G4double z[] ); // z coordinate of these corners
const G4int numSide, // number sides
G4ReduciblePolygon *rz ); // rz coordinates
void CopyStuff( const G4Polyhedra &source );
void DeleteStuff();
};
#endif
@@ -3,6 +3,14 @@
//
// Declaration of a face that represents one segmented side of a polyhedra
//
// ----------------------------------------------------------
// 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.
//
#ifndef G4PolyhedraSide_hh
#define G4PolyhedraSide_hh
@@ -22,9 +30,12 @@ class G4PolyhedraSide : public G4VCSGface {
const G4PolyhedraSideRZ *nextRZ,
const G4int numSide,
const G4double phiStart, const G4double phiTotal,
const G4bool phiIsOpen );
const G4bool phiIsOpen, const G4bool isAllBehind=false );
virtual ~G4PolyhedraSide();
G4PolyhedraSide( const G4PolyhedraSide &source );
G4PolyhedraSide *operator=( const G4PolyhedraSide &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
const G4bool outgoing, const G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
@@ -42,7 +53,9 @@ class G4PolyhedraSide : public G4VCSGface {
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4double &min, G4double &max );
G4SolidExtentList &extentList );
G4VCSGface *Clone() { return new G4PolyhedraSide( *this ); }
protected:
//
@@ -70,8 +83,10 @@ class G4PolyhedraSide : public G4VCSGface {
G4int numSide; // Number sides
G4double r[2], z[2]; // r, z parameters, in specified order
G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
deltaPhi; // Delta phi (0 to 2pi), if phiIsOpen
deltaPhi, // Delta phi (0 to 2pi), if phiIsOpen
endPhi; // End phi (>startPhi), if phiIsOpen
G4bool phiIsOpen; // True if there is a phi slice
G4bool allBehind; // True if the entire solid is "behind" this face
G4IntersectingCone *cone; // Our intersecting cone
@@ -93,14 +108,16 @@ class G4PolyhedraSide : public G4VCSGface {
G4int ClosestPhiSegment( const G4double phi );
G4int PhiSegment( const G4double phi );
G4double DistanceToOneSide( const G4ThreeVector &p,
const G4PolyhedraSideVec vec,
const G4PolyhedraSideVec &vec,
G4double *normDist );
G4double DistanceAway( const G4ThreeVector &p,
const G4PolyhedraSideVec vec,
const G4PolyhedraSideVec &vec,
G4double *normDist );
void CopyStuff( const G4PolyhedraSide &source );
};
@@ -0,0 +1,132 @@
//
// G4ReduciblePolygon.hh
//
// Declaration of a utility class used to specify, test, reduce,
// and/or otherwise manipulate a 2D polygon.
//
// For this class, a polygon consists of n > 2 points in 2D
// space (a,b). The polygon is always closed by connecting the
// last point to the first. A G4ReduciblePolygon is guaranteed
// to fulfill this definition in all instances.
//
// Illegal manipulations (such that a valid polygon would be
// produced) result in an error return if possible and
// otherwise a G4Exception.
//
// The set of manipulations is limited currently to what
// is needed for G4Polycone and G4Polyhedra.
//
// ----------------------------------------------------------
// 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.
//
#ifndef G4ReduciblePolygon_hh
#define G4ReduciblePolygon_hh
#include "globals.hh"
class G4ReduciblePolygon {
friend class G4ReduciblePolygonIterator;
public:
//
// Creator: via simple a/b arrays
//
G4ReduciblePolygon( const G4double a[], const G4double b[], const G4int n );
//
// Creator: a special version for G4Polygon and G4Polycone
// that takes two a points at planes of b
// (where a==r and b==z for the GEANT3 classic PCON and PGON)
//
G4ReduciblePolygon( const G4double rmin[], const G4double rmax[], const G4double z[], const G4int n );
virtual ~G4ReduciblePolygon();
//
// Queries
//
inline G4int NumVertices() const { return numVertices; }
inline G4double Amin() const { return aMin; }
inline G4double Amax() const { return aMax; }
inline G4double Bmin() const { return bMin; }
inline G4double Bmax() const { return bMax; }
void CopyVertices( G4double a[], G4double b[] ) const;
//
// Manipulations
//
void ScaleA( const G4double scale );
void ScaleB( const G4double scale );
G4bool RemoveDuplicateVertices( const G4double tolerance );
G4bool RemoveRedundantVertices( const G4double tolerance );
//
// Tests
//
G4double Area();
G4bool CrossesItself( const G4double tolerance );
G4bool BisectedBy( const G4double a1, const G4double b1,
const G4double a2, const G4double b2, const G4double tolerance );
void Print(); // Debugging only
protected:
void Create( const G4double a[], const G4double b[], const G4int n );
void CalculateMaxMin();
//
// Below are member values that are *always* kept up to date (please!)
//
G4double aMin, aMax, bMin, bMax;
G4int numVertices;
//
// A subclass which holds the vertices in a single-linked list
//
// Yeah, call me an old-fashioned c hacker, but I cannot make
// myself use the rogue tools for this trivial list.
//
struct ABVertex;
friend struct ABVertex;
struct ABVertex {
G4double a, b;
ABVertex *next;
};
ABVertex *vertexHead;
};
//
// A companion class for iterating over the vertices of our polygon.
// It is simple enough that all routines are declared inline here.
//
class G4ReduciblePolygonIterator {
public:
G4ReduciblePolygonIterator( const G4ReduciblePolygon *theSubject ) { subject = theSubject; current=0; }
inline void Begin() { current = subject->vertexHead; }
inline G4bool Next() { if (current) current = current->next; return Valid(); }
inline G4bool Valid() const { return current!=0; }
inline G4double GetA() const { return current->a; }
inline G4double GetB() const { return current->b; }
protected:
const G4ReduciblePolygon *subject; // Who are we iterating over
G4ReduciblePolygon::ABVertex *current; // Current vertex
};
#endif
@@ -0,0 +1,52 @@
//
// G4SolidExtentList.hh
//
// Declaration of a list of (voxel) extents along one axis
//
// This utility class is designed for one specific purpose: to
// calculate the extent of a CSG solid for a voxel
// (G4VSolid::CalculateExtent).
//
// ----------------------------------------------------------
// 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.
//
#ifndef G4SolidExtentList_hh
#define G4SolidExtentList_hh
#include "globals.hh"
#include "G4ClippablePolygon.hh"
class G4SolidExtentList {
public:
G4SolidExtentList();
G4SolidExtentList( const EAxis targetAxis, const G4VoxelLimits &voxelLimits );
~G4SolidExtentList();
void AddSurface( const G4ClippablePolygon &surface );
G4bool GetExtent( G4double &min, G4double &max ) const;
protected:
EAxis axis; // Target axis
G4bool limited; // True if limited
G4double minLimit; // ... min limit
G4double maxLimit; // ... max limit
G4ClippablePolygon minSurface, // Minimum surface within limits
maxSurface, // Maximum
minAbove, // Minimum surface totally above max limit
maxBelow; // Maximum surface totally below min limit
};
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Sphere.hh,v 2.0 1998/07/02 17:02:02 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Sphere.hh,v 1.1 1999/01/07 16:07:54 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4Sphere
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Torus.hh,v 2.1 1998/07/12 02:56:50 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Torus.hh,v 1.1 1999/01/07 16:07:54 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4Torus
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Trap.hh,v 2.1 1998/07/12 02:56:50 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Trap.hh,v 1.1 1999/01/07 16:07:54 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4Trap
//
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Trd.hh,v 2.1 1998/07/12 02:56:51 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Trd.hh,v 1.1 1999/01/07 16:07:54 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4Trd
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Tubs.hh,v 2.1 1998/07/12 02:56:52 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Tubs.hh,v 1.1 1999/01/07 16:07:54 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// class G4Tubs
@@ -92,13 +92,16 @@
// pVoxelLimit - (in) Limits along x, y, and/or z axes
// pTransform - (in) A coordinate transformation on which
// to apply to the shape before testing
// min - (in/out) If the face has any point on its
// min - (out) If the face has any point on its
// surface after tranformation and limits
// along pAxis
// that is smaller than the value of min,
// than it is used to replace min.
// max - (in/out) Same as min, except for the largest
// point.
// Undefined if the return value is false.
// max - (out) Same as min, except for the largest
// point. Undefined if the return value is false.
//
// return value = true if anything remains of the face
//
// Calculate the extent of the face for the voxel navigator.
// In analogy with CalculateExtent for G4VCSGfaceted, this is
@@ -109,11 +112,29 @@
// 2. Clip the face to those boundaries as specified in
// pVoxelLimit. This may include limits in any number
// of x, y, or z axes.
// 3. If nothing remains of the face after clipping, return.
// 4. Check the extent of the remaining surface along
// axis pAxis and check these values against min and max,
// modifying them as necessary.
//
// 3. For each part of the face that remains (there could
// be many separate pieces in general):
// 4. Check to see if the piece overlaps the currently
// existing limits along axis pAxis. For
// pVoxelLimit.IsLimited(pAxis) = false, there are
// no limits.
// 5. For a piece that does overlap, update min/max
// accordingly (within confines of pre-existing
// limits) along the direction pAxis.
// 6. If min/max were updated, return true
//
// -------------------------------------------------------------------
// G3VCSGface *Clone()
//
// This method is invoked by G4CSGfaceted during the copy constructor
// or the assignment operator. Its purpose is to return a pointer
// (of type G4VCSGface) to a duplicate copy of the face. The implementation
// is straight forward for inherited classes. Example:
//
// G4VCSGface G4PolySideFace::Clone() { return new G4PolySideFace(*this); }
//
// Of course, this assumes the copy constructor of G4PolySideFace is
// correctly implemented.
//
// Implementation notes:
// * distance.
@@ -132,7 +153,7 @@
// A, C, F, and H: closest distance is the distance to
// the adjacent corner.
//
// B, D, E, and F: closest distance is the distance to
// B, D, E, and G: closest distance is the distance to
// the adjacent line.
//
// I: normal distance to plane
@@ -200,6 +221,14 @@
// and save the answer that is smallest. If there is more than one answer,
// or if allBehind is false for the one answer, return validNorm as false.
//
// ----------------------------------------------------------
// 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.
//
#include "G4VSolid.hh"
@@ -209,6 +238,7 @@
class G4VoxelLimits;
class G4AffineTransform;
class G4SolidExtentList;
class G4VCSGface {
public:
@@ -232,7 +262,9 @@ class G4VCSGface {
virtual void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4double &min, G4double &max ) = 0;
G4SolidExtentList &extentList ) = 0;
virtual G4VCSGface* Clone() = 0;
};
#endif
@@ -17,6 +17,9 @@ class G4VCSGfaceted : public G4CSGSolid
G4VCSGfaceted( G4String name) : G4CSGSolid(name) {;}
virtual ~G4VCSGfaceted();
G4VCSGfaceted( const G4VCSGfaceted &source );
const G4VCSGfaceted &operator=( const G4VCSGfaceted &source );
virtual G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
@@ -46,7 +49,9 @@ class G4VCSGfaceted : public G4CSGSolid
G4VCSGface **faces;
virtual G4double DistanceTo( const G4ThreeVector &p, const G4bool outgoing ) const;
void CopyStuff( const G4VCSGfaceted &source );
void DeleteStuff();
};
#endif