3 #ifndef G4MAIN_PHBBOX_H
4 #define G4MAIN_PHBBOX_H
17 PHBBox(
const double x0,
const double y0,
const double x1,
const double y1) :
23 bool ClipLine(
double&
x0,
double& y0,
double& x1,
double& y1)
const
28 while ( clipCode0 || clipCode1 )
33 if ( clipCode0 & clipCode1 )
return false;
36 if ( clipCode0 > 0 ) code = clipCode0;
37 else code = clipCode1;
41 if ( (code &
BOTTOM) == BOTTOM )
46 x = x0 + (x1-
x0)*(
y-y0)/(y1-y0);
48 else if ( (code &
TOP) ==
TOP )
53 x = x0 + (x1-
x0)*(
y-y0)/(y1-y0);
59 y = y0 + (y1-y0)*(x-x0)/(x1-
x0);
65 y = y0 + (y1-y0)*(x-x0)/(x1-
x0);
70 if ( code == clipCode0 )
103 else if ( x <
_x0 ) code |=
LEFT;
104 if ( y >
_y1 ) code |=
TOP;
115 #endif // __PHBBOX_H__