Volume of Cavity between intersecting multiple Spheres

998 Views Asked by At

I want find an equation for this problem:

enter image description here

Problem Statement::

I have different size sphere, for example say $R_1$ for Red balls and $R_{2}$ for white Balls, overlapping each other.

1.) I want to find an equation for the surface area of the sphere system.

2.) If there is any way to find the volume of the cavity formed due to intersection of these spheres?

2

There are 2 best solutions below

2
On BEST ANSWER

To find the volume of intersection, the equations are given in mathworld If the radii are $r,R$ and the distance between the centers is $d$, the volume of intersection is $$\frac {\pi(R+r-d)^2(d^2+2dr-3r^2+2dR-3R^2+6rR)}{12d}$$ You can get the area of the two spherical caps and add them, then subtract from the total area of the two spheres.

0
On

Regarding question #2, finding the volume of the union of a set of spheres. This problem is surprisingly difficult.

I found a paper describing analytical solutions here: http://www.aei.tuke.sk/papers/2008/4/06_Dzurina.pdf

One could opt to do a Monte Carlo approach, which shouldn't be to difficult to implement.

Here is a very naive (python) implementation that assumes the sphere coordinates are all positive and the radii of all spheres is the same.

# works only when there are no spheres reaching outside the box. and it is very slow!
# evaluation on a grid might be a better solution. 
def mc_multi_volume(R, n=1e5, radius=1.0):
    boxrange = np.max(R)+radius
    print("boxrange:", boxrange)
    assert np.min(R)>=0.0

    in_overlap = 0
    # sphere with radius pointposition - sphereposition
    #in_circle = lambda p, r: sum((p - r) ** 2.) ** 0.5 < radius
    in_circle = lambda point, rsphere: np.linalg.norm(point - rsphere) < radius
    for _ in range(int(n)):
        position = np.random.random(3) * boxrange
        for r in R:
            inr = in_circle(position, r)
            if inr:
                in_overlap+=1
                break
    vol_total = boxrange**3
    return vol_total * in_overlap / n, in_overlap