<p>The triangle form of the <a href="https://en.wikipedia.org/wiki/Shoelace_formula" rel="nofollow noreferrer">Shoelace Formula</a> can be extended to 3D by using tetrahedrons instead of triangles.</p>
<ol>
<li>Pick a point, Any point can be used, even one of the original vertices of the mesh (personally I tend to use the x,y,z min of the mesh AABB).</li>
<li>For each triangle, construct a tetrahedron using the triangle vertices and this chosen point, and calculate the volume of this tetrahedron.</li>
<li>Assuming mesh triangles are CCW wound, sum all the volumes of tets with CCW winding, and subtract the volumes of the tetrahedrons with CW winding (if your mesh uses CW winding, then add all the CW tet volumes together and subtract volumes of tets which are CCW).</li>
</ol>
<p>Calculating the determinent of the tetrahedron is useful since it can be used to deduce both the volume, and winding of a tetrahedron.</p>

CC BY-SA 4.0
2022-09-07T02:25:36.053Z
https://stackoverflow.com/a/53472452/3187183
In case someone want to see a source code.
kitta
CC BY-SA 4.0
2022-09-05T08:14:22.020Z
2022-09-06T09:39:48.547Z
2022-09-06T09:39:48.547Z
lfgtm
<p>Given 3D mesh with a closed surface. (solid object without hole).</p>
<p>I'm looking for an algorithm to calculate its volume.</p>
<p>There are several ideas, Such as</p>
<ul>
<li>Voxelized and count voxels</li>
<li>Point cloud and Monte-carlo integration to find the point inside the mesh.</li>
</ul>
<p>I didn't know yet if these are possible but it would give me a pretty rough estimation.<br />
So I'd like to have an accurate analysis approach.</p>
<p>Any suggestion?</p>

<algorithm><mesh><volumetric>
How to calculate volume of any given 3D mesh
kitta
# How to calculate volume of any given 3D mesh

(Asked by: username_0 on 2022-09-05)

Given 3D mesh with a closed surface. (solid object without hole).

I'm looking for an algorithm to calculate its volume.

There are several ideas, Such as

* Voxelized and count voxels
* Point cloud and Monte-carlo integration to find the point inside the mesh.

I didn't know yet if these are possible but it would give me a pretty rough estimation.  
So I'd like to have an accurate analysis approach.

Any suggestion?

**Tags:** algorithm, mesh, volumetric


---

## 1 answers

### Answer by username_1 on 2022-09-05. Score: 6 | Accepted answer

The triangle form of the [Shoelace Formula](https://en.wikipedia.org/wiki/Shoelace_formula) can be extended to 3D by using tetrahedrons instead of triangles.

1. Pick a point, Any point can be used, even one of the original vertices of the mesh (personally I tend to use the x,y,z min of the mesh AABB).
2. For each triangle, construct a tetrahedron using the triangle vertices and this chosen point, and calculate the volume of this tetrahedron.
3. Assuming mesh triangles are CCW wound, sum all the volumes of tets with CCW winding, and subtract the volumes of the tetrahedrons with CW winding (if your mesh uses CW winding, then add all the CW tet volumes together and subtract volumes of tets which are CCW).

Calculating the determinent of the tetrahedron is useful since it can be used to deduce both the volume, and winding of a tetrahedron.

> **Comments:**
> **username_0**: https://stackoverflow.com/a/53472452/3187183 In case someone want to see a source code.  

---

