Point/Box in sphere-check?

I want to check wether a box is intersecting a sphere with at least one corner.
I know this is not OGL related but if you have some code please post it. I just can’t get it right, I’ tired and stuff. Thanks for the help…

Not sure if this is what you are looking for, but if you know the center point of the sphere and the radius of the sphere, find the line between center of sphere and corner of box. Find the length of line. If line length is less than radius then box corner point is within sphere.

if ((box_corner - circle_center) < circle_radius)
// intersecting
else if ((box_corner - circle_center) > circle_radius)
// not intersecting
// touching each other


[This message has been edited by jebus (edited 02-14-2003).]

OK, thanks I got something working now.