Calculate Volume of any Tetrahedron given 4 points

Say if you have 4 vertices a,b,c,d (3-D vectors).

enter image description here

Now, the problem comes down to writing code which solves cross product and dot product of vectors. If you are from python, you can use NumPy or else you can write code on your own.

The Wikipedia link should definitely help you. LINK


One way to compute this volume is this:

     1      [ax bx cx dx]
V = --- det [ay by cy dy]
     6      [az bz cz dz]
            [ 1  1  1  1]

This involves the evaluation of a 4×4 determinant. It generalizes nicely to simplices of higher dimensions, with the 6 being a special case of n!, the factorial of the dimension. The resulting volume will be oriented, i.e. may be negative depending on the order of points. If you don't want that, take the absolute value of the result.

If you have a math library at hand, the above formulation might be among the easiest to write down, and the software can take it from there. If not, you might simplify things first by subtracting the d coordinates from a through c. This will not change the volume but turn the rightmost column into (0, 0, 0, 1). As a result, you can compute the value of the matrix simply as the determinant of the upper left 3×3 submatrix. And using the equation

det(a, b, c) = a · (b × c)

you end up with the formula from Surya's answer.

In case you don't have coordinates for the points, but just distances between them, look at Tartaglia's Formula which is essentually a squared version of the above, although it's not as straight-forward as it would seem at first glance.

Tags:

Math

Geometry

3D