I’d say you want to divide the volume into tetrahedra, then sum the volumes of the tets.
Either that or take several slices through the volume, calculate their area and interpolate volumes between slices. It’s a linear difference between slices if the interpolation is linear as it is with a tri mesh so just average the areas of two slices and multiply by the separation between the sices. You need to make sure your have a slice at each vertex position along your slice axis for total accuracy (this guarantees all surface reconstruction interpolations between your chosen slices are linear).
Yeah, seems like if you computed the isosurface from an algorithm like marching cubes or marching tetrahedra, then you’d just want to keep a running total of the volume as you traverse the grid.
Depending on mesh density, the suggestion (by JustHanging) of doing a Riemann sum could also be reasonable.
Originally posted by cpb:
[b]what do you mean by using the rieman sum… going back to the actual image???
[/b]
Essentially, I mean, compute the sum:
sum = 0
for all i, j, and k
if scalar[i][j][j] > threshold
sum += cell_size
This is a reasonable zeroth order approxmation, and zeroth order may be sufficient if you have a high grid density and/or you only need a coarse approximation.
Since you all wrote the reply on volume calculation from an object file, I was thinking how I could approach this problem… and I didn’t come to any conclusion. Therefore I was thinking if you might help me further… I will attach you 1 Object from the generated isosurface as an object file (or I just paste it).
Could you help me further; I am kind of desperate because this is an important issue for me and I have to solve it!
Thx in advance
c.
Here the object:
V are the actual vertices
F are the faces (ex. f 1 2 3 means vertex 1,2,3 form a triangle)
v 57.600002 19.980001 25.200001
v 57.600002 19.800001 26.775001
v 57.780002 19.800001 25.200001
v 57.600002 19.800001 26.775001
v 57.600002 19.980001 25.200001
v 57.420002 19.800001 25.200001
v 57.600002 19.800001 26.775001
v 57.600002 19.440001 26.775001
v 57.960002 19.440001 26.775001
v 57.600002 19.800001 26.775001
v 57.960002 19.440001 26.775001
v 57.960002 19.620001 25.200001
v 57.780002 19.800001 25.200001
v 57.600002 19.800001 26.775001
v 57.960002 19.620001 25.200001
v 57.600002 19.800001 26.775001
v 57.420002 19.800001 25.200001
v 57.600002 19.440001 26.775001
v 57.780002 19.800001 25.200001
v 57.600002 19.800001 23.625001
v 57.600002 19.980001 25.200001
v 57.600002 19.980001 25.200001
v 57.600002 19.800001 23.625001
v 57.420002 19.800001 25.200001
v 57.960002 19.440001 23.625001
v 57.600002 19.800001 23.625001
v 57.780002 19.800001 25.200001
v 57.960002 19.620001 25.200001
v 57.960002 19.440001 23.625001
v 57.780002 19.800001 25.200001
v 57.600002 19.440001 26.775001
v 57.420002 19.800001 25.200001
v 57.420002 19.440001 25.200001
v 57.420002 19.800001 25.200001
v 57.600002 19.800001 23.625001
v 57.420002 19.440001 25.200001
v 57.960002 19.620001 25.200001
v 57.960002 19.440001 26.775001
v 58.140002 19.440001 25.200001
v 58.140002 19.440001 25.200001
v 57.960002 19.440001 26.775001
v 57.960002 19.260001 25.200001
v 57.600002 19.260001 25.200001
v 57.960002 19.440001 26.775001
v 57.600002 19.440001 26.775001
v 57.960002 19.260001 25.200001
v 57.960002 19.440001 26.775001
v 57.600002 19.260001 25.200001
v 57.600002 19.440001 26.775001
v 57.420002 19.440001 25.200001
v 57.600002 19.260001 25.200001
v 57.960002 19.440001 23.625001
v 57.960002 19.620001 25.200001
v 58.140002 19.440001 25.200001
v 57.960002 19.440001 23.625001
v 57.600002 19.440001 23.625001
v 57.600002 19.800001 23.625001
v 57.600002 19.800001 23.625001
v 57.600002 19.440001 23.625001
v 57.420002 19.440001 25.200001
v 57.960002 19.440001 23.625001
v 58.140002 19.440001 25.200001
v 57.960002 19.260001 25.200001
v 57.960002 19.440001 23.625001
v 57.960002 19.260001 25.200001
v 57.600002 19.440001 23.625001
v 57.600002 19.260001 25.200001
v 57.420002 19.440001 25.200001
v 57.600002 19.440001 23.625001
v 57.600002 19.440001 23.625001
v 57.960002 19.260001 25.200001
v 57.600002 19.260001 25.200001
f 1 2 3
f 4 5 6
f 7 8 9
f 10 11 12
f 13 14 15
f 16 17 18
f 19 20 21
f 22 23 24
f 25 26 27
f 28 29 30
f 31 32 33
f 34 35 36
f 37 38 39
f 40 41 42
f 43 44 45
f 46 47 48
f 49 50 51
f 52 53 54
f 55 56 57
f 58 59 60
f 61 62 63
f 64 65 66
f 67 68 69
f 70 71 72
We experimented and got quite perfect results with taking any pivot point, and creating tetrahedrons from this point to every triangle present. If the face is front-facing to the pivot we subtract the volume, if if it’s back-facing we add the volume. Shouldn’t be too hard to implement that.