Calculate efficiently volume intersection between sphere and fine hollow cylinder in Python

286 views Asked by At

I have an infinite hollow cylinder which intersects spheres. I would like to calculate the volume of the intersection of a sphere in each of the cases shown here (view from above):

enter image description here

The curvature is too large to assume that the intersection is between two planes. The three cases are the following:

  1. The sphere intersects the hollow cylinder from the inside.
  2. The sphere intersects the hollow cylinder from the inside.
  3. The sphere intersects the hollow cylinder from the both sides.

Is there any formula, library or method in Python I could find to do that efficiently? Indeed, this calculation should be done 1-10 millions of times.

Thank you!

0

There are 0 answers