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.
Examples
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):
X = [1, 2, 1, 1] + 0.0
Y = [1, 1, 0, 0] + 0.0
Z = [0, 2, 3, 1] + 0.0
SPH_4PNT, X, Y, Z, Xc, Yc, Zc, R
PRINT, Xc, Yc, Zc, R
IDL prints:
-0.500000 2.00000 2.00000 2.69258
Syntax
SPH_4PNT, X, Y, Z, Xc, Yc, Zc, R [, /DOUBLE]
Arguments
X, Y, Z
4-element floating-point or double-precision vectors containing the X, Y, and Z coordinates of the points.
Xc, Yc, Zc
Named variables that will contain the sphere’s center X, Y, and Z coordinates.
R
A named variable that will contain the sphere’s radius.
Keywords
DOUBLE
Set this keyword to force computations to be done in double-precision arithmetic.
Version History
See Also
CIR_3PNT, PNT_LINE