I have read much about intersection of two spheres from spheres-intersect , circlesphere and collision-points but all are based on the assumption of spheres located at origin or $x$-axis or some have provided equations in vector form which is far from my ability to understand.
Equation for intersection of two spheres having centres at $(0,0,0)$ and $(d,0,0)$.
$$h^2 = \frac{4 d^ 2 r1^2 - (d^2 - r2^2 + r1^2)^2}{ 4 d^2}$$
where $h$ is radius of intersecting circle.
How can I modify this equation for calculating radius $h$ for spheres intersection having arbitary points as centres $(x_1,y_1,z_1)$ and $(x_2,y_2,z_2)$ (have to convert it into code)?
If you forget about the coordinates for a second, you will see that the radius $h$ only depends on the two radii, which are given, and the distance $d$ between the two center points.
Let's change notation and call the two points $x = (x_1,x_2,x_3)$ and $y = (y_1,y_2,y_3)$.
All you need then is to be able to calculate the distance between two arbitrary points. For this, just use Pythagoras:
$d^2 = (y_1-x_1)^2 + (y_2-x_2)^2 + (y_3-x_3)^2$
and plug in the value in the formula you already have.
The set of points you are trying to find is a circle of radius $h$, perpendicular to the line between your two points.
The line between your two points is the set of points with coordinates:
$ x + t(y-x) = \big( (1-t)x_1 + t y_1, (1-t)x_2 + t y_2,(1-t)x_3 + t y_3 \big)$
for $0\leq t \leq 1$. By trigonometry you will see that the coordinates of the center of the circle you are looking for are given by $z = x+t_h(y-x)$ with
\begin{equation}t_h = \frac{\sqrt{r_1^2-h^2}}{d}\end{equation}
The last step is to calculate the coordinates of the circle. They lie on the plane through $z$ which is perpendicular to y-x. So they will be of the form $a = z + b$, where $b$ satisfies: \begin{align} b \circ (y-x) &:= b_1(y_1-x_1) + b_2(y_2-x_2) b_2(y_2-x_2) = 0 \\ ||b||^2 &:= b_1^2 + b_2^2 + b_3^2 = h^2 \end{align}
These can be found here.