Hilariously Fast Volume Computation with the Divergence Theorem (2018)
The article details an efficient algorithm, attributed to the divergence theorem, for computing the volume of a simple, closed, triangulated 3D mesh. By choosing a vector field F(x, y, z) = x, 0, 0, the divergence of F equals 1, enabling the application of the divergence theorem. This theorem converts the volume integral into a surface integral over the 3D mesh's boundary.
The authors then represent the mesh as a collection of triangles T_i, using vertices Ti0, Ti1, and Ti2 for each triangle. By parametrizing each triangle using u and v coordinates, they transform the surface integral into a double integral. Simplifying this double integral, they extract the x-component of the cross product of the triangle edges, which remains constant throughout the triangle.
The final volume formula is derived as: V = (1/6) * ∑(Δi1 × Δi2)_x * (Ti0x + Ti1x + Ti2x), where the sum is over all triangles in the mesh. The algorithm is O(n) in complexity, with a single loop over the mesh's triangles and minimal per-triangle computations. This makes it highly efficient for real-time applications, such as calculating volumes every frame in a high-performance system.
The authors also note that similar algorithms may exist, citing a paper by Cha Zheng and Tsuhan Chen, which describes an equivalent approach using a different derivation.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.
- Hilariously Fast Volume Computation with the Divergence Theorem alyssarosenzweig.ca