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 ;
88 if ( (sCode & eCode) != 0 )
92 remainsAfterClip =
false;
94 else if ( sCode == 0 && eCode == 0 )
98 remainsAfterClip = true ;
115 while ( sCode != eCode )
123 if ( (sCode & 0x01) != 0 )
125 z1 += (fxAxisMin-x1)*(z2-z1)/(x2-x1);
126 y1 += (fxAxisMin-x1)*(y2-y1)/(x2-x1);
129 else if ( (sCode & 0x02) != 0 )
131 z1 += (fxAxisMax-x1)*(z2-z1)/(x2-x1);
132 y1 += (fxAxisMax-x1)*(y2-y1)/(x2-x1);
135 else if ( (sCode & 0x04) != 0 )
137 x1 += (fyAxisMin-y1)*(x2-x1)/(y2-y1);
138 z1 += (fyAxisMin-y1)*(z2-z1)/(y2-y1);
141 else if ( (sCode & 0x08) != 0 )
143 x1 += (fyAxisMax-y1)*(x2-x1)/(y2-y1);
144 z1 += (fyAxisMax-y1)*(z2-z1)/(y2-y1);
147 else if ( (sCode & 0x10) != 0 )
149 x1 += (fzAxisMin-z1)*(x2-x1)/(z2-z1);
150 y1 += (fzAxisMin-z1)*(y2-y1)/(z2-z1);
153 else if ( (sCode & 0x20) != 0 )
155 x1 += (fzAxisMax-z1)*(x2-x1)/(z2-z1);
156 y1 += (fzAxisMax-z1)*(y2-y1)/(z2-z1);
162 if ( (eCode & 0x01) != 0 )
164 z2 += (fxAxisMin-x2)*(z1-z2)/(x1-x2);
165 y2 += (fxAxisMin-x2)*(y1-y2)/(x1-x2);
168 else if ( (eCode & 0x02) != 0 )
170 z2 += (fxAxisMax-x2)*(z1-z2)/(x1-x2);
171 y2 += (fxAxisMax-x2)*(y1-y2)/(x1-x2);
174 else if ( (eCode & 0x04) != 0 )
176 x2 += (fyAxisMin-y2)*(x1-x2)/(y1-y2);
177 z2 += (fyAxisMin-y2)*(z1-z2)/(y1-y2);
180 else if ((eCode&0x08) != 0)
182 x2 += (fyAxisMax-y2)*(x1-x2)/(y1-y2);
183 z2 += (fyAxisMax-y2)*(z1-z2)/(y1-y2);
186 else if ( (eCode & 0x10) != 0 )
188 x2 += (fzAxisMin-z2)*(x1-x2)/(z1-z2);
189 y2 += (fzAxisMin-z2)*(y1-y2)/(z1-z2);
192 else if ( (eCode & 0x20) != 0 )
194 x2 += (fzAxisMax-z2)*(x1-x2)/(z1-z2);
195 y2 += (fzAxisMax-z2)*(y1-y2)/(z1-z2);
204 remainsAfterClip = sCode == 0 && eCode == 0;
206 return remainsAfterClip;