{
  "id": 3934230,
  "title": "Hilariously Fast Volume Computation with the Divergence Theorem",
  "url": "https://urgent.news/2026/08/28/hilariously-fast-volume-computation-with-the-divergence-theorem",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-28T09:00:46.000Z",
  "source": {
    "name": "Hacker News",
    "slug": "hacker-news",
    "url": "https://alyssarosenzweig.ca/blog/hilariously-fast-volume-computation-with-the-divergence-theorem.html"
  },
  "original_language": "en",
  "account": "The article introduces an efficient algorithm for computing the volume of a simple, closed, triangulated 3D mesh. This is made possible by the Divergence Theorem, which states that the volume can be calculated as the surface integral of a vector field whose divergence is equal to one. The authors define this vector field as F(x, y, z) = (x, 0, 0) and show that its divergence is indeed equal to one.\n\nThe volume is then expressed as the sum of integrals over each triangle in the mesh. Each triangle Ti is parametrized by three vertices Ti0, Ti1, and Ti2, and a pair of vectors Δ1 and Δ2 derived from these vertices. The surface integral over each triangle is rewritten in terms of this parametrization, leading to an expression involving the cross product of Δ1 and Δ2.\n\nThe cross product is constant throughout each triangle and depends only on the X component of the vertices, due to the zero components of the vector field F. The surface integral over each triangle is thus simplified to a sum of terms involving these X components and the areas of the sub-triangles formed by the vertices.\n\nFinally, the authors derive a compact formula for the volume, which involves a single loop over all triangles in the mesh. Each iteration requires seven additions and three multiplications, leading to a total of 8n - 1 additions and 3n + 1 multiplications for a mesh with n triangles. This results in only 11n floating point operations, making it a highly efficient algorithm for volume computation.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}