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!newsserver.jvnc.net!newsserver.technet.sg!iti.gov.sg!johne
From: johne@iti.gov.sg (Dr. John S. Eickemeyer)
Subject: Re: Sphere from 4 points?
Message-ID: <1993Apr16.060044.14644@iti.gov.sg>
Sender: news@iti.gov.sg (News Admin)
Organization: Information Technology Institute, National Computer Board, Singapore.
References: <1qkgbuINNs9n@shelley.u.washington.edu>
Date: Fri, 16 Apr 1993 06:00:44 GMT
Lines: 37

In article <1qkgbuINNs9n@shelley.u.washington.edu> bolson@carson.u.washington.edu (Edward Bolson) writes:
>Boy, this will be embarassing if it is trivial or an FAQ:
>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?  

Off the top of my head, I might try:

Given: p_1, p_2, p_3, p_4

Find:  p_c (center of sphere determined by p_1, ..., p_4), 
       dist(p_c, p_i) (radius)

p_c is the same distance from our four points, so
dist(p_c,p_1) = dist(p_c,p_2) = dist(p_c,p_3) = dist(p_c,p_4) 

Of course, we can square the whole thing to get rid of square roots:
distsq(p_c,p_1) = distsq(p_c,p_2) = distsq(p_c,p_3) = distsq(p_c,p_4) 

Plug in the variables into the distance formula, simplify, and the 
x^2_c, y^2_c, and z^2_c terms cancel out, leaving you with three 
linearly independent equations and three unknowns (x_c, y_c, z_c).  
Solve using your favorite method.  :)


All the best,

- John :)

-------------------------------------------------------------------------------
Dr. John S. Eickemeyer                 ::     "The Lord God is subtle,
Information Technology Institute      ::::     but malicious He is not."
National Computer Board, Singapore     ::
Email: johne@iti.gov.sg                ::                     - Albert Einstein
-------------------------------------------------------------------------------
