# Calculate volume from crossections

I have an irregularly shaped 3D object. I know the areas of the cross-sections in regular intervals. How can I calculate the volume of this object?

The object is given as a set of countours in 3D space. For each contour I can calculate the area using the surveyor's formula and the spacing between the contour lines is known.

-
Can you provided an explicit example the object? –  matt Jan 13 '12 at 14:16

Take two consecutive cross sectional areas $S_{i-1}$ and $S_i$ and connect them to create a finite volume. If their separation is $h=x_{i}-x_{i-1}$ then the finite volume is (using the trapezoidal rule)

$$\Delta V_i = h\;\frac{S_i+S_{i-1}}{2}$$

The total volume is then

$$V = \sum_{i=1+1}^N \Delta V_i = \frac{h}{2}\left(S_1+S_N\right)+h\sum_{i=2}^{N-1}S_i$$

This is very similar to numerical integration techniques for a function $y=f(x)$ approximated by a series of points $y_1$, $y_2$ $\ldots$ $y_N$, but instead of $y_i$ you have sectional areas $S_i$.

-
thanks.that's it! –  stef Jan 20 '12 at 14:29