Hi, H/A.
I'm tearing my hair out here trying to figure this out from first principles, and so far the math is kicking my ass. I'm trying to get a general equation for the intersection of three spheres so that I can input different sphere origin points and radii into excel and get the resultant intersection. If anyone is curious, I'm doing this to solve linkages in 3d.
Anyway, so far I have this:
Our three spheres:
(x-x1)^2 + (y-y1)^2 + (z-z1)^2 = R1^2............(1)
(x-x2)^2 + (y-y2)^2 + (z-z2)^2 = R2^2............(2)
(x-x3)^2 + (y-y3)^2 + (z-z3)^2 = R3^2............(3)
x1, x2, x3, y1, y2, y3, z1, z2, z3 are my linkage base points I plan to input into excel
R1, R2, R3 are my linkage lengths
I guess this makes x, y, z the coordinates of my intersection point(s).
According to
http://mathforum.org/library/drmath/view/64311.html, I have to (paraphrased):
1) Pick one of the equations and subtract it from the other two, giving two linear equations in the three unknowns.
2) Use them to find two of the variables as linear expressions in the third.
3) Substitute these into the equation of any of the original spheres, giving a quadratic equation in one variable
4) Solve this to find the two roots.
5) Use these to determine the corresponding values of the other two variables, giving the coordinates of the two intersection points.
When I get to step 3, the equation is frightening to say the least. Can anyone save me the leg work and a few kilos of pencils by providing me with the general solution so I don't have to solve this damn thing?
Posts
Then
x^2+y^2+z^2=r_1^2
(x-x_2)^2+y^2+z^2=r_2^2
(x-x_3)^2+(y-y_3)^2+z^2=r_3^2
Solving this, putting the first equation into the second gives
x^2-(x-x_2)^2=r_1^2-r_2^2
or
x^2-x_2*x=r_1^2-r_2^2
You can then use the first and third equations to get
x^2-(x-x_3)^2+y^2-(y-y_3)^2=r_1^2-r_3^2
add in the previous solution for x, then solve for y.
Once you have x and y just use the first equation to get z. You'll probably then want to change back to the original coordinates, which is a simple matter.