# Finding the volume of two intersecting cylinders at arbitrary angles

Suppose we know the length, radius, position and orientation of two cylinders. Is there a general formula to calculate the volume of space shared by the intersection of the cylinders?

• Wow. This seems very difficult. A closed form solution is almost unrealistic. I recommend you simplify by starting with some assumptions. It would be helpful to assume the lines through the centers of the cylinders intersect at an angle $\alpha$. Then, assume that the cylinders are very long, so they don't intersect at their bases. Even with all of these simplifications, the problem is not easy. – Jared Dec 24 '13 at 6:54
• @Jared I feared someone would say that. Although I thought there might be at least some approximate solution. For example in Computer Aided Design programs I have seen people cutout shapes using the intersection of another shape to define the volume to be removed. If we have the original cylinders volume then cut a portion out using the intersection with a second cylinder we could get an approximate volume somehow. – Stephen Tierney Dec 24 '13 at 10:51
• You can probably write a triple integral for the volume, and compute it numerically, but this integral will be rather nasty: you have to plug in all you know, like directions of the cylinders and their radii. There will be a geometrical condition for a point $M$ to be inside the intersection, then you integrate $\mathrm dV$ on the domain thus defined. Good luck :-) I bet CAD programs make first an approximation of figures as polyhedra, then the volume is easier (the intersection is still a polyhedron). – Jean-Claude Arbaut Dec 24 '13 at 11:18
• This comment is to link this post as one of the (abstract) duplicates to the current choice of mother/target post. Even though this post is older, the target post has an existing duplicate-link. – Lee David Chung Lin Jan 22 at 11:44

This answer is about the particular case in which the axes of the two cylinders meet at a point, both have the same radius, and both cylinders extend to infinity (this last assumption is to avoid complexities regarding truncated cylinder intersections). We can take the radius as $1$ and then re-scale to radius $a$ by inserting a factor of $a^3$.

Let the $x$ axis be the axis of cylinder $A$, and for some $m>0$ let the line $y=mx$ be the axis of cylinder $B$. The (signed) distance between a point $(x,y)$ and the line $y=mx$ is $\frac{y-mx}{r}$ where $r=\sqrt{1+m^2}$ Then the restriction that $(x, y)$ lies under cylinder $B$ is that $-1 \le \frac{y-mx}{r} \le 1,$ while $(x, y)$ lies under cylinder $A$ provided $-1 \le y \le 1$.

Note we're considering the part of the intersection lying above the $xy$ plane; then the height over cylinder $A$ is $\sqrt{1-y^2}$ and the height over cylinder $B$ is $\sqrt{1-\left[\frac{y-mx}{r}\right]^2}.$ These heights are the same over a point $(x, y)$ (i.e. the two cylinders intersect over that point) iff $y^2-\left[\frac{y-mx}{r}\right]^2=0$, which factors into two lines $y=-\frac{mx}{r-1}$ and $y=\frac{mx}{r+1}$. The product of these slopes is $-1$ so the lines are orthogonal.

If $L_B$ is the axis $y=mx$ of cylinder $B$, and for convenience $L_A$ is the $x$-axis, the axis of cylinder $A$, we'll use the notations $L_B^+$ and $L_B^-$ for the lines parallel to $L_B$ and one unit away from it, above and below respectively. Similar notation for $L_A^+$ and $L_A^-.$ The first two of these are the upper and lower boundaries of the projection of cylinder $B$ onto the $xy$ plane, and similarly the second two are the upper and lower boundaries of the projection of cylinder $A.$ Equations for these are

$$L_B^+ : y=mx+r \\ L_B^- : y=mx-r \\ L_A+ : y=1 \\ L_A^- : y=-1$$ The intersections of these lines consist of four points $P, Q, R, S$ which form an equilateral parallelogram. We have $$P=\left(\frac{1-r}{m}, 1\right), \ Q=\left(\frac{1+r}{m}, 1\right), \ R=\left(\frac{-1+r}{m}, -1\right), \ S=\left(\frac{-1-r}{m}, -1\right)$$ Now if we denote the origin $(0, 0)$ by $O$, we can see there are four triangular regions each having $O$ as one vertex, and two adjacent vertices of the parallelogram as the other two vertices. Above each of these triangles we know which of the two cylinders lies below the other.

It turns out that the contributions to the volume from each of these triangles (i.e. the volume of the intersection of the cylinders lying above that triangle) is the same.

This can be seen by symmetry, since e.g. the part lying above $\triangle OQR$ could be set up with the line $y=mx$ playing the role of the $x$ axis, and taking an orthogonal axis pointing downwards from $O$, so that the "old" $x$ axis is now at the same slope $m$ in this rotated and flipped coordinate system.

It remains now to find the volume over $\triangle OPQ$, which may be described as $0 \le y \le 1$ and $\frac{y(1-r)}{m} \le x \le \frac{y(1+r)}{m}$. Now over this triangle it is cylinder $A$ whose height is lower. This means we're integrating $\sqrt{1-y^2}$ over $\triangle OPQ$. At any specific $y$ the height being constant, we only need multiply by the length of the horizontal section of $\triangle OPQ$ at distance $y$ from the $x$ axis, and integrate. Thus we get $$\int_0^1 \frac{(2r)}{m y \sqrt{1-y^2}} dy=(2r/m)\cdot(1/3).$$ Recalling that we have found only the volume above the $xy$ plane, and that there are four triangles each giving the above contribution to the part above the $xy$ plane, we arrive at $$\frac{16}{3}\cdot \frac{\sqrt{1+m^2}}{m}$$ for the volume of the intersection of the cylinders.

Note as $m \to \infty$ (so that the angle of intersection goes to 90 degrees) this formula approaches the correct $16/3$ (the usual formula $(16/3)a^3$ when $a=1.$) And also as expected it becomes infinite as $m \to 0^+.$

Added note: If $\theta$ is the angle between the two axes, then $m=\tan \theta.$ I used the letter $r$ during the derivation to mean $\sqrt{1+m^2}$ only for convenience. If we reset $r$ to now mean the common radius of the cylinders, and apply a trig identity, we can reexpress the volume in the form $$V=\frac{16}{3 \sin \theta} \cdot r^3,$$ which is only off by the $sin \theta$ divisor from the result $(16/3)r^3$ when the cylinders are orthogonal.