Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ClippablePolygon.hh,v 1.6 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ClippablePolygon.hh,v 1.7 2002/10/28 11:47:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -60,68 +60,68 @@ class G4ClippablePolygon
public: // with description
G4ClippablePolygon();
virtual ~G4ClippablePolygon();
// Constructor & virtual destructor.
virtual void AddVertexInOrder( const G4ThreeVector vertex );
virtual void ClearAllVertices();
inline void SetNormal( const G4ThreeVector &newNormal );
inline const G4ThreeVector GetNormal() const;
virtual G4bool Clip( const G4VoxelLimits &voxelLimit );
G4ClippablePolygon();
virtual ~G4ClippablePolygon();
// Constructor & virtual destructor.
virtual void AddVertexInOrder( const G4ThreeVector vertex );
virtual void ClearAllVertices();
inline void SetNormal( const G4ThreeVector &newNormal );
inline const G4ThreeVector GetNormal() const;
virtual G4bool Clip( const G4VoxelLimits &voxelLimit );
virtual G4bool PartialClip( const G4VoxelLimits &voxelLimit,
const EAxis IgnoreMe );
// Clip, while ignoring the indicated axis.
virtual G4bool PartialClip( const G4VoxelLimits &voxelLimit,
const EAxis IgnoreMe );
// Clip, while ignoring the indicated axis.
virtual void ClipAlongOneAxis( const G4VoxelLimits &voxelLimit,
const EAxis axis );
// Clip along just one axis, as specified in voxelLimit.
virtual void ClipAlongOneAxis( const G4VoxelLimits &voxelLimit,
const EAxis axis );
// Clip along just one axis, as specified in voxelLimit.
virtual G4bool GetExtent( const EAxis axis,
G4double &min, G4double &max ) const;
virtual G4bool GetExtent( const EAxis axis,
G4double &min, G4double &max ) const;
virtual const G4ThreeVector *GetMinPoint( const EAxis axis ) const;
// Returns pointer to minimum point along the specified axis.
// Take care! Do not use pointer after destroying parent polygon.
virtual const G4ThreeVector *GetMinPoint( const EAxis axis ) const;
// Returns pointer to minimum point along the specified axis.
// Take care! Do not use pointer after destroying parent polygon.
virtual const G4ThreeVector *GetMaxPoint( const EAxis axis ) const;
// Returns pointer to maximum point along the specified axis.
// Take care! Do not use pointer after destroying parent polygon.
virtual const G4ThreeVector *GetMaxPoint( const EAxis axis ) const;
// Returns pointer to maximum point along the specified axis.
// Take care! Do not use pointer after destroying parent polygon.
inline G4int GetNumVertices() const;
inline G4bool Empty() const;
virtual G4bool InFrontOf( const G4ClippablePolygon &other, EAxis axis ) const;
// Decide if the polygon is in "front" of another when
// viewed along the specified axis. For our purposes here,
// it is sufficient to use the minimum extent of the
// polygon along the axis to determine this.
inline G4int GetNumVertices() const;
inline G4bool Empty() const;
virtual G4bool InFrontOf( const G4ClippablePolygon &other, EAxis axis ) const;
// Decide if the polygon is in "front" of another when
// viewed along the specified axis. For our purposes here,
// it is sufficient to use the minimum extent of the
// polygon along the axis to determine this.
virtual G4bool BehindOf( const G4ClippablePolygon &other, EAxis axis ) const;
// Decide if this polygon is behind another.
// Remarks in method "InFrontOf" are valid here too.
virtual G4bool BehindOf( const G4ClippablePolygon &other, EAxis axis ) const;
// Decide if this polygon is behind another.
// Remarks in method "InFrontOf" are valid here too.
virtual G4bool GetPlanerExtent( const G4ThreeVector &pointOnPlane,
const G4ThreeVector &planeNormal,
G4double &min, G4double &max ) const;
// Get min/max distance in or out of a plane.
virtual G4bool GetPlanerExtent( const G4ThreeVector &pointOnPlane,
const G4ThreeVector &planeNormal,
G4double &min, G4double &max ) const;
// Get min/max distance in or out of a plane.
protected: // with description
void ClipToSimpleLimits( G4ThreeVectorList& pPolygon,
G4ThreeVectorList& outputPolygon,
const G4VoxelLimits& pVoxelLimit );
// pVoxelLimits must be only limited along one axis, and either
// the maximum along the axis must be +kInfinity, or the minimum
// -kInfinity
void ClipToSimpleLimits( G4ThreeVectorList& pPolygon,
G4ThreeVectorList& outputPolygon,
const G4VoxelLimits& pVoxelLimit );
// pVoxelLimits must be only limited along one axis, and either
// the maximum along the axis must be +kInfinity, or the minimum
// -kInfinity
protected:
G4ThreeVectorList vertices;
G4ThreeVector normal;
G4ThreeVectorList vertices;
G4ThreeVector normal;
};
#include "G4ClippablePolygon.icc"
@@ -22,7 +22,7 @@
//
//
// $Id: G4ClippablePolygon.icc,v 1.3 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EllipticalTube.hh,v 1.9 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4EllipticalTube.hh,v 1.10 2002/10/28 11:47:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
@@ -52,70 +52,71 @@
class G4EllipticalTube : public G4VSolid
{
public:
public: // with description
G4EllipticalTube( const G4String &name,
G4double theDx, G4double theDy, G4double theDz );
virtual ~G4EllipticalTube();
//
// Standard CSG methods
//
virtual G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
virtual EInside Inside( const G4ThreeVector& p) const;
G4EllipticalTube( const G4String &name,
G4double theDx,
G4double theDy,
G4double theDz );
virtual G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
virtual ~G4EllipticalTube();
// Standard solid methods
virtual G4double DistanceToIn( const G4ThreeVector& p,const G4ThreeVector& v ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p,const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,G4ThreeVector *n=0 ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p ) const;
virtual G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax ) const;
virtual EInside Inside( const G4ThreeVector& p ) const;
G4GeometryType GetEntityType() const { return G4String("G4EllipticalTube"); }
virtual G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
//
// Visualisation methods
//
virtual G4Polyhedron* CreatePolyhedron() const;
virtual void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
virtual G4VisExtent GetExtent() const;
virtual G4double DistanceToIn( const G4ThreeVector& p,
const G4ThreeVector& v ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,
G4ThreeVector *n=0 ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p ) const;
G4GeometryType GetEntityType() const;
//
// Parameter access
//
G4double GetDx() const { return dx; }
G4double GetDy() const { return dy; }
G4double GetDz() const { return dz; }
void SetDx( const G4double newDx ) { dx = newDx; }
void SetDy( const G4double newDy ) { dy = newDy; }
void SetDz( const G4double newDz ) { dz = newDz; }
protected:
G4std::ostream& StreamInfo(G4std::ostream& os) const;
G4double dx, dy, dz;
//
// Utility
//
inline G4double CheckXY( const G4double x, const G4double y, const G4double toler ) const {
G4double rx = x/(dx+toler), ry = y/(dy+toler);
return rx*rx + ry*ry;
}
inline G4double CheckXY( const G4double x, const G4double y ) const {
G4double rx = x/dx, ry = y/dy;
return rx*rx + ry*ry;
}
// Visualisation methods
G4int IntersectXY( const G4ThreeVector &p,
const G4ThreeVector &v, G4double s[2] ) const;
virtual G4Polyhedron* CreatePolyhedron() const;
virtual void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
virtual G4VisExtent GetExtent() const;
// Accessors
inline G4double GetDx() const;
inline G4double GetDy() const;
inline G4double GetDz() const;
inline void SetDx( const G4double newDx );
inline void SetDy( const G4double newDy );
inline void SetDz( const G4double newDz );
protected: // without description
G4double dx, dy, dz;
// Utility
inline G4double CheckXY( const G4double x,
const G4double y,
const G4double toler ) const;
inline G4double CheckXY( const G4double x, const G4double y ) const;
G4int IntersectXY( const G4ThreeVector &p,
const G4ThreeVector &v, G4double s[2] ) const;
};
#include "G4EllipticalTube.icc"
#endif
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: G4EllipticalTube.icc,v 1.1 2002/10/28 11:47:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
//
// G4EllipticalTube.icc
//
// Implementation of inline methods of G4EllipticalTube
// --------------------------------------------------------------------
inline
G4double G4EllipticalTube::GetDx() const
{
return dx;
}
inline
G4double G4EllipticalTube::GetDy() const
{
return dy;
}
inline
G4double G4EllipticalTube::GetDz() const
{
return dz;
}
inline
void G4EllipticalTube::SetDx( const G4double newDx )
{
dx = newDx;
}
inline
void G4EllipticalTube::SetDy( const G4double newDy )
{
dy = newDy;
}
inline
void G4EllipticalTube::SetDz( const G4double newDz )
{
dz = newDz;
}
inline
G4double G4EllipticalTube::CheckXY( const G4double x,
const G4double y,
const G4double toler ) const
{
G4double rx = x/(dx+toler), ry = y/(dy+toler);
return rx*rx + ry*ry;
}
inline
G4double G4EllipticalTube::CheckXY( const G4double x, const G4double y ) const
{
G4double rx = x/dx, ry = y/dy;
return rx*rx + ry*ry;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EnclosingCylinder.hh,v 1.4 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4EnclosingCylinder.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -53,35 +53,35 @@ class G4EnclosingCylinder
{
public: // with description
G4EnclosingCylinder( const G4ReduciblePolygon *rz,
G4bool phiIsOpen,
G4double startPhi, G4double totalPhi );
~G4EnclosingCylinder();
G4bool MustBeOutside( const G4ThreeVector &p ) const;
// Decide very rapidly if the point is outside the cylinder.
// If one is not certain, return false.
G4EnclosingCylinder( const G4ReduciblePolygon *rz,
G4bool phiIsOpen,
G4double startPhi, G4double totalPhi );
~G4EnclosingCylinder();
G4bool MustBeOutside( const G4ThreeVector &p ) const;
// Decide very rapidly if the point is outside the cylinder.
// If one is not certain, return false.
G4bool ShouldMiss( const G4ThreeVector &p, const G4ThreeVector &v ) const;
// Decide very rapidly if the trajectory is going to miss the cylinder.
// If one is not sure, return false.
G4bool ShouldMiss( const G4ThreeVector &p, const G4ThreeVector &v ) const;
// Decide very rapidly if the trajectory is going to miss the cylinder.
// If one is not sure, return false.
protected:
G4double radius; // radius of our cylinder
G4double zLo, zHi; // z extent
G4bool phiIsOpen; // true if there is a phi segment
G4double startPhi, // for isPhiOpen==true, starting of phi segment
totalPhi; // for isPhiOpen==true, size of phi segment
G4double radius; // radius of our cylinder
G4double zLo, zHi; // z extent
G4bool phiIsOpen; // true if there is a phi segment
G4double startPhi, // for isPhiOpen==true, starting of phi segment
totalPhi; // for isPhiOpen==true, size of phi segment
G4double rx1, ry1,
dx1, dy1;
G4double rx2, ry2,
dx2, dy2;
G4bool concave; // True, if x/y cross section is concave
G4double rx1, ry1,
dx1, dy1;
G4double rx2, ry2,
dx2, dy2;
G4bool concave; // true, if x/y cross section is concave
};
#endif
@@ -21,9 +21,9 @@
// ********************************************************************
//
//
// $Id: G4Hype.hh,v 1.5 2001/07/11 10:00:14 gunter Exp $
// $Id: G4Hype.hh,v 1.6 2002/10/28 11:47:50 gcosmo Exp $
// $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -93,25 +93,25 @@ class G4ClippablePolygon;
class G4Hype : public G4VSolid
{
public:
public: // with description
G4Hype(const G4String &pName,
G4double newInnerRadius,
G4double newOuterRadius,
G4double newInnerStereo,
G4double newOuterStereo,
G4double newHalfLenZ);
G4double newInnerRadius,
G4double newOuterRadius,
G4double newInnerStereo,
G4double newOuterStereo,
G4double newHalfLenZ);
virtual ~G4Hype();
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
const G4int n,
const G4VPhysicalVolume* pRep);
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
inline G4double GetInnerRadius () const;
inline G4double GetOuterRadius () const;
@@ -129,29 +129,31 @@ class G4Hype : public G4VSolid
G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
G4double DistanceToIn(const G4ThreeVector& p,const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p) const;
G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
const G4bool calcNorm=G4bool(false),
G4bool *validNorm=0, G4ThreeVector *n=0) const;
const G4bool calcNorm=G4bool(false),
G4bool *validNorm=0, G4ThreeVector *n=0) const;
G4double DistanceToOut(const G4ThreeVector& p) const;
inline G4GeometryType GetEntityType() const;
G4GeometryType GetEntityType() const;
G4std::ostream& StreamInfo(G4std::ostream& os) const;
void DescribeYourselfTo (G4VGraphicsScene& scene) const;
G4VisExtent GetExtent () const;
G4Polyhedron* CreatePolyhedron () const;
G4NURBS* CreateNURBS () const;
protected:
protected: // without description
inline G4bool InnerSurfaceExists() const;
// whether we have an inner surface or not
static G4double ApproxDistOutside( G4double pr, G4double pz,
G4double r0, G4double tanPhi );
G4double r0, G4double tanPhi );
static G4double ApproxDistInside( G4double pr, G4double pz,
G4double r0, G4double tan2Phi );
G4double r0, G4double tan2Phi );
// approximate isotropic distance to hyperbolic surface
inline G4double HypeInnerRadius2(G4double zVal) const;
@@ -163,12 +165,12 @@ class G4Hype : public G4VSolid
// intersection with hyperbolic surface
static void AddPolyToExtent( const G4ThreeVector &v0,
const G4ThreeVector &v1,
const G4ThreeVector &w1,
const G4ThreeVector &w0,
const G4VoxelLimits &voxelLimit,
const EAxis axis,
G4SolidExtentList &extentList );
const G4ThreeVector &v1,
const G4ThreeVector &w1,
const G4ThreeVector &w0,
const G4VoxelLimits &voxelLimit,
const EAxis axis,
G4SolidExtentList &extentList );
protected:
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Hype.icc,v 1.2 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Hype.icc,v 1.3 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -106,12 +106,6 @@ void G4Hype::SetOuterStereo (G4double newOSte)
endOuterRadius=sqrt(endOuterRadius2);
}
inline
G4GeometryType G4Hype::GetEntityType() const
{
return G4String("G4Hype");
}
inline
G4bool G4Hype::InnerSurfaceExists() const
{
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4IntersectingCone.hh,v 1.4 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4IntersectingCone.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -51,33 +51,33 @@ class G4IntersectingCone
{
public:
G4IntersectingCone( const G4double r[2], const G4double z[2] );
virtual ~G4IntersectingCone();
G4int LineHitsCone( const G4ThreeVector &p, const G4ThreeVector &v,
G4IntersectingCone( const G4double r[2], const G4double z[2] );
virtual ~G4IntersectingCone();
G4int LineHitsCone( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
G4bool HitOn( const G4double r, const G4double z );
inline G4double RLo() const { return rLo; }
inline G4double RHi() const { return rHi; }
inline G4double ZLo() const { return zLo; }
inline G4double ZHi() const { return zHi; }
G4bool HitOn( const G4double r, const G4double z );
inline G4double RLo() const { return rLo; }
inline G4double RHi() const { return rHi; }
inline G4double ZLo() const { return zLo; }
inline G4double ZHi() const { return zHi; }
protected:
G4double zLo, zHi, // Z bounds of side
rLo, rHi; // R bounds of side
G4double zLo, zHi, // Z bounds of side
rLo, rHi; // R bounds of side
G4bool type1; // True if cone is type 1 (abs(z1-z2)>abs(r1-r2))
G4double A, B; // Cone radius parameter:
// type 1: r = A + B*z
// type 2: z = A + B*r
G4bool type1; // True if cone is type 1 (abs(z1-z2)>abs(r1-r2))
G4double A, B; // Cone radius parameter:
// type 1: r = A + B*z
// type 2: z = A + B*r
G4int LineHitsCone1( const G4ThreeVector &p, const G4ThreeVector &v,
G4int LineHitsCone1( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
G4int LineHitsCone2( const G4ThreeVector &p, const G4ThreeVector &v,
G4int LineHitsCone2( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
};
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PolyPhiFace.hh,v 1.4 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4PolyPhiFace.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -57,18 +57,20 @@
class G4ReduciblePolygon;
typedef struct {
G4double x, y, r, z; // position
G4double rNorm,
zNorm; // r/z normal
G4ThreeVector norm3D; // 3D normal
typedef struct
{
G4double x, y, r, z; // position
G4double rNorm,
zNorm; // r/z normal
G4ThreeVector norm3D; // 3D normal
} G4PolyPhiFaceVertex;
typedef struct {
G4PolyPhiFaceVertex *v0, *v1; // Corners
G4double tr, tz, // Unit vector along edge
length; // Length of edge
G4ThreeVector norm3D; // 3D edge normal vector
typedef struct
{
G4PolyPhiFaceVertex *v0, *v1; // Corners
G4double tr, tz, // Unit vector along edge
length; // Length of edge
G4ThreeVector norm3D; // 3D edge normal vector
} G4PolyPhiFaceEdge;
class G4PolyPhiFace : public G4VCSGface
@@ -76,85 +78,85 @@ class G4PolyPhiFace : public G4VCSGface
public: // with description
G4PolyPhiFace( const G4ReduciblePolygon *rz,
G4PolyPhiFace( const G4ReduciblePolygon *rz,
G4double phi, G4double deltaPhi, G4double phiOther );
// Constructor.
// Points r,z should be supplied in clockwise order in r,z.
// For example:
// [1]---------[2] ^ R
// | | |
// | | +--> z
// [0]---------[3]
// Constructor.
// Points r,z should be supplied in clockwise order in r,z.
// For example:
// [1]---------[2] ^ R
// | | |
// | | +--> z
// [0]---------[3]
virtual ~G4PolyPhiFace();
// Destructor. Removes edges and corners.
virtual ~G4PolyPhiFace();
// Destructor. Removes edges and corners.
G4PolyPhiFace( const G4PolyPhiFace &source );
G4PolyPhiFace& operator=( const G4PolyPhiFace &source );
// Copy constructor and assgnment operator.
G4PolyPhiFace( const G4PolyPhiFace &source );
G4PolyPhiFace& operator=( const G4PolyPhiFace &source );
// Copy constructor and assgnment operator.
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Extent( const G4ThreeVector axis );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
G4double Extent( const G4ThreeVector axis );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
inline G4VCSGface *Clone();
// Allocates on the heap a clone of this face.
inline G4VCSGface *Clone();
// Allocates on the heap a clone of this face.
public: // without description
void Diagnose( G4VSolid *solid );
// Throw an exception if something is found inconsistent with
// the solid. For debugging purposes only
void Diagnose( G4VSolid *solid );
// Throw an exception if something is found inconsistent with
// the solid. For debugging purposes only
protected:
G4PolyPhiFaceEdge *edges; // The edges of the face
G4PolyPhiFaceVertex *corners; // And the corners
G4int numEdges; // Number of edges
G4ThreeVector normal; // Normal unit vector
G4ThreeVector radial; // Unit vector along radial direction
G4ThreeVector surface; // Point on surface
G4double rMin, rMax, // Extent in r
zMin, zMax; // Extent in z
G4bool allBehind; // True if the polycone/polyhedra
// is behind the place of this face
G4PolyPhiFaceEdge *edges; // The edges of the face
G4PolyPhiFaceVertex *corners; // And the corners
G4int numEdges; // Number of edges
G4ThreeVector normal; // Normal unit vector
G4ThreeVector radial; // Unit vector along radial direction
G4ThreeVector surface; // Point on surface
G4double rMin, rMax, // Extent in r
zMin, zMax; // Extent in z
G4bool allBehind; // True if the polycone/polyhedra
// is behind the place of this face
G4bool InsideEdgesExact( G4double r, G4double z, G4double normSign,
const G4ThreeVector &p, const G4ThreeVector &v );
// Decide if the point in r,z is inside the edges of our face,
// **but** do so consistently with other faces.
G4bool InsideEdgesExact( G4double r, G4double z, G4double normSign,
const G4ThreeVector &p, const G4ThreeVector &v );
// Decide if the point in r,z is inside the edges of our face,
// **but** do so consistently with other faces.
G4bool InsideEdges( G4double r, G4double z );
G4bool InsideEdges( G4double r, G4double z, G4double *distRZ2,
G4PolyPhiFaceVertex **base3Dnorm=0,
G4ThreeVector **head3Dnorm=0 );
// Decide if the point in r,z is inside the edges of our face.
G4bool InsideEdges( G4double r, G4double z );
G4bool InsideEdges( G4double r, G4double z, G4double *distRZ2,
G4PolyPhiFaceVertex **base3Dnorm=0,
G4ThreeVector **head3Dnorm=0 );
// Decide if the point in r,z is inside the edges of our face.
inline G4double ExactZOrder( G4double z,
G4double qx, G4double qy, G4double qz,
const G4ThreeVector &v,
G4double normSign,
const G4PolyPhiFaceVertex *vert ) const;
// Decide precisely whether a trajectory passes to the left, right,
// or exactly passes through the z position of a vertex point in face.
inline G4double ExactZOrder( G4double z,
G4double qx, G4double qy, G4double qz,
const G4ThreeVector &v,
G4double normSign,
const G4PolyPhiFaceVertex *vert ) const;
// Decide precisely whether a trajectory passes to the left, right,
// or exactly passes through the z position of a vertex point in face.
void CopyStuff( const G4PolyPhiFace &source );
void CopyStuff( const G4PolyPhiFace &source );
};
#include "G4PolyPhiFace.icc"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PolyPhiFace.icc,v 1.3 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4PolyPhiFace.icc,v 1.4 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -36,7 +36,7 @@
inline
G4VCSGface* G4PolyPhiFace::Clone()
{
return new G4PolyPhiFace(*this);
return new G4PolyPhiFace(*this);
}
// ExactZOrder
@@ -54,19 +54,20 @@ G4VCSGface* G4PolyPhiFace::Clone()
inline
G4double G4PolyPhiFace::ExactZOrder( G4double z,
G4double qx, G4double qy, G4double qz,
const G4ThreeVector &v,
const G4ThreeVector &v,
G4double normSign,
const G4PolyPhiFaceVertex *vert ) const
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);
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;
answer = normSign*qacb.dot(v)*(normal.y()*radial.x()-normal.x()*radial.y());
}
return answer;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Polycone.hh,v 1.6 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Polycone.hh,v 1.7 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -33,13 +33,13 @@
//
// Class description:
//
// Class implementing a CSG type "PCON" Geant 3.21 volume,
// inherited from class G4VCSGSolid:
// Class implementing a CSG-like type "PCON" Geant 3.21 volume,
// inherited from class G4VCSGfaceted:
//
// G4Polycone( const G4String& name,
// G4double phiStart, // initial phi starting angle
// G4double phiTotal, // total phi angle
// G4int numZPlanes, // number of z planes
// G4double phiStart, // initial phi starting angle
// G4double phiTotal, // total phi angle
// G4int numZPlanes, // number of z planes
// const G4double zPlane[], // position of z planes
// const G4double rInner[], // tangent distance to inner surface
// const G4double rOuter[]) // tangent distance to outer surface
@@ -68,99 +68,95 @@ class G4VCSGface;
class G4Polycone : public G4VCSGfaceted
{
public:
public: // with description
G4Polycone( const G4String& name,
G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numZPlanes, // number of z planes
const G4double zPlane[], // position of z planes
const G4double rInner[], // tangent distance to inner surface
const G4double rOuter[] ); // tangent distance to outer surface
G4Polycone( const G4String& name,
G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numZPlanes, // number of z planes
const G4double zPlane[], // position of z planes
const G4double rInner[], // tangent distance to inner surface
const G4double rOuter[] ); // tangent distance to outer surface
G4Polycone( const G4String& name,
G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numRZ, // number corners in r,z space
const G4double r[], // r coordinate of these corners
const G4double z[] ); // z coordinate of these corners
G4Polycone( const G4String& name,
G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
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 ~G4Polycone();
G4Polycone( const G4Polycone &source );
const G4Polycone &operator=( const G4Polycone &source );
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);
// Methods for solid
G4GeometryType GetEntityType() const { return G4String("G4Polycone"); }
EInside Inside( const G4ThreeVector &p ) const;
G4double DistanceToIn( const G4ThreeVector &p, const G4ThreeVector &v ) const;
G4double DistanceToIn( const G4ThreeVector &p ) const;
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep );
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; }
inline G4int GetNumRZCorner() const { return numCorner;}
inline G4PolyconeSideRZ GetCorner(G4int index) const { return corners[index]; }
protected:
G4GeometryType GetEntityType() const;
//
// Here are our parameters
//
G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
G4bool phiIsOpen; // true if there is a phi segment
G4int numCorner; // number RZ points
G4PolyconeSideRZ *corners; // corner r,z points
//
// The following is temporary until graphics_reps is brought up to this design
//
class G4PolyconeHistorical
{
public:
G4PolyconeHistorical() {;}
~G4PolyconeHistorical();
G4PolyconeHistorical( const G4PolyconeHistorical &source );
G4double Start_angle;
G4double Opening_angle;
G4int Num_z_planes;
G4double *Z_values;
G4double *Rmin;
G4double *Rmax;
};
G4PolyconeHistorical *original_parameters;
G4std::ostream& StreamInfo(G4std::ostream& os) const;
//
// Our quick test
//
G4EnclosingCylinder *enclosingCylinder;
G4Polyhedron* CreatePolyhedron() const;
G4NURBS* CreateNURBS() const;
//
// Generic initializer, called by all constructors
//
void Create( G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4ReduciblePolygon *rz); // r/z coordinate of these corners
// Accessors
void CopyStuff( const G4Polycone &source );
inline G4double GetStartPhi() const;
inline G4double GetEndPhi() const;
inline G4bool IsOpen() const;
inline G4int GetNumRZCorner() const;
inline G4PolyconeSideRZ GetCorner(G4int index) const;
protected: // without description
// Here are our parameters
G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
G4bool phiIsOpen; // true if there is a phi segment
G4int numCorner; // number RZ points
G4PolyconeSideRZ *corners; // corner r,z points
// The following is temporary until graphics_reps is brought up
// to this design
class G4PolyconeHistorical
{
public:
G4PolyconeHistorical();
~G4PolyconeHistorical();
G4PolyconeHistorical( const G4PolyconeHistorical &source );
G4double Start_angle;
G4double Opening_angle;
G4int Num_z_planes;
G4double *Z_values;
G4double *Rmin;
G4double *Rmax;
};
G4PolyconeHistorical *original_parameters;
// Our quick test
G4EnclosingCylinder *enclosingCylinder;
// Generic initializer, called by all constructors
void Create( G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4ReduciblePolygon *rz ); // r/z coordinate of these corners
void CopyStuff( const G4Polycone &source );
};
#include "G4Polycone.icc"
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: G4Polycone.icc,v 1.1 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
//
// G4Polycone.icc
//
// Implementation of inline methods of G4Polycone
// --------------------------------------------------------------------
inline
G4double G4Polycone::GetStartPhi() const
{
return startPhi;
}
inline
G4double G4Polycone::GetEndPhi() const
{
return endPhi;
}
inline G4bool G4Polycone::IsOpen() const
{
return phiIsOpen;
}
inline
G4int G4Polycone::GetNumRZCorner() const
{
return numCorner;
}
inline
G4PolyconeSideRZ G4Polycone::GetCorner(G4int index) const
{
return corners[index];
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PolyconeSide.hh,v 1.4 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4PolyconeSide.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -40,8 +40,8 @@
// const G4PolyconeSideRZ *tail,
// const G4PolyconeSideRZ *head,
// const G4PolyconeSideRZ *nextRZ,
// G4double phiStart, G4double deltaPhi,
// G4bool phiIsOpen, G4bool isAllBehind=false )
// G4double phiStart, G4double deltaPhi,
// G4bool phiIsOpen, G4bool isAllBehind=false )
//
// Values for r1,z1 and r2,z2 should be specified in clockwise
// order in (r,z).
@@ -57,83 +57,84 @@
class G4IntersectingCone;
typedef struct {
G4double r, z; // start of vector
typedef struct
{
G4double r, z; // start of vector
} G4PolyconeSideRZ;
class G4PolyconeSide : public G4VCSGface
{
public:
G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
const G4PolyconeSideRZ *tail,
const G4PolyconeSideRZ *head,
const G4PolyconeSideRZ *nextRZ,
G4double phiStart, G4double deltaPhi,
G4bool phiIsOpen, G4bool isAllBehind=false );
virtual ~G4PolyconeSide();
G4PolyconeSide( const G4PolyconeSide &source );
G4PolyconeSide& operator=( const G4PolyconeSide &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &isAllBehind );
G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
const G4PolyconeSideRZ *tail,
const G4PolyconeSideRZ *head,
const G4PolyconeSideRZ *nextRZ,
G4double phiStart, G4double deltaPhi,
G4bool phiIsOpen, G4bool isAllBehind=false );
virtual ~G4PolyconeSide();
G4PolyconeSide( const G4PolyconeSide &source );
G4PolyconeSide& operator=( const G4PolyconeSide &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &isAllBehind );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Extent( const G4ThreeVector axis );
G4double Extent( const G4ThreeVector axis );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
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
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, G4bool opposite,
G4double &distOutside2, G4double *rzNorm=0 );
G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
const G4ThreeVector &p, const G4ThreeVector &v, G4ThreeVector &normal );
G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen)
G4double DistanceAway( const G4ThreeVector &p, G4bool opposite,
G4double &distOutside2, G4double *rzNorm=0 );
G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
const G4ThreeVector &p,
const G4ThreeVector &v, G4ThreeVector &normal );
void CopyStuff( const G4PolyconeSide &source );
static void FindLineIntersect( G4double x1, G4double y1,
G4double tx1, G4double ty1,
G4double x2, G4double y2,
G4double tx2, G4double ty2,
G4double &x, G4double &y );
void CopyStuff( const G4PolyconeSide &source );
static void FindLineIntersect( G4double x1, G4double y1,
G4double tx1, G4double ty1,
G4double x2, G4double y2,
G4double tx2, G4double ty2,
G4double &x, G4double &y );
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.hh,v 1.5 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4Polyhedra.hh,v 1.6 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -33,8 +33,8 @@
//
// Class description:
//
// Class implementing a CSG type "PGON" Geant 3.21 volume,
// inherited from class G4CSGSolid:
// Class implementing a CSG-like type "PGON" Geant 3.21 volume,
// inherited from class G4VCSGfaceted:
//
// G4Polyhedra( const G4String& name,
// G4double phiStart, - initial phi starting angle
@@ -68,98 +68,103 @@ class G4ReduciblePolygon;
class G4Polyhedra : public G4VCSGfaceted
{
public:
public: // with description
G4Polyhedra( const G4String& name,
G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numSide, // number sides
G4int numZPlanes, // number of z planes
const G4double zPlane[], // position of z planes
const G4double rInner[], // tangent distance to inner surface
const G4double rOuter[] ); // tangent distance to outer surface
G4Polyhedra( const G4String& name,
G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numSide, // number sides
G4int numZPlanes, // number of z planes
const G4double zPlane[], // position of z planes
const G4double rInner[], // tangent distance to inner surface
const G4double rOuter[] ); // tangent distance to outer surface
G4Polyhedra( const G4String& name,
G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numSide, // number sides
G4int numRZ, // number corners in r,z space
const G4double r[], // r coordinate of these corners
const G4double z[] ); // z coordinate of these corners
G4Polyhedra( const G4String& name,
G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numSide, // number sides
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 );
virtual ~G4Polyhedra();
G4Polyhedra( const G4Polyhedra &source );
const G4Polyhedra &operator=( const G4Polyhedra &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); }
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
// Methods for solid
virtual G4GeometryType GetEntityType() const { return G4String("G4Polyhedra"); }
EInside Inside( const G4ThreeVector &p ) const;
G4double DistanceToIn( const G4ThreeVector &p,
const G4ThreeVector &v ) const;
G4double DistanceToIn( const G4ThreeVector &p ) const;
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
G4Polyhedron* CreatePolyhedron() const;
G4NURBS* CreateNURBS() const;
inline G4int GetNumSide() const { return numSide; }
inline G4double GetStartPhi() const { return startPhi; }
inline G4double GetEndPhi() const { return endPhi; }
inline G4bool IsOpen() const { return phiIsOpen; }
inline G4int GetNumRZCorner() const { return numCorner;}
inline G4PolyhedraSideRZ GetCorner( const G4int index ) const { return corners[index]; }
protected:
//
// Here are our parameters
//
G4int numSide; // Number of sides
G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
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; // our corners
//
// The following is temporary until graphics_reps is brought up to this design
//
struct G4PolyhedraHistorical {
G4PolyhedraHistorical() {;}
~G4PolyhedraHistorical();
G4PolyhedraHistorical( const G4PolyhedraHistorical &source );
G4double Start_angle;
G4double Opening_angle;
G4int numSide;
G4int Num_z_planes;
G4double *Z_values;
G4double *Rmin;
G4double *Rmax;
};
G4PolyhedraHistorical *original_parameters;
//
// Our quick test
//
G4EnclosingCylinder *enclosingCylinder;
G4GeometryType GetEntityType() const;
//
// Generic initializer, call by all constructors
//
void Create( G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numSide, // number sides
G4ReduciblePolygon *rz ); // rz coordinates
G4std::ostream& StreamInfo( G4std::ostream& os ) const;
void CopyStuff( const G4Polyhedra &source );
void DeleteStuff();
G4Polyhedron* CreatePolyhedron() const;
G4NURBS* CreateNURBS() const;
// Accessors
inline G4int GetNumSide() const;
inline G4double GetStartPhi() const;
inline G4double GetEndPhi() const;
inline G4bool IsOpen() const;
inline G4int GetNumRZCorner() const;
inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
protected: // without description
// Here are our parameters
G4int numSide; // Number of sides
G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
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; // our corners
// The following is temporary until graphics_reps is brought up
// to this design
struct G4PolyhedraHistorical
{
G4PolyhedraHistorical();
~G4PolyhedraHistorical();
G4PolyhedraHistorical( const G4PolyhedraHistorical &source );
G4double Start_angle;
G4double Opening_angle;
G4int numSide;
G4int Num_z_planes;
G4double *Z_values;
G4double *Rmin;
G4double *Rmax;
};
G4PolyhedraHistorical *original_parameters;
// Our quick test
G4EnclosingCylinder *enclosingCylinder;
// Generic initializer, call by all constructors
void Create( G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numSide, // number sides
G4ReduciblePolygon *rz ); // rz coordinates
void CopyStuff( const G4Polyhedra &source );
void DeleteStuff();
};
#include "G4Polyhedra.icc"
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: G4Polyhedra.icc,v 1.1 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
//
// G4Polyhedra.icc
//
// Implementation of inline methods of G4Polyhedra
// --------------------------------------------------------------------
inline
G4int G4Polyhedra::GetNumSide() const
{
return numSide;
}
inline
G4double G4Polyhedra::GetStartPhi() const
{
return startPhi;
}
inline
G4double G4Polyhedra::GetEndPhi() const
{
return endPhi;
}
inline
G4bool G4Polyhedra::IsOpen() const
{
return phiIsOpen;
}
inline
G4int G4Polyhedra::GetNumRZCorner() const
{
return numCorner;
}
inline
G4PolyhedraSideRZ G4Polyhedra::GetCorner( const G4int index ) const
{
return corners[index];
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PolyhedraSide.hh,v 1.4 2001/07/11 10:00:15 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4PolyhedraSide.hh,v 1.5 2002/10/28 11:47:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -58,8 +58,9 @@
class G4IntersectingCone;
typedef struct {
G4double r, z; // start of vector
typedef struct
{
G4double r, z; // start of vector
} G4PolyhedraSideRZ;
class G4PolyhedraSide : public G4VCSGface
@@ -67,102 +68,105 @@ class G4PolyhedraSide : public G4VCSGface
public:
G4PolyhedraSide( const G4PolyhedraSideRZ *prevRZ,
const G4PolyhedraSideRZ *tail,
const G4PolyhedraSideRZ *head,
const G4PolyhedraSideRZ *nextRZ,
G4int numSide,
G4double phiStart, G4double phiTotal,
G4bool phiIsOpen, G4bool isAllBehind=false );
virtual ~G4PolyhedraSide();
G4PolyhedraSide( const G4PolyhedraSide &source );
G4PolyhedraSide& operator=( const G4PolyhedraSide &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4PolyhedraSide( const G4PolyhedraSideRZ *prevRZ,
const G4PolyhedraSideRZ *tail,
const G4PolyhedraSideRZ *head,
const G4PolyhedraSideRZ *nextRZ,
G4int numSide,
G4double phiStart, G4double phiTotal,
G4bool phiIsOpen, G4bool isAllBehind=false );
virtual ~G4PolyhedraSide();
G4PolyhedraSide( const G4PolyhedraSide &source );
G4PolyhedraSide& operator=( const G4PolyhedraSide &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Extent( const G4ThreeVector axis );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
G4double Extent( const G4ThreeVector axis );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
G4VCSGface *Clone() { return new G4PolyhedraSide( *this ); }
G4VCSGface *Clone() { return new G4PolyhedraSide( *this ); }
protected:
//
// A couple internal data structures
//
struct sG4PolyhedraSideVec; // Secret recipe for allowing
friend struct sG4PolyhedraSideVec; // protected nested structures
//
// A couple internal data structures
//
struct sG4PolyhedraSideVec; // Secret recipe for allowing
friend struct sG4PolyhedraSideVec; // protected nested structures
typedef struct sG4PolyhedraSideEdge {
G4ThreeVector normal; // Unit normal to this edge
G4ThreeVector corner[2]; // The two corners of this phi edge
G4ThreeVector cornNorm[2]; // The normals of these corners
} G4PolyhedraSideEdge;
typedef struct sG4PolyhedraSideVec {
G4ThreeVector normal, // Normal (point out of the shape)
center, // Point in center of side
surfPhi, // Unit vector on surface pointing along phi
surfRZ; // Unit vector on surface pointing along R/Z
G4PolyhedraSideEdge *edges[2]; // The phi boundary edges to this side
// [0]=low phi [1]=high phi
G4ThreeVector edgeNorm[2]; // RZ edge normals [i] at {r[i],z[i]}
} G4PolyhedraSideVec;
typedef struct sG4PolyhedraSideEdge
{
G4ThreeVector normal; // Unit normal to this edge
G4ThreeVector corner[2]; // The two corners of this phi edge
G4ThreeVector cornNorm[2]; // The normals of these corners
} G4PolyhedraSideEdge;
typedef struct sG4PolyhedraSideVec
{
G4ThreeVector normal, // Normal (point out of the shape)
center, // Point in center of side
surfPhi, // Unit vector on surface pointing along phi
surfRZ; // Unit vector on surface pointing along R/Z
G4PolyhedraSideEdge *edges[2]; // The phi boundary edges to this side
// [0]=low phi [1]=high phi
G4ThreeVector edgeNorm[2]; // RZ edge normals [i] at {r[i],z[i]}
} G4PolyhedraSideVec;
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
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
G4PolyhedraSideVec *vecs; // Vector set for each facet of our face
G4PolyhedraSideEdge *edges; // The edges belong to vecs
G4double lenRZ, // RZ length of each side
lenPhi[2]; // Phi dimensions of each side
G4double edgeNorm; // Normal in RZ/Phi space to each side
G4bool IntersectSidePlane( const G4ThreeVector &p, const G4ThreeVector &v,
const G4PolyhedraSideVec vec,
G4double normSign,
G4double surfTolerance,
G4double &distance, G4double &distFromSurface );
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
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
G4PolyhedraSideVec *vecs; // Vector set for each facet of our face
G4PolyhedraSideEdge *edges; // The edges belong to vecs
G4double lenRZ, // RZ length of each side
lenPhi[2]; // Phi dimensions of each side
G4double edgeNorm; // Normal in RZ/Phi space to each side
G4bool IntersectSidePlane( const G4ThreeVector &p, const G4ThreeVector &v,
const G4PolyhedraSideVec vec,
G4double normSign,
G4double surfTolerance,
G4double &distance,
G4double &distFromSurface );
G4int LineHitsSegments( const G4ThreeVector &p, const G4ThreeVector &v,
G4int *i1, G4int *i2 );
G4int LineHitsSegments( const G4ThreeVector &p,
const G4ThreeVector &v,
G4int *i1, G4int *i2 );
G4int ClosestPhiSegment( G4double phi );
G4int PhiSegment( G4double phi );
G4double DistanceToOneSide( const G4ThreeVector &p,
const G4PolyhedraSideVec &vec,
G4double *normDist );
G4int ClosestPhiSegment( G4double phi );
G4int PhiSegment( G4double phi );
G4double DistanceToOneSide( const G4ThreeVector &p,
const G4PolyhedraSideVec &vec,
G4double *normDist );
G4double DistanceAway( const G4ThreeVector &p,
const G4PolyhedraSideVec &vec,
G4double *normDist );
void CopyStuff( const G4PolyhedraSide &source );
G4double DistanceAway( const G4ThreeVector &p,
const G4PolyhedraSideVec &vec,
G4double *normDist );
void CopyStuff( const G4PolyhedraSide &source );
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ReduciblePolygon.hh,v 1.4 2001/07/11 10:00:15 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4ReduciblePolygon.hh,v 1.5 2002/10/28 11:47:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -62,86 +62,87 @@ class G4ReduciblePolygon
friend class G4ReduciblePolygonIterator;
public:
//
// Creator: via simple a/b arrays
//
G4ReduciblePolygon( const G4double a[], const G4double b[], 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[], 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;
//
// Creator: via simple a/b arrays
//
G4ReduciblePolygon( const G4double a[], const G4double b[], 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[], 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( G4double scale );
void ScaleB( G4double scale );
G4bool RemoveDuplicateVertices( G4double tolerance );
G4bool RemoveRedundantVertices( G4double tolerance );
void ReverseOrder();
//
// Manipulations
//
void ScaleA( G4double scale );
void ScaleB( G4double scale );
G4bool RemoveDuplicateVertices( G4double tolerance );
G4bool RemoveRedundantVertices( G4double tolerance );
void ReverseOrder();
//
// Tests
//
G4double Area();
G4bool CrossesItself( G4double tolerance );
G4bool BisectedBy( G4double a1, G4double b1,
G4double a2, G4double b2, G4double tolerance );
void Print(); // Debugging only
//
// Tests
//
G4double Area();
G4bool CrossesItself( G4double tolerance );
G4bool BisectedBy( G4double a1, G4double b1,
G4double a2, G4double b2, G4double tolerance );
void Print(); // Debugging only
protected:
void Create( const G4double a[], const G4double b[], 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;
void Create( const G4double a[], const G4double b[], 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;
private:
G4ReduciblePolygon(const G4ReduciblePolygon&);
G4ReduciblePolygon& operator=(const G4ReduciblePolygon&);
// Private copy constructor and assignment operator.
G4ReduciblePolygon(const G4ReduciblePolygon&);
G4ReduciblePolygon& operator=(const G4ReduciblePolygon&);
// Private copy constructor and assignment operator.
};
@@ -153,21 +154,21 @@ class G4ReduciblePolygonIterator
{
public:
G4ReduciblePolygonIterator( const G4ReduciblePolygon *theSubject )
{ subject = theSubject; current=0; }
void Begin() { current = subject->vertexHead; }
G4bool Next() { if (current) current=current->next; return Valid(); }
G4bool Valid() const { return current!=0; }
G4double GetA() const { return current->a; }
G4double GetB() const { return current->b; }
G4ReduciblePolygonIterator( const G4ReduciblePolygon *theSubject )
{ subject = theSubject; current=0; }
void Begin() { current = subject->vertexHead; }
G4bool Next() { if (current) current=current->next; return Valid(); }
G4bool Valid() const { return current!=0; }
G4double GetA() const { return current->a; }
G4double GetB() const { return current->b; }
protected:
const G4ReduciblePolygon *subject; // Who are we iterating over
G4ReduciblePolygon::ABVertex *current; // Current vertex
const G4ReduciblePolygon *subject; // Who are we iterating over
G4ReduciblePolygon::ABVertex *current; // Current vertex
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SolidExtentList.hh,v 1.4 2001/07/11 10:00:15 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4SolidExtentList.hh,v 1.5 2002/10/28 11:47:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -36,7 +36,7 @@
// Defines 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
// to calculate the extent of a CSG-like solid for a voxel
// (G4VSolid::CalculateExtent).
// Author:
@@ -53,28 +53,28 @@
class G4SolidExtentList
{
public:
G4SolidExtentList();
G4SolidExtentList( const EAxis targetAxis, const G4VoxelLimits &voxelLimits );
~G4SolidExtentList();
G4SolidExtentList();
G4SolidExtentList( const EAxis targetAxis,
const G4VoxelLimits &voxelLimits );
~G4SolidExtentList();
void AddSurface( const G4ClippablePolygon &surface );
void AddSurface( const G4ClippablePolygon &surface );
G4bool GetExtent( G4double &min, G4double &max ) const;
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
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
G4ClippablePolygon minSurface, // Minimum surface within limits
maxSurface, // Maximum
minAbove, // Minimum surface totally above max limit
maxBelow; // Maximum surface totally below min limit
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VCSGface.hh,v 1.4 2001/07/11 10:00:15 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VCSGface.hh,v 1.5 2002/10/28 11:47:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -34,7 +34,7 @@
// Class description:
//
// Definition of the virtual base class G4VCSGface, one side (or face)
// of a CSG solid. It should be possible to build a CSG entirely out of
// of a CSG-like solid. It should be possible to build a CSG entirely out of
// connecting CSG faces.
//
// Each face has an inside and outside surface, the former represents
@@ -42,15 +42,15 @@
//
// Virtual members:
//
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
// G4bool outGoing, G4double surfTolerance,
// G4double &distance, G4double &distFromSurface,
// G4ThreeVector &normal, G4bool &allBehind );
// G4bool outGoing, G4double surfTolerance,
// G4double &distance, G4double &distFromSurface,
// G4ThreeVector &normal, G4bool &allBehind );
//
// p - (in) position
// v - (in) direction (assumed to be a unit vector)
// outgoing - (in) true, to consider only inside surfaces
// outgoing - (in) true, to consider only inside surfaces
// false, to consider only outside surfaces
// distance - (out) distance to intersection
// distFromSurface - (out) distance from surface (along surface normal),
@@ -62,56 +62,56 @@
// false if there is no intersection
// (all output arguments undefined)
//
// Determine the distance along a line to the face.
// Determine the distance along a line to the face.
//
// -------------------------------------------------------------------
// Distance( const G4ThreeVector &p, const G4bool outgoing );
// -------------------------------------------------------------------
// Distance( const G4ThreeVector &p, const G4bool outgoing );
//
// p - (in) position
// outgoing - (in) true, to consider only inside surfaces
// p - (in) position
// outgoing - (in) true, to consider only inside surfaces
// false, to consider only outside surfaces
//
// return value = distance to closest surface satisifying requirements
// return value = distance to closest surface satisifying requirements
// or kInfinity if no such surface exists
//
// Determine the distance of a point from either the inside or outside
// surfaces of the face.
// Determine the distance of a point from either the inside or outside
// surfaces of the face.
//
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Inside( const G4ThreeVector &p, const G4double tolerance,
// G4double *bestDistance );
// G4double *bestDistance );
//
// p - (in) position
// tolerance - (in) tolerance defining the bounds of the "kSurface",
// nominally equal to kCarTolerance/2
// bestDistance - (out) distance to closest surface (in or out)
// p - (in) position
// tolerance - (in) tolerance defining the bounds of the "kSurface",
// nominally equal to kCarTolerance/2
// bestDistance - (out) distance to closest surface (in or out)
//
// return value = kInside if the point is closest to the inside surface
// kOutside if the point is closest to the outside surface
// kSurface if the point is withing tolerance of the surface
// return value = kInside if the point is closest to the inside surface
// kOutside if the point is closest to the outside surface
// kSurface if the point is withing tolerance of the surface
//
// Determine whether a point is inside, outside, or on the surface of
// the face.
// Determine whether a point is inside, outside, or on the surface of
// the face.
//
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Normal( const G4ThreeVector &p, G4double *bestDistance );
//
// p - (in) position
// bestDistance - (out) distance to closest surface (in or out)
// p - (in) position
// bestDistance - (out) distance to closest surface (in or out)
//
// return value = the normal of the surface nearest the point
// return value = the normal of the surface nearest the point
//
// Return normal of surface closest to the point.
// Return normal of surface closest to the point.
//
// -------------------------------------------------------------------
// Extent( const G4ThreeVector axis );
// -------------------------------------------------------------------
// Extent( const G4ThreeVector axis );
//
// axis - (in) unit vector defining direction
// axis - (in) unit vector defining direction
//
// return value = the largest point along the given axis of the
// the face's extent.
// return value = the largest point along the given axis of the
// the face's extent.
//
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// CalculateExtent( const EAxis pAxis,
// const G4VoxelLimit &pVoxelLimit,
// const G4AffineTransform &pTransform,
@@ -126,16 +126,16 @@
// surface after tranformation and limits
// along pAxis that is smaller than the value
// of min, than it is used to replace min.
// Undefined if the return value is false.
// Undefined if the return value is false.
// max - (out) Same as min, except for the largest
// point.
// Undefined if the return value is false.
// 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
// done in the following steps:
// Calculate the extent of the face for the voxel navigator.
// In analogy with CalculateExtent for G4VCSGfaceted, this is
// done in the following steps:
//
// 1. Transform the face using pTranform, an arbitrary 3D
// rotation/offset/reflection
@@ -153,32 +153,32 @@
// 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:
// 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); }
// G4VCSGface G4PolySideFace::Clone() { return new G4PolySideFace(*this); }
//
// Of course, this assumes the copy constructor of G4PolySideFace is
// correctly implemented.
// Of course, this assumes the copy constructor of G4PolySideFace is
// correctly implemented.
//
// Implementation notes:
// * distance.
// * distance.
// The meaning of distance includes the boundaries of the face.
// For example, for a rectangular, planer face:
//
// A | B | C
// | |
// -------+--------------+-----
// D | I | E
// | |
// -------+--------------+-----
// F | G | H
// | |
// A | B | C
// | |
// -------+--------------+-----
// D | I | E
// | |
// -------+--------------+-----
// F | G | H
// | |
//
// A, C, F, and H: closest distance is the distance to
// the adjacent corner.
@@ -212,20 +212,20 @@
// a value of "bestDistance" smaller than any other. While looping, if any
// face->Inside returns kSurface, this value can be returned immediately.
//
// EInside answer;
// G4VCSGface *face = faces;
// G4double best = kInfinity;
// do {
// G4double distance;
// EInside result = (*face)->Inside( p, kCarTolerance/2, distance );
// if (result == kSurface) return kSurface;
// if (distance < best) {
// best = distance;
// answer = result;
// }
// } while( ++face < faces + numFaces );
// EInside answer;
// G4VCSGface *face = faces;
// G4double best = kInfinity;
// do {
// G4double distance;
// EInside result = (*face)->Inside( p, kCarTolerance/2, distance );
// if (result == kSurface) return kSurface;
// if (distance < best) {
// best = distance;
// answer = result;
// }
// } while( ++face < faces + numFaces );
//
// return(answer);
// return(answer);
//
// G4VSolid::SurfaceNormal
//
@@ -272,32 +272,32 @@ class G4SolidExtentList;
class G4VCSGface
{
public:
public: // with description
G4VCSGface() {;}
virtual ~G4VCSGface() {;}
virtual G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind ) = 0;
G4VCSGface() {}
virtual ~G4VCSGface() {}
virtual G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind ) = 0;
virtual G4double Distance( const G4ThreeVector &p, G4bool outgoing ) = 0;
virtual EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance ) = 0;
virtual G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance ) = 0;
virtual G4double Distance( const G4ThreeVector &p, G4bool outgoing ) = 0;
virtual EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance ) = 0;
virtual G4ThreeVector Normal( const G4ThreeVector &p,
G4double *bestDistance ) = 0;
virtual G4double Extent( const G4ThreeVector axis ) = 0;
virtual void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList ) = 0;
virtual G4double Extent( const G4ThreeVector axis ) = 0;
virtual void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList ) = 0;
virtual G4VCSGface* Clone() = 0;
virtual G4VCSGface* Clone() = 0;
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VCSGfaceted.hh,v 1.6 2001/07/11 10:00:15 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4VCSGfaceted.hh,v 1.7 2002/10/28 11:47:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// --------------------------------------------------------------------
@@ -33,7 +33,7 @@
//
// Class description:
//
// Virtual class defining CSG type shape that is built entire
// Virtual class defining CSG-like type shape that is built entire
// of G4CSGface faces.
// Author:
@@ -50,46 +50,53 @@ class G4VisExtent;
class G4VCSGfaceted : public G4VSolid
{
public:
public: // with description
G4VCSGfaceted( G4String name) : G4VSolid(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,
G4double& pmin, G4double& pmax) const;
virtual EInside Inside( const G4ThreeVector& p) const;
G4VCSGfaceted( G4String 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,
G4double& pmin, G4double& pmax ) const;
virtual EInside Inside( const G4ThreeVector& p ) const;
virtual G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
virtual G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p,const G4ThreeVector& v ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p,const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,G4ThreeVector *n=0 ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p,
const G4ThreeVector& v ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,
G4ThreeVector *n=0 ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p ) const;
G4GeometryType GetEntityType() const { return G4String("G4CSGfaceted"); }
virtual G4GeometryType GetEntityType() const;
virtual G4Polyhedron* CreatePolyhedron() const = 0;
virtual G4std::ostream& StreamInfo(G4std::ostream& os) const;
virtual void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
virtual G4Polyhedron* CreatePolyhedron() const = 0;
virtual G4VisExtent GetExtent() const;
virtual void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
protected:
G4int numFace;
G4VCSGface **faces;
virtual G4VisExtent GetExtent() const;
virtual G4double DistanceTo( const G4ThreeVector &p, const G4bool outgoing ) const;
protected: // without description
void CopyStuff( const G4VCSGfaceted &source );
void DeleteStuff();
G4int numFace;
G4VCSGface **faces;
virtual G4double DistanceTo( const G4ThreeVector &p,
const G4bool outgoing ) const;
void CopyStuff( const G4VCSGfaceted &source );
void DeleteStuff();
};
#endif