title: Choice of sphere/frustum overlap test
body: <p>I’m trying to comprehend something that’s probably a lot easier than I think right now so hopefully someone might be able to help me understand what I describe below.</p>
  
  <p>I know that a sphere is outside the view frustum if it’s completely behind at least one of the six frustum planes in 3D (left, right, bottom, top, near far). This is true for the circle with center c2 in the example below, which is completely outside left plane. The overlap test is simply done by inserting the center coordinates of the sphere into the plane equation to get the distance from the center to the plane and then comparing this with the radius of the sphere.</p>
  
  <p>However, using this approach on the sphere with center c1 will give us a false positive since the test will tell us the sphere is inside both right and far plane (if seen from above).  The solution is then to use a more exact overlap test by determining the distance from the spheres center to the corner of the view frustum that is closest to it. If this distance is greater than the radius, the sphere is outside the frustum etc.</p>
  
  <p><a href="https://i.stack.imgur.com/v20qw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v20qw.png" alt="Spheres and viewing frustum"></a></p>
  
  <p>What I don’t understand is what if we use this second approach, looking at the corners instead of the planes, on a sphere located like the one with center c3. Won’t the test will give us that the distance from the spheres center minus the radius is greater than 0 and thus outside of the viewing volume?</p>
  
  <p>So If am given a set of rules for an orthographic view volume, i.e. 0 ≤ x ≤ 20, -5 ≤ 15, -5 ≤ z ≤ 18, and x,y,z-coordinates + radius of a sphere and told to determine whether the sphere is inside or outside it. How do I choose what method to use in order to really obtain the right answer?</p>