Intersection of a disc with an axis-aligned cube What is the most efficient way to determine whether a disc of radius $r$, centred at $(x_d,y_d,z_d)$ and with normal $(n_x,n_y,n_z)$, intersects any part of an axis-aligned cube defined by two opposite corner points $(x_0,y_0,z_0)$ and $(x_1,y_1,z_1)$?
I don't need to know anything about where, if at all, the disc intersects the cube, just whether it intersects or not.
 A: There are two tests:


*

*find the plane passing from $(x_d,y_d,z_d)$ and normal $(n_x,n_y,n_z)$. It is something like $p(x,y,z)=ax+by+cz-d=0$. then test if all 8 points of the cube are at the same side of this plane or not (if p has the same sign for all of them). If yes, it means the cube and disk have no intersect. If not, go to the next test:

*See if the following equation/in-equation has non-empty solution (intersection):
$$x_0<x<x_1$$
$$y_0<y<y_1$$
$$z_0<z<z_1$$
$$ax+by+cz=d$$
$$(x-x_d)^2+(y-y_d)^2+(z-z_d)^2\leq R^2$$
To have any intersection, it is required that at least two points of the cube are at different sides of the plane of the disk (test 1).
To have any intersection, it is required that the cube, the disk plane and the sphere passing $(x_d,y_d,z_d)$ with radius R, all three have intersection (test 2).
The cube is defined by 
$$x_0<x<x_1$$
$$y_0<y<y_1$$
$$z_0<z<z_1$$
The sphere is defined by
$$(x-x_d)^2+(y-y_d)^2+(z-z_d)^2\leq R^2$$
and the disk plane is defined by 
$$ax+by+cz=d$$
A: The plane of the disc will intersect the cube, or it won't.  If it doesn't, then you have your answer.
If it does, then you have a (limited) number of line segments (or perhaps a point) to check for distance.  These line segments comprise the polygon created by the intersection of the plane and the cube.
Then, it's a matter of determining the distance from the center of the disc to each point on each line segment.  If some point is less than a distance $r$ from the center of the disc, the disc intersects the cube.  Otherwise, it doesn't.
