How do I calculate the intersection of three spheres step by step?
Assume that the spheres are
$S_i(c_i, r_i)$
where $i = 1,2,3$, $c_i$ is the center coordinates of $S_i$ and $r_i$ is the radius of $S_i$.
First method comes to mind is finding the intersection of two spheres and caculate the plane-sphere intersection.
But again, I'm stuck at
$a^2 + b^2 + c^2 - d^2 - e^2 - f^2 - 2(ax+by+cz)+2(dx+ey+fz) = R^2 - Q^2$
where $S_1((a,b,c), R)$ and
$S_2((d,e,f), Q)$
Could you help me to go on?
Edit:
For center points $\{(a,b,c), (d,e,f), (e,f,g)\}$ and radii $\{r_0,r_1,r_2\}$ I have the matrix
$2\left[\begin{array}{ccc} d-a & e-b & f-c \\ g-d & h-e & i-f \\ a-g & b-h & c-i \end{array}\right]$
and I solve for
$\left[\begin{array}{ccc}
P - Q \\
Q - R \\
R - P\end{array}\right]$
where
$P = ({r_0}^2 - a^2 - b^2 - c^2)$
$Q = ({r_1}^2 - d^2 - e^2 - f^2)$
$R = ({r_2}^2 - g^2 - h^2 - i^2)$
But I get $\left[\begin{array}{ccc} NaN \\ NaN \\ NaN\end{array}\right]$ for centers $\{(0,0,0), (3,0,0), (0,4,0)\}$ and radii $\{5,4,3\}$.
Have I built the matrices wrong?
Edit2:
I've made another trial with $(18,41,27),(34,12,12),(31,43,17)$ and $\{76.635500912, 98.493654618, 73.661387443 \}$ still, $NaN$
I've tried for ${18,41,27},{34,12,12},{31,43,17},{64,92,61}$ and still, $NaN$
– padawan May 08 '14 at 17:34