FREE Online Measurements Converters and Calculators
  Online Calculators - Online Converters - Unit Measurement Translators
Metric <-> Imperial <-> Metric
   

  Sphere Solver
 
Custom Search

 

This Java Script calculator finds the center and radius of a sphere given four points in Cartesian coordinates. To operate the calculator, enter the x-y-z coordinates for four points. Press the Compute button to obtain the solution. On invalid entries, a popup window will display an error message

Enter four points {x, y, z}:
x y z
Center and radius:
Xo =  
Yo =  
Zo =  
radius =  

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,
{x1, y1, z1}, {x2, y2, z2}, {x3, y3, z3}, {x4, y4, z4}
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:

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:

(x2 + y2 + z2)·M11 - x·M12 + y·M13 - z·M14 + M15 = 0
This can be converted to the canonical form of the equation of a sphere:
x2 + y2 + z2 - (M12/M11)·x + (M13/M11)·y - (M14/M11)·z + M15/M11 = 0
Completing the squares in x and y and z gives:
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