I am trying to understand the derivation of the effective path length $d_{eff}$, which is the average length $L$ of the intersection between the rain cell of length $d_{0}$ and path $d$ shown below obtained from 'Prediction of Rain Attenuation in Terrestrial Links with the Full Rainfall Rate Distribution' by Silva Mello et. al.

The derivation is shown in the paper as $$d_{eff}=<L>=\frac{1}{d_{0}+d}\int_{-d_{0}}^{d}L(x)dx=r\cdot d=\frac{1}{1+\frac{d}{d_{0}}}\cdot d$$ The expression for distance factor $r$ is given as an estimate in 'RECOMMENDATION ITU-R P.530-11 Propagation data and prediction methods required for the design of terrestrial line-of-sight systems' on pg14 as well but no derivation was provided. Rearranging the final expression yields $d\cdot d_{0}$ as the result of the integral. But I don't understand how the integral is obtained and evaluated except that it looks similar to the formula to find the average value of a function.
Let's assume that the cell is moving from left to right, and we denote the left end of the rain cell as $x$. There is no intersection until $x=-d_0$. Then part of the rain cell overlaps with path $d$. This overlap increases until $x=0$. So in this part $$L_1(x)=x+d_0$$ Note that $x$ is negative, so $L_1$ will increase from $0$ to $d_0$. After that, until the right end gets to $d$, the rain cell is completely in the $[0,d]$ interval, so the intersection $L_2$ is equal to $d_0$. This means that $0\le x\le d-d_0$. When $x$ reaches $d-d_0$, the cell will start to move out of the range, so $L_3$ decreases from $d_0$ to $0$: $$L_3=d-x$$ Then the average is $$\langle L\rangle=\frac1{d+d_0}\int_{-d_0}^dL(x)dx\\ =\frac1{d+d_0}\left(\int_{-d_0}^0L_1(x)dx+\int_{0}^{d-d_0}L_2(x)dx+\int_{d-d_0}^{d}L_3(x)dx\right)\\ =\frac1{d+d_0}\left(\int_{-d_0}^0(x+d_0)dx+\int_{0}^{d-d_0}d_0dx+\int_{d-d_0}^{d}(d-x)dx\right)\\ =\frac1{d+d_0}\left(-\frac{d_0^2}2+d_0^2+dd_0-d_0^2+d^2-d^2+dd_0-\frac{d^2}2+\frac{(d-d_0)^2}2\right)\\=\frac{dd_0}{d+d_0}$$