A mathematical derivation of an O(n) algorithm for computing the volume of a closed triangulated 3D mesh using the Divergence Theorem. By choosing a vector field whose divergence equals one and applying the theorem, the volume integral reduces to a surface integral over triangles. The resulting formula requires only a single loop over triangles with 7 additions and 3 multiplications per triangle, making it extremely efficient — capable of processing ~30 million triangles per frame at 60fps on a Raspberry Pi. The algorithm is later found to match one described in a 2001 Cornell paper by Cha, Zheng, and Chen.
Sort: