Weighted volume of simplices making up a cube not equal to volume of cube?

46 Views Asked by At

I am trying to implement an algorithm to calculate the volume of a polyhedron by dividing it into simplices with their apex as some arbitrary vertex of the polyhedron and then summing up the volume of each simplex to arrive at the volume of the polyhedron but the maths is broken. I am calculating the volume of each simplex by implementing this here based on wikipedia.

please ignore the units of the volume from the images, The images are a screenshot from blender in order to visually confirm the code-logic I implemented

I started out with a cube of dimensions (4,4,4) with a volume of 64:

enter image description here

then dividing it into simplices:

enter image description here

four simplices(tetrahedrons) of dimensions (4,4,4):

enter image description here

enter image description here

The problem? calculating the volume of each of the four simplexes gives approx 10.67 from my code-implementation even when I calculate the volume from the 3D viewport in blender its basically the same i.e. the volume of each simplex doesn't sum up to be equal to the volume of the cube which is 64, I was expecting the volume of each simplex to be 16 so that 16 + 16 + 16 + 16 = 64 since all simplexes make up the cube? Please what's happening here why won't the sum of the volume of simplexes making up a cube not be equal to the volume of the cube?