| Hilariously fast volume computation with the divergence theorem (2018)(alyssarosenzweig.ca) | |
| 261 points by luu 13 days ago | 67 comments | |
tl;dr: Using the divergence theorem with F = ⟨x,0,0⟩, the volume of a closed triangulated mesh reduces to a simple sum over triangles, requiring only ~11 floating-point operations per triangle (no numerical integration needed). The resulting formula is V = (1/6) Σ (Δ₁×Δ₂)ₓ · (T₀ₓ + T₁ₓ + T₂ₓ), which is O(n) and fast enough to process ~30 million triangles per frame at 60fps on a Raspberry Pi. The author notes the algorithm likely isn't novel—a similar approach appears in prior work by Zheng and Chen. | |
HN Discussion:
| |