Sphere equation.

The equation of a sphere with center at point (h, k, l) is:
(x − h)^{2} + (y − k)^{2} + (z − l)^{2} = r^{2}
The equivalent form of sphere equation is:
x^{2} + y^{2} + z^{2} + Dx + Ey + Fz + G = 0
The relations between the coefficients are:
D = − 2h E = − 2k F = − 2l G = h^{2} + k^{2} + l^{2} − r^{2}

The angle θ between two points
P_{1} (x_{1} , y_{1} , z_{1}) and P_{2} (x_{2} , y_{2} , z_{2})
both points lays on the sphere.

The arc length between those two points is: L = θr

The equation of sphere passing through 4 points: P_{1} (x_{1} , y_{1} , z_{1})
P_{2} (x_{2} , y_{2} , z_{2}) , P_{3}
(x_{3} , y_{3} , z_{3}) and P_{4} (x_{4} , y_{4} , z_{4}).

Because each point is located on the sphere, we get 4 equations with the unknowns coefficients D, E, F and G they can be valuated by solving the
system of the equations by matrix methods (Cramer's rule).
Where: 
t_{1} = −(x_{1}^{2} + y_{1}^{2} + z_{1}^{2}) 
t_{2} = −(x_{2}^{2} + y_{2}^{2}+ z_{2}^{2}) 
t_{3} =−(x_{3}^{2} + y_{3}^{2} + z_{3}^{2}) 
t_{4} =−(x_{4}^{2} + y_{4}^{2} + z_{4}^{2}) 
T is the determinant value 
T = 

The center of the sphere is at coordinate: 

The radius of the sphere is: 

