# [SciPy-user] Approximate volume of an irregular triangular mesh.

Nathan Bell wnbell@gmail....
Tue Feb 17 12:59:41 CST 2009

```On Tue, Feb 17, 2009 at 10:48 AM, Dharhas Pothina
<Dharhas.Pothina@twdb.state.tx.us> wrote:
>
> I want to calculate the approximate volume of this mesh. The brute force way
> is to cycle through each triangular element and calculate the area of each
> triangle and multiply it by the average depth of the three nodes of the element.
> I was wondering if there was a simpler way maybe by just using the surface
> defined by the nodes and ignoring the connectivity.
>

Look at "Subject 2.01: How do I find the area of a polygon?" here:
http://www.faqs.org/faqs/graphics/algorithms-faq/

This requires that the edges are consistently oriented (e.g. counter
clockwise around the perimeter)

Interestingly, you can apply a similar trick in higher dimensions, and
even compute things like the center of mass and inertia tensor.
http://www.geometrictools.com/Documentation/PolyhedralMassProperties.pdf

Ultimately, it boils down to the fact that you can replace volume
integrals with a surface integrals using the divergence theorem.

--
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/
```