Path: cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!fs7.ece.cmu.edu!europa.eng.gtefsd.com!emory!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!linac!unixhub!slacvm!rcb
Organization: Stanford Linear Accelerator Center
Date: Friday, 16 Apr 1993 08:33:00 PST
From: <RCB@SLACVM.SLAC.STANFORD.EDU>
Message-ID: <93106.083301RCB@SLACVM.SLAC.STANFORD.EDU>
Newsgroups: comp.graphics
Subject: Re: Sphere from 4 points?
Distribution: world
References:  <1qkgbuINNs9n@shelley.u.washington.edu>
Lines: 21


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

> Given 4 points (non coplanar), how does one find the sphere, that is,
> cnter and radius, exactly fitting those points?

The equation of the sphere through the 4 points (x1,y1,z1),...,(x4,y4,z4) is
  | x^2+y^2+z^2  x1^2+y1^2+z1^2  ...  x4^2+y4^2+z4^2 |
  |      x             x1        ...        x4       |
  |      y             y1        ...        y4       | = 0
  |      z             z1        ...        z4       |
  |      1             1         ...        1        |
When this 5 by 5 determininant is expanded on its first column you get the
equation in the form
  A(x^2+y^2+z^2) + Bx + Cy + Dz + E = 0
If you need the center and radius, jyst divide through by A (it cannot be
zero if the 4 given points form a non-degenerate tetrahedron) and complete
the square on x, y, and z to obtain
  (x-xc)^2 + (y-yc)^2 + (z-zc)^2 = r^2

rcb@slacvm.slac.stanford.edu (Bob Beach)
