Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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() [1/2]

G4SolidExtentList::G4SolidExtentList ( )

Definition at line 48 of file G4SolidExtentList.cc.

49{
50 axis = kZAxis;
51 limited = false;
52 minLimit = -INT_MAX/2;
53 maxLimit = INT_MAX/2;
54}
@ kZAxis
Definition: geomdefs.hh:54
#define INT_MAX
Definition: templates.hh:111

◆ G4SolidExtentList() [2/2]

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

Definition at line 60 of file G4SolidExtentList.cc.

62{
63 axis = targetAxis;
64
65 limited = voxelLimits.IsLimited( axis );
66 if (limited)
67 {
68 minLimit = voxelLimits.GetMinExtent( axis );
69 maxLimit = voxelLimits.GetMaxExtent( axis );
70 }
71 else
72 {
73 minLimit = -INT_MAX/2;
74 maxLimit = INT_MAX/2;
75 }
76}
G4double GetMinExtent(const EAxis pAxis) const
G4double GetMaxExtent(const EAxis pAxis) const
G4bool IsLimited() const

◆ ~G4SolidExtentList()

G4SolidExtentList::~G4SolidExtentList ( )

Definition at line 82 of file G4SolidExtentList.cc.

83{
84}

Member Function Documentation

◆ AddSurface()

void G4SolidExtentList::AddSurface ( const G4ClippablePolygon surface)

Definition at line 91 of file G4SolidExtentList.cc.

92{
93 //
94 // Keep track of four surfaces
95 //
96 G4double min, max;
97
98 surface.GetExtent( axis, min, max );
99
100 if (min > maxLimit)
101 {
102 //
103 // Nearest surface beyond maximum limit
104 //
105 if (surface.InFrontOf(minAbove,axis)) minAbove = surface;
106 }
107 else if (max < minLimit)
108 {
109 //
110 // Nearest surface below minimum limit
111 //
112 if (surface.BehindOf(maxBelow,axis)) maxBelow = surface;
113 }
114 else
115 {
116 //
117 // Max and min surfaces inside
118 //
119 if (surface.BehindOf(maxSurface,axis)) maxSurface = surface;
120 if (surface.InFrontOf(minSurface,axis)) minSurface = surface;
121 }
122}
double G4double
Definition: G4Types.hh:64
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

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

◆ GetExtent()

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

Definition at line 131 of file G4SolidExtentList.cc.

132{
135 //
136 // Did we have any surfaces within the limits?
137 //
138 if (minSurface.Empty())
139 {
140 //
141 // Nothing! Do we have anything above?
142 //
143 if (minAbove.Empty()) return false;
144
145 //
146 // Yup. Is it facing inwards?
147 //
148 if (minAbove.GetNormal().operator()(axis) < 0) return false;
149
150 //
151 // No. We must be entirely within the solid
152 //
153 max = maxLimit + kCarTolerance;
154 min = minLimit - kCarTolerance;
155 return true;
156 }
157
158 //
159 // Check max surface
160 //
161 if (maxSurface.GetNormal().operator()(axis) < 0)
162 {
163 //
164 // Inward facing: max limit must be embedded within solid
165 //
166 max = maxLimit + kCarTolerance;
167 }
168 else
169 {
170 G4double sMin, sMax;
171 maxSurface.GetExtent( axis, sMin, sMax );
172 max = ( (sMax > maxLimit) ? maxLimit : sMax ) + kCarTolerance;
173 }
174
175 //
176 // Check min surface
177 //
178 if (minSurface.GetNormal().operator()(axis) > 0)
179 {
180 //
181 // Inward facing: max limit must be embedded within solid
182 //
183 min = minLimit - kCarTolerance;
184 }
185 else
186 {
187 G4double sMin, sMax;
188 minSurface.GetExtent( axis, sMin, sMax );
189 min = ( (sMin < minLimit) ? minLimit : sMin ) - kCarTolerance;
190 }
191
192 return true;
193}
G4bool Empty() const
const G4ThreeVector GetNormal() const
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()

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

Member Data Documentation

◆ axis

EAxis G4SolidExtentList::axis
protected

Definition at line 70 of file G4SolidExtentList.hh.

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

◆ limited

G4bool G4SolidExtentList::limited
protected

Definition at line 71 of file G4SolidExtentList.hh.

Referenced by G4SolidExtentList().

◆ maxBelow

G4ClippablePolygon G4SolidExtentList::maxBelow
protected

Definition at line 78 of file G4SolidExtentList.hh.

Referenced by AddSurface().

◆ maxLimit

G4double G4SolidExtentList::maxLimit
protected

Definition at line 73 of file G4SolidExtentList.hh.

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

◆ maxSurface

G4ClippablePolygon G4SolidExtentList::maxSurface
protected

Definition at line 76 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().

◆ minAbove

G4ClippablePolygon G4SolidExtentList::minAbove
protected

Definition at line 77 of file G4SolidExtentList.hh.

Referenced by AddSurface(), and GetExtent().

◆ minLimit

G4double G4SolidExtentList::minLimit
protected

Definition at line 72 of file G4SolidExtentList.hh.

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

◆ minSurface

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: