[Math] The equation for the circle defined by two intersecting spheres in 3-space

computational geometrygeometry

We define two spheres, $S_1$ and $S_2$, of radius $r_1$ and $r_2$, centered at 3-space points $p_1$ and $p_2$, respectively. What equation gives the circle in 3-space at the intersection between the two spheres?

In other words the following circle:

enter image description here

My goal is to pick a point uniformly from the contour of this circle.

Best Answer

You can use the 2D case to compute this: take one circle of radius $r_1$ centered at the origin, and a second circle of radius $r_2$ centered at $(d, 0)$. Then you get two points of intersection (computed using Wolfram Alpha):

$$\left(\frac{d^2+r_1^2-r_2^2}{2d}, \pm\sqrt{r_1^2-\frac{(d^2+r_1^2-r_2^2)^2}{4d^2}}\right)$$

In your 3D setup, you set $d$ to the distance between the two centers of the spheres, then do the above computation. The first coordinate of the result represents the distance from the point $p_1$ in the direction of $p_2$. The second coordinate, choosen positively, represents the radius of the circle of intersection.

Related Question