Volume between two cones with intersecting axes

Solution 1:

Without loss of generality center the first cone with aperture angle $\alpha$ at the origin and aim it along the $z$ axis. Then consider the vertex of the second cone at $(x_0,y_0,z_0)$ with aperture angle $\beta$ aligned in the $\vec{n}$ direction. Then the equation for the cone is given by

$$\vec{n}\cdot(x-x_0,y-y_0,z-z_0) = |\vec{n}|\sqrt{(x-x_0)^2+(y-y_0)^2+(z-z_0)^2}\cos\beta$$

Squaring and converting to spherical coordinates gives us

$$r^2\left(\vec{n}\cdot(\sin\theta\cos\phi-x_0,\sin\theta\sin\phi-y_0,\cos\theta-z_0)\right)^2$$

$$ = \vec{n}^2\cos^2\beta\left(r^2-2r(x_0\sin\theta\cos\phi+y_0\sin\theta\sin\phi+z_0\cos\theta)+x_0^2+y_0^2+z_0^2\right)$$

$$$$

$$ \implies r = \frac{x_0\sin\theta\cos\phi+y_0\sin\theta\sin\phi+z_0\cos\theta}{1-\left(\frac{\vec{n}\cdot(\sin\theta\cos\phi-x_0,\sin\theta\sin\phi-y_0,\cos\theta-z_0)}{|\vec{n}|\cos\beta}\right)^2}$$ $$\pm \sqrt{\left(\frac{x_0\sin\theta\cos\phi+y_0\sin\theta\sin\phi+z_0\cos\theta}{1-\left(\frac{\vec{n}\cdot(\sin\theta\cos\phi-x_0,\sin\theta\sin\phi-y_0,\cos\theta-z_0)}{|\vec{n}|\cos\beta}\right)^2}\right)^2-\left(\frac{x_0^2+y_0^2+z_0^2}{1-\left(\frac{\vec{n}\cdot(\sin\theta\cos\phi-x_0,\sin\theta\sin\phi-y_0,\cos\theta-z_0)}{|\vec{n}|\cos\beta}\right)^2}\right)}$$

$$\equiv f(\theta,\phi)\pm h(\theta,\phi)$$

Then the volume is "simply"

$$V = \int_0^{2\pi}\int_0^\alpha\int_{f-h}^{f+h}r^2\sin\theta\:dr\:d\theta \:d\phi$$