| Notes 
 From analytic geometry, we know that there is a unique sphere that 
            passes through four non-coplanar points if, and only if, they are 
            not on the same plane. If they are on the same plane, either there 
            are no spheres through the 4 points, or an infinite number of them 
            if the 4 points are on a circle. Given 4 points,
  
              how does 
            one find the center and radius of a sphere exactly fitting those points? 
            They can be found by solving the following determinant equation:{x1, y1, z1}, {x2, y2, z2}, {x3, y3, z3}, {x4, y4, z4}
 
 
 
               
                | x2 
                  + y2 + z2 | x | y | z | 1 | = 
                  0 |   
                | x12 
                  + y12 + z12 | x1 | y1 | z1 | 1 |   
                | x22 
                  + y22 + z22 | x2 | y2 | z2 | 1 |   
                | x32 
                  + y32 + z32 | x3 | y3 | z3 | 1 |   
                | x42 
                  + y42 + z42 | x4 | y4 | z4 | 1 |  Evaluating 
              the cofactors for the first row of the determinant can give us a 
              solution. The determinant equation can be written as an equation 
              of these cofactors:   
              This can 
            be converted to the canonical form of the equation of a sphere:(x2 + y2 + z2)·M11 - x·M12 + y·M13 - z·M14 + M15 = 0
  
              Completing 
            the squares in x and y and z gives:x2 + y2 + z2 - (M12/M11)·x + (M13/M11)·y - (M14/M11)·z + M15/M11 = 0
  
              x0 =  0.5·M12/M11 
y0 = -0.5·M13/M11 
z0 =  0.5·M14/M11 
r02 = x02 + y02 + z02 - M15/M11 
 Note 
              that there is no solution when M11 is equal 
              to zero. In this case, the points are not on a sphere; they may 
              all be on a plane or three points may be on a straight line.
 Copyright © 2004, Stephen R. Schmitt
 |