Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!uakari.primate.wisc.edu!sdd.hp.com!spool.mu.edu!news.nd.edu!mentor.cc.purdue.edu!noose.ecn.purdue.edu!cidmac.ecn.purdue.edu!3ksnn64 From: 3ksnn64@cidmac.ecn.purdue.edu (Joe Cychosz) Newsgroups: comp.graphics Subject: Re: intersecting planes and spheres Message-ID: <1991May24.214306.16919@noose.ecn.purdue.edu> Date: 24 May 91 21:43:06 GMT References: <1991May23.205708.9746@hellgate.utah.edu> <1991May24.180454.10744@noose.ecn.purdue.edu> Sender: root@noose.ecn.purdue.edu (ECN System Management) Organization: Purdue University Engineering Computer Network Lines: 39 In article <1991May24.180454.10744@noose.ecn.purdue.edu> 3ksnn64@cidmac.ecn.purdue.edu (Joe Cychosz) writes: >In article <1991May23.205708.9746@hellgate.utah.edu> mblum%asylum.utah.edu@cs.utah.edu (Michael Blum) writes: >>HI! >> >>I'm trying to figure out how to find whether a sphere intersects a plane. >>Actually, I need to know whether a sphere intersects a cube, and >>if so which side of the cube. I imagine this is a simple extension >>to the general intersection problem, but I'm not exactly sure >>how to approach the problem. Any ideas? please e-mail at >>mblum@asylum.utah.edu >> > >1. Compute the perpendicular distance the center of the sphere is from the > plane. > >2. The dot product of the plane normal with the vector formed by the the > line from the plane through the center of the sphere tells you what > side of the plane the sphere is on. The dot product should be 1 or -1. > >3. If the perpendicular distance is less than the radius, the sphere > intersects the plane. > >4. For the cube case you can treat the plane pairs together and the > distance to the second plane = the distance between the planes - > dot product (step 2) * distance (step 1). > >5. Count the number of cases where the sphere is between the plane pairs > or intersects one of the planes. If the answer is 3, the sphere is > within or intersects the cube. Assumption: the normal of the 6 planes > all point outward of the cube. As has been pointed out to me. It is possible for a sphere to intersect the plane pairs and still not intersect the cube. At the moment I do not have a correction for the algorithm. A sphere may be "between" all three plane pairs and still not intersect the cube. As an example consider the cube defined by 0<= x <= 1; 0 <= y <= 1; 0 <= z <= 1 and the sphere centred at (-2, -2, 0) and passing through (-1, .5, 0).