Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!agate!bionet!parc!glassner From: glassner@parc.xerox.com (Andrew Glassner) Newsgroups: comp.graphics Subject: Re: intersecting planes and spheres Message-ID: Date: 29 May 91 05:26:03 GMT Article-I.D.: overture.glassner.675494763 References: <1991May23.205708.9746@hellgate.utah.edu> Sender: news@parc.xerox.com Organization: Xerox PARC Lines: 15 A previous poster writes: >Actually, I need to know whether a sphere intersects a cube, and >if so which side of the cube. A solution is presented in "A Simple Method for Box-Sphere Intersection Testing," by Jim Arvo, in the book "Graphics Gems," published by Academic Press (pp. 335-339). C source code for the technique is also given in the book (pp. 730-732) - the code is available via anonymous ftp from weedeater.math.yale.edu. Minor changes will tell you which side of the cube is intersected. Jim also describes how to generalize the method to ellipsoids and arbitrary rectangular boxes (not just cubes). It's fast, elegant, correct, and simple - this is the technique I use in my ray tracer. -Andrew Glassner (glassner@xerox.com)