Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!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.180454.10744@noose.ecn.purdue.edu> Date: 24 May 91 18:04:54 GMT References: <1991May23.205708.9746@hellgate.utah.edu> Sender: root@noose.ecn.purdue.edu (ECN System Management) Organization: Purdue University Engineering Computer Network Lines: 29 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.