Newsgroups: comp.graphics
Path: cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!fs7.ece.cmu.edu!europa.eng.gtefsd.com!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!netcomsv!netcom.com!spworley
From: spworley@netcom.com (Steve Worley)
Subject: Re: Sphere from 4 points?
Message-ID: <spworleyC5Jy7r.6Bo@netcom.com>
Organization: NETCOM On-line Communication Services (408 241-9760 guest)
References: <1qkgbuINNs9n@shelley.u.washington.edu>
Date: Fri, 16 Apr 1993 01:16:38 GMT
Lines: 38

bolson@carson.u.washington.edu (Edward Bolson) writes:

>Boy, this will be embarassing if it is trivial or an FAQ:

>Given 4 points (non coplanar), how does one find the sphere, that is,
>center and radius, exactly fitting those points?  I know how to do it
>for a circle (from 3 points), but do not immediately see a 
>straightforward way to do it in 3-D.  I have checked some
>geometry books, Graphics Gems, and Farin, but am still at a loss?
>Please have mercy on me and provide the solution?  

It's not a bad question: I don't have any refs that list this algorithm
either. But thinking about it a bit, it shouldn't be too hard.

1) Take three of the points and find the plane they define as well as
the circle that they lie on (you say you have this algorithm already)

2) Find the center  of this circle. The line passing through this center
perpendicular to the plane of the three points passes through the center of
the sphere.

3) Repeat with the unused point and two of the original points. This
gives you two different lines that both pass through the sphere's
origin. Their interection is the center of the sphere.

4) the radius is easy to compute, it's just the distance from the center to
any of the original points.

I'll leave the math to you, but this is a workable algorithm. :-)


An alternate method would be to take pairs of points: the plane formed
by the perpendicular bisector of each line segment pair also contains the
center of the sphere. Three pairs will form three planes, intersecting
at a point. This might be easier to implement.

-Steve
spworley@netcom.com
