Given four 3-dimensional points, the SPH_4PNT procedure returns the center and radius necessary to define the unique sphere passing through those points.
This routine is written in the IDL language. Its source code can be found in the file
sph_4pnt.pro
in the
lib
subdirectory of the IDL distribution.
Find the center and radius of the unique sphere passing through the points: (1, 1, 0), (2, 1, 2), (1, 0, 3), (1, 0, 1)
Define the floating-point vectors containing the x, y and z coordinates of the points.
X = [1, 2, 1, 1] + 0.0 ; Define the floating-point vectors
Y = [1, 1, 0, 0] + 0.0 ; containing the x, y and z
Z = [0, 2, 3, 1] + 0.0 ; coordinates of the points.
SPH_4PNT, X, Y, Z, Xc, Yc, Zc, R ; Compute sphere's center and radius.