Intersection between two circles

Given O1(x1,y1,z1), O2(x2,y2,z2), the center of the circles and r1 and r2, their Radius

Given M(x,y,z) the intersection, then the rought way is ...

(1)     (x - x1)2 + (y - y1)2 = r12
(2)     (x - x2)2 + (y - y2)2 = r22
x2 - 2xx1 + x12 + y2 -2yy1 + y12 = r12
x2 - 2xx2 + x22 + y2 -2yy2 + y22 = r22
(1) - (2)      2x(x2 - x1) + 2y(y2 - y1) + x12 - x22  + y12 - y22 = r12 - r22
if x2 - x1 > Epsilon     x = ( r12 - r22 - ( 2y(y2 - y1) + x12 - x22  + y12 - y22) ) / 2(x2 - x1)     else y = ...

Then you replace x within (1) and you solve an equation of the second degree ...

 ...piece of cake but ...