Geant4-11
Public Member Functions | Protected Attributes
G4SolidExtentList Class Reference

#include <G4SolidExtentList.hh>

Public Member Functions

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

Protected Attributes

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

Detailed Description

Definition at line 45 of file G4SolidExtentList.hh.

Constructor & Destructor Documentation

◆ G4SolidExtentList() [1/2]

G4SolidExtentList::G4SolidExtentList ( )

Definition at line 37 of file G4SolidExtentList.cc.

38{
39 axis = kZAxis;
40 minLimit = -INT_MAX/2;
41 maxLimit = INT_MAX/2;
42}
@ kZAxis
Definition: geomdefs.hh:57
#define INT_MAX
Definition: templates.hh:90

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

◆ G4SolidExtentList() [2/2]

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

Definition at line 46 of file G4SolidExtentList.cc.

48{
49 axis = targetAxis;
50
51 limited = voxelLimits.IsLimited( axis );
52 if (limited)
53 {
54 minLimit = voxelLimits.GetMinExtent( axis );
55 maxLimit = voxelLimits.GetMaxExtent( axis );
56 }
57 else
58 {
59 minLimit = -INT_MAX/2;
60 maxLimit = INT_MAX/2;
61 }
62}
G4double GetMinExtent(const EAxis pAxis) const
G4double GetMaxExtent(const EAxis pAxis) const
G4bool IsLimited() const

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

◆ ~G4SolidExtentList()

G4SolidExtentList::~G4SolidExtentList ( )

Definition at line 66 of file G4SolidExtentList.cc.

67{
68}

Member Function Documentation

◆ AddSurface()

void G4SolidExtentList::AddSurface ( const G4ClippablePolygon surface)

Definition at line 73 of file G4SolidExtentList.cc.

74{
75 //
76 // Keep track of four surfaces
77 //
79
80 surface.GetExtent( axis, min, max );
81
82 if (min > maxLimit)
83 {
84 //
85 // Nearest surface beyond maximum limit
86 //
87 if (surface.InFrontOf(minAbove,axis)) minAbove = surface;
88 }
89 else if (max < minLimit)
90 {
91 //
92 // Nearest surface below minimum limit
93 //
94 if (surface.BehindOf(maxBelow,axis)) maxBelow = surface;
95 }
96 else
97 {
98 //
99 // Max and min surfaces inside
100 //
101 if (surface.BehindOf(maxSurface,axis)) maxSurface = surface;
102 if (surface.InFrontOf(minSurface,axis)) minSurface = surface;
103 }
104}
double G4double
Definition: G4Types.hh:83
virtual G4bool GetExtent(const EAxis axis, G4double &min, G4double &max) const
virtual G4bool InFrontOf(const G4ClippablePolygon &other, EAxis axis) const
virtual G4bool BehindOf(const G4ClippablePolygon &other, EAxis axis) const
G4ClippablePolygon minAbove
G4ClippablePolygon maxBelow
G4ClippablePolygon minSurface
G4ClippablePolygon maxSurface
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

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

Referenced by G4PolyconeSide::CalculateExtent(), G4PolyhedraSide::CalculateExtent(), and G4PolyPhiFace::CalculateExtent().

◆ GetExtent()

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

Definition at line 110 of file G4SolidExtentList.cc.

111{
114 //
115 // Did we have any surfaces within the limits?
116 //
117 if (minSurface.Empty())
118 {
119 //
120 // Nothing! Do we have anything above?
121 //
122 if (minAbove.Empty()) return false;
123
124 //
125 // Yup. Is it facing inwards?
126 //
127 if (minAbove.GetNormal().operator()(axis) < 0) return false;
128
129 //
130 // No. We must be entirely within the solid
131 //
134 return true;
135 }
136
137 //
138 // Check max surface
139 //
140 if (maxSurface.GetNormal().operator()(axis) < 0)
141 {
142 //
143 // Inward facing: max limit must be embedded within solid
144 //
146 }
147 else
148 {
149 G4double sMin, sMax;
150 maxSurface.GetExtent( axis, sMin, sMax );
151 max = ( (sMax > maxLimit) ? maxLimit : sMax ) + kCarTolerance;
152 }
153
154 //
155 // Check min surface
156 //
157 if (minSurface.GetNormal().operator()(axis) > 0)
158 {
159 //
160 // Inward facing: max limit must be embedded within solid
161 //
163 }
164 else
165 {
166 G4double sMin, sMax;
167 minSurface.GetExtent( axis, sMin, sMax );
168 min = ( (sMin < minLimit) ? minLimit : sMin ) - kCarTolerance;
169 }
170
171 return true;
172}
const G4double kCarTolerance
G4bool Empty() const
const G4ThreeVector GetNormal() const
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()

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

Referenced by G4VCSGfaceted::CalculateExtent().

Field Documentation

◆ axis

EAxis G4SolidExtentList::axis
protected

Definition at line 61 of file G4SolidExtentList.hh.

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

◆ limited

G4bool G4SolidExtentList::limited = false
protected

Definition at line 62 of file G4SolidExtentList.hh.

Referenced by G4SolidExtentList().

◆ maxBelow

G4ClippablePolygon G4SolidExtentList::maxBelow
protected

Definition at line 69 of file G4SolidExtentList.hh.

Referenced by AddSurface().

◆ maxLimit

G4double G4SolidExtentList::maxLimit
protected

Definition at line 64 of file G4SolidExtentList.hh.

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

◆ maxSurface

G4ClippablePolygon G4SolidExtentList::maxSurface
protected

Definition at line 67 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().

◆ minAbove

G4ClippablePolygon G4SolidExtentList::minAbove
protected

Definition at line 68 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().

◆ minLimit

G4double G4SolidExtentList::minLimit
protected

Definition at line 63 of file G4SolidExtentList.hh.

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

◆ minSurface

G4ClippablePolygon G4SolidExtentList::minSurface
protected

Definition at line 66 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().


The documentation for this class was generated from the following files: