Question: How can I write the equation of a sphere in the form (x-a)^2 + (y-b)^2 + (z-c)^2 = r^2

I this code, I do my hand.

restart;
with(geom3d);
ptA := coordinates(point(A, 1, -4, 3));
point(B, -3, 2, 5);
r := distance(A, B);
(x - ptA[1])^2 + (y - ptA[2])^2 + (z - ptA[3])^2 = r^2;

How can I do it automatically? 

Please Wait...