46 if ( pMin > fxAxisMin ) fxAxisMin = pMin ;
47 if ( pMax < fxAxisMax ) fxAxisMax = pMax ;
49 else if ( pAxis ==
kYAxis )
51 if ( pMin > fyAxisMin ) fyAxisMin = pMin ;
52 if ( pMax < fyAxisMax ) fyAxisMax = pMax ;
56 assert( pAxis ==
kZAxis ) ;
58 if ( pMin > fzAxisMin ) fzAxisMin = pMin ;
59 if ( pMax < fzAxisMax ) fzAxisMax = pMax ;
92 remainsAfterClip =
false;
94 else if ( sCode == 0 && eCode == 0 )
98 remainsAfterClip = true ;
115 while ( sCode != eCode )
125 z1 += (fxAxisMin-x1)*(z2-z1)/(x2-x1);
126 y1 += (fxAxisMin-x1)*(y2-y1)/(x2-x1);
129 else if ( sCode & 0x02 )
131 z1 += (fxAxisMax-x1)*(z2-z1)/(x2-x1);
132 y1 += (fxAxisMax-x1)*(y2-y1)/(x2-x1);
135 else if ( sCode & 0x04 )
137 x1 += (fyAxisMin-y1)*(x2-x1)/(y2-y1);
138 z1 += (fyAxisMin-y1)*(z2-z1)/(y2-y1);
141 else if ( sCode & 0x08 )
143 x1 += (fyAxisMax-y1)*(x2-x1)/(y2-y1);
144 z1 += (fyAxisMax-y1)*(z2-z1)/(y2-y1);
147 else if ( sCode & 0x10 )
149 x1 += (fzAxisMin-z1)*(x2-x1)/(z2-z1);
150 y1 += (fzAxisMin-z1)*(y2-y1)/(z2-z1);
153 else if ( sCode & 0x20 )
155 x1 += (fzAxisMax-z1)*(x2-x1)/(z2-z1);
156 y1 += (fzAxisMax-z1)*(y2-y1)/(z2-z1);
164 z2 += (fxAxisMin-x2)*(z1-z2)/(x1-x2);
165 y2 += (fxAxisMin-x2)*(y1-y2)/(x1-x2);
168 else if ( eCode & 0x02 )
170 z2 += (fxAxisMax-x2)*(z1-z2)/(x1-x2);
171 y2 += (fxAxisMax-x2)*(y1-y2)/(x1-x2);
174 else if ( eCode & 0x04 )
176 x2 += (fyAxisMin-y2)*(x1-x2)/(y1-y2);
177 z2 += (fyAxisMin-y2)*(z1-z2)/(y1-y2);
182 x2 += (fyAxisMax-y2)*(x1-x2)/(y1-y2);
183 z2 += (fyAxisMax-y2)*(z1-z2)/(y1-y2);
186 else if ( eCode & 0x10 )
188 x2 += (fzAxisMin-z2)*(x1-x2)/(z1-z2);
189 y2 += (fzAxisMin-z2)*(y1-y2)/(z1-z2);
192 else if ( eCode & 0x20 )
194 x2 += (fzAxisMax-z2)*(x1-x2)/(z1-z2);
195 y2 += (fzAxisMax-z2)*(y1-y2)/(z1-z2);
204 if ( sCode == 0 && eCode == 0 ) remainsAfterClip =
true;
205 else remainsAfterClip =
false;
207 return remainsAfterClip;
227 if ( pVec.
x() < fxAxisMin )
code |= 0x01 ;
228 if ( pVec.
x() > fxAxisMax )
code |= 0x02 ;
232 if ( pVec.
y() < fyAxisMin )
code |= 0x04 ;
233 if ( pVec.
y() > fyAxisMax )
code |= 0x08 ;
237 if ( pVec.
z() < fzAxisMin )
code |= 0x10 ;
238 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