58 if ( pMin > fxAxisMin ) fxAxisMin = pMin ;
59 if ( pMax < fxAxisMax ) fxAxisMax = pMax ;
61 else if ( pAxis ==
kYAxis )
63 if ( pMin > fyAxisMin ) fyAxisMin = pMin ;
64 if ( pMax < fyAxisMax ) fyAxisMax = pMax ;
68 assert( pAxis ==
kZAxis ) ;
70 if ( pMin > fzAxisMin ) fzAxisMin = pMin ;
71 if ( pMax < fzAxisMax ) fzAxisMax = pMax ;
104 remainsAfterClip =
false;
106 else if ( sCode == 0 && eCode == 0 )
110 remainsAfterClip = true ;
127 while ( sCode != eCode )
137 z1 += (fxAxisMin-x1)*(z2-z1)/(x2-x1);
138 y1 += (fxAxisMin-x1)*(y2-y1)/(x2-x1);
141 else if ( sCode & 0x02 )
143 z1 += (fxAxisMax-x1)*(z2-z1)/(x2-x1);
144 y1 += (fxAxisMax-x1)*(y2-y1)/(x2-x1);
147 else if ( sCode & 0x04 )
149 x1 += (fyAxisMin-y1)*(x2-x1)/(y2-y1);
150 z1 += (fyAxisMin-y1)*(z2-z1)/(y2-y1);
153 else if ( sCode & 0x08 )
155 x1 += (fyAxisMax-y1)*(x2-x1)/(y2-y1);
156 z1 += (fyAxisMax-y1)*(z2-z1)/(y2-y1);
159 else if ( sCode & 0x10 )
161 x1 += (fzAxisMin-z1)*(x2-x1)/(z2-z1);
162 y1 += (fzAxisMin-z1)*(y2-y1)/(z2-z1);
165 else if ( sCode & 0x20 )
167 x1 += (fzAxisMax-z1)*(x2-x1)/(z2-z1);
168 y1 += (fzAxisMax-z1)*(y2-y1)/(z2-z1);
176 z2 += (fxAxisMin-x2)*(z1-z2)/(x1-x2);
177 y2 += (fxAxisMin-x2)*(y1-y2)/(x1-x2);
180 else if ( eCode & 0x02 )
182 z2 += (fxAxisMax-x2)*(z1-z2)/(x1-x2);
183 y2 += (fxAxisMax-x2)*(y1-y2)/(x1-x2);
186 else if ( eCode & 0x04 )
188 x2 += (fyAxisMin-y2)*(x1-x2)/(y1-y2);
189 z2 += (fyAxisMin-y2)*(z1-z2)/(y1-y2);
194 x2 += (fyAxisMax-y2)*(x1-x2)/(y1-y2);
195 z2 += (fyAxisMax-y2)*(z1-z2)/(y1-y2);
198 else if ( eCode & 0x10 )
200 x2 += (fzAxisMin-z2)*(x1-x2)/(z1-z2);
201 y2 += (fzAxisMin-z2)*(y1-y2)/(z1-z2);
204 else if ( eCode & 0x20 )
206 x2 += (fzAxisMax-z2)*(x1-x2)/(z1-z2);
207 y2 += (fzAxisMax-z2)*(y1-y2)/(z1-z2);
216 if ( sCode == 0 && eCode == 0 ) remainsAfterClip =
true;
217 else remainsAfterClip =
false;
219 return remainsAfterClip;
239 if ( pVec.
x() < fxAxisMin )
code |= 0x01 ;
240 if ( pVec.
x() > fxAxisMax )
code |= 0x02 ;
244 if ( pVec.
y() < fyAxisMin )
code |= 0x04 ;
245 if ( pVec.
y() > fyAxisMax )
code |= 0x08 ;
249 if ( pVec.
z() < fzAxisMin )
code |= 0x10 ;
250 if ( pVec.
z() > fzAxisMax )
code |= 0x20 ;
CLHEP::Hep3Vector G4ThreeVector
std::ostream & operator<<(std::ostream &os, const G4VoxelLimits &pLim)
G4int OutCode(const G4ThreeVector &pVec) const
G4bool IsYLimited() const
G4bool ClipToLimits(G4ThreeVector &pStart, G4ThreeVector &pEnd) const
G4double GetMinZExtent() const
void AddLimit(const EAxis pAxis, const G4double pMin, const G4double pMax)
G4bool IsXLimited() const
G4double GetMaxYExtent() const
G4double GetMaxZExtent() const
G4double GetMinYExtent() const
G4double GetMinXExtent() const
G4bool IsZLimited() const
G4double GetMaxXExtent() const