Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

General formula to calculate Polyhedron volume

Tags:

math

Given a list of vertices (v), and a list of edges connecting the vertices (e), and a list of surfaces that connect the edges (s), how to calculate the volume of the Polyhedron?

like image 525
Graviton Avatar asked Dec 03 '09 08:12

Graviton


People also ask

What is the formula for volume of a polyhedron?

5. b Apply the formulas 𝑉 = 𝑙 × 𝑤 × ℎ and 𝑉 = 𝑏 × ℎ for rectangular prisms to find volumes of right rectangular prisms with whole-number edge lengths in the context of solving real world and mathematical problems.

What is the formula for the polyhedron?

combinatorics. Euler was the first to investigate in 1752 the analogous question concerning polyhedra. He found that υ − e + f = 2 for every convex polyhedron, where υ, e, and f are the numbers of vertices, edges, and faces of the polyhedron.

What is formula to find faces of polyhedron?

We can also find the number of faces in a polyhedron using Euler's formula, F + V - E = 2, if we know the number of edges and vertices.


2 Answers

  1. Take the polygons and break them into triangles.
  2. Consider the tetrahedron formed by each triangle and an arbitrary point (the origin).
  3. Sum the signed volumes of these tetrahedra.

Notes:

  1. This will only work if you can keep a consistent CW or CCW order to the triangles as viewed from the outside.
  2. The signed volume of the tetrahedron is equal to 1/6 the determinant of the following matrix:

[ x1 x2 x3 x4 ]
[ y1 y2 y3 y4 ]
[ z1 z2 z3 z4 ]
[ 1 1 1 1 ]

where the columns are the homogeneous coordinates of the verticies (x,y,z,1).

It works even if the shape does not enclose the origin by subracting off that volume as well as adding it in, but that depends on having a consistent ordering.

If you can't preserve the order you can still find some way to break it into tetrahedrons and sum 1/6 absolute value of the determinant of each one.

Edit: I'd like to add that for triangle mesh where one vertex (say V4) of the tetrahedron is (0,0,0) the determinante of the 4x4 matrix can be simplified to the upper left 3x3 (expansion along the 0,0,0,1 column) and that can be simplified to Vol = V1xV2.V3 where "x" is cross product and "." is dot product. So compute that expression for every triangle, sum those volumes and divide by 6.

like image 191
phkahler Avatar answered Oct 19 '22 08:10

phkahler


Similarly with a polygon where we can split it into triangles and sum the areas,
you could split a polyhedron into pyramids and sum their volumes. But I'm not sure how hard is to implement an algorithm for that.

(I believe there is a mathematical way/formula, like using vectors and matrices.
I suggest to post your question also on http://mathoverflow.net)

like image 32
Nick Dandoulakis Avatar answered Oct 19 '22 09:10

Nick Dandoulakis