Let $\mathcal{B}_n$ be the $n$-ball of radius $r>0$ and centre $\mathbf{x}_0$, i.e., $\mathcal{B}_n=\{\mathbf{x}\in\mathbb{R}^n\colon \|\mathbf{x}-\mathbf{x}_0\| \leq r\}$.
The volume of $\mathcal{B}_n$ is given by $$ V_n(r)=\frac{\pi^\frac{n}{2}}{\Gamma(\frac{n}{2}+1)} r^n. $$
Moreover, let $\mathcal{H}:\mathbf{w}^\top\mathbf{x}+b=0$ be a hyperplane in $\mathbb{R}^n$. I would like to find the volume of the fraction of $\mathcal{B}_n$ "cut" by $\mathcal{H}$.
If $d$ is the distance between the centre of the ball, $\mathbf{x}_0$, and the hyperplane, $\mathcal{H}$, then the desired volume,$V_\mathcal{H}$, is
$$ \begin{cases} 0 & \text{if } d\ge r, \\[8pt] \dfrac{V_n(r)} 2 & \text{if } d=0, \\[8pt] 0 < V_{\mathcal H} \le V_n(r) & \text{if } d<r. \end{cases} $$
That is, if $d< r$, the desired volume is given as $V_\mathcal{H}=q(\mathbf{w},b,\mathbf{x}_0,r)V_n(r)$. I would like find this $q$ as a function of $\mathbf{w}$, $b$, $\mathbf{x}_0$, and $r$. I need to use this formula in a computationally expensive process, thus I need it to be "cheap". Any idea? Thank you very much.
Look at this picture, for the distance $d$, you can use the formula $d=|w\cdot x_0+b|/|w|$. Now $r_1=\sqrt{r^2-d^2}$. Then the volume (the red part) is just the integration of the volume of the interface $S_1$ with radius $r_1$ to the interface with radius $r$.