G4SolidExtentList Class Reference

#include <G4SolidExtentList.hh>


Public Member Functions

 G4SolidExtentList ()
 G4SolidExtentList (const EAxis targetAxis, const G4VoxelLimits &voxelLimits)
 ~G4SolidExtentList ()
void AddSurface (const G4ClippablePolygon &surface)
G4bool GetExtent (G4double &min, G4double &max) const

Protected Attributes

EAxis axis
G4bool limited
G4double minLimit
G4double maxLimit
G4ClippablePolygon minSurface
G4ClippablePolygon maxSurface
G4ClippablePolygon minAbove
G4ClippablePolygon maxBelow


Detailed Description

Definition at line 54 of file G4SolidExtentList.hh.


Constructor & Destructor Documentation

G4SolidExtentList::G4SolidExtentList (  ) 

Definition at line 48 of file G4SolidExtentList.cc.

References axis, INT_MAX, kZAxis, limited, maxLimit, and minLimit.

00049 {
00050   axis = kZAxis;
00051   limited = false;
00052   minLimit = -INT_MAX/2;
00053   maxLimit =  INT_MAX/2;
00054 }

G4SolidExtentList::G4SolidExtentList ( const EAxis  targetAxis,
const G4VoxelLimits voxelLimits 
)

Definition at line 60 of file G4SolidExtentList.cc.

References axis, G4VoxelLimits::GetMaxExtent(), G4VoxelLimits::GetMinExtent(), INT_MAX, G4VoxelLimits::IsLimited(), limited, maxLimit, and minLimit.

00062 {
00063   axis = targetAxis;
00064   
00065   limited = voxelLimits.IsLimited( axis );
00066   if (limited)
00067   {
00068     minLimit = voxelLimits.GetMinExtent( axis );
00069     maxLimit = voxelLimits.GetMaxExtent( axis );
00070   }
00071   else
00072   {
00073     minLimit = -INT_MAX/2;
00074     maxLimit =  INT_MAX/2;
00075   }
00076 }

G4SolidExtentList::~G4SolidExtentList (  ) 

Definition at line 82 of file G4SolidExtentList.cc.

00083 {
00084 }


Member Function Documentation

void G4SolidExtentList::AddSurface ( const G4ClippablePolygon surface  ) 

Definition at line 91 of file G4SolidExtentList.cc.

References axis, G4ClippablePolygon::BehindOf(), G4ClippablePolygon::GetExtent(), G4ClippablePolygon::InFrontOf(), maxBelow, maxLimit, maxSurface, minAbove, minLimit, and minSurface.

Referenced by G4Hype::AddPolyToExtent(), G4PolyPhiFace::CalculateExtent(), G4PolyhedraSide::CalculateExtent(), G4PolyconeSide::CalculateExtent(), G4Hype::CalculateExtent(), G4EllipticalTube::CalculateExtent(), and G4EllipticalCone::CalculateExtent().

00092 {
00093   //
00094   // Keep track of four surfaces
00095   //
00096   G4double min, max;
00097   
00098   surface.GetExtent( axis, min, max );
00099   
00100   if (min > maxLimit)
00101   {
00102     //
00103     // Nearest surface beyond maximum limit
00104     //
00105     if (surface.InFrontOf(minAbove,axis)) minAbove = surface;
00106   }
00107   else if (max < minLimit)
00108   {
00109     //
00110     // Nearest surface below minimum limit
00111     //
00112     if (surface.BehindOf(maxBelow,axis)) maxBelow = surface;
00113   }
00114   else
00115   {
00116     //
00117     // Max and min surfaces inside
00118     //
00119     if (surface.BehindOf(maxSurface,axis)) maxSurface = surface;
00120     if (surface.InFrontOf(minSurface,axis)) minSurface = surface;
00121   }
00122 }

G4bool G4SolidExtentList::GetExtent ( G4double min,
G4double max 
) const

Definition at line 131 of file G4SolidExtentList.cc.

References axis, G4ClippablePolygon::Empty(), G4ClippablePolygon::GetExtent(), G4GeometryTolerance::GetInstance(), G4ClippablePolygon::GetNormal(), G4GeometryTolerance::GetSurfaceTolerance(), maxLimit, maxSurface, minAbove, minLimit, and minSurface.

Referenced by G4VCSGfaceted::CalculateExtent(), G4TwistedTubs::CalculateExtent(), G4Hype::CalculateExtent(), G4EllipticalTube::CalculateExtent(), and G4EllipticalCone::CalculateExtent().

00132 {
00133   G4double kCarTolerance = G4GeometryTolerance::GetInstance()
00134                            ->GetSurfaceTolerance();
00135   //
00136   // Did we have any surfaces within the limits?
00137   //
00138   if (minSurface.Empty())
00139   {
00140     //
00141     // Nothing! Do we have anything above?
00142     //
00143     if (minAbove.Empty()) return false;
00144     
00145     //
00146     // Yup. Is it facing inwards?
00147     //
00148     if (minAbove.GetNormal().operator()(axis) < 0) return false;
00149     
00150     //
00151     // No. We must be entirely within the solid
00152     //
00153     max = maxLimit + kCarTolerance;
00154     min = minLimit - kCarTolerance;
00155     return true;
00156   }
00157   
00158   //
00159   // Check max surface
00160   //
00161   if (maxSurface.GetNormal().operator()(axis) < 0)
00162   {
00163     //
00164     // Inward facing: max limit must be embedded within solid
00165     //
00166     max = maxLimit + kCarTolerance;
00167   }
00168   else
00169   {
00170     G4double sMin, sMax;
00171     maxSurface.GetExtent( axis, sMin, sMax );
00172     max = ( (sMax > maxLimit) ? maxLimit : sMax ) + kCarTolerance;
00173   }
00174   
00175   //
00176   // Check min surface
00177   //
00178   if (minSurface.GetNormal().operator()(axis) > 0)
00179   {
00180     //
00181     // Inward facing: max limit must be embedded within solid
00182     //
00183     min = minLimit - kCarTolerance;
00184   }
00185   else
00186   {
00187     G4double sMin, sMax;
00188     minSurface.GetExtent( axis, sMin, sMax );
00189     min = ( (sMin < minLimit) ? minLimit : sMin ) - kCarTolerance;
00190   }
00191   
00192   return true;
00193 }


Field Documentation

EAxis G4SolidExtentList::axis [protected]

Definition at line 70 of file G4SolidExtentList.hh.

Referenced by AddSurface(), G4SolidExtentList(), and GetExtent().

G4bool G4SolidExtentList::limited [protected]

Definition at line 71 of file G4SolidExtentList.hh.

Referenced by G4SolidExtentList().

G4ClippablePolygon G4SolidExtentList::maxBelow [protected]

Definition at line 75 of file G4SolidExtentList.hh.

Referenced by AddSurface().

G4double G4SolidExtentList::maxLimit [protected]

Definition at line 73 of file G4SolidExtentList.hh.

Referenced by AddSurface(), G4SolidExtentList(), and GetExtent().

G4ClippablePolygon G4SolidExtentList::maxSurface [protected]

Definition at line 75 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().

G4ClippablePolygon G4SolidExtentList::minAbove [protected]

Definition at line 75 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().

G4double G4SolidExtentList::minLimit [protected]

Definition at line 72 of file G4SolidExtentList.hh.

Referenced by AddSurface(), G4SolidExtentList(), and GetExtent().

G4ClippablePolygon G4SolidExtentList::minSurface [protected]

Definition at line 75 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:24 2013 for Geant4 by  doxygen 1.4.7