Re: mesh_volume and tetra_volume [message #40479 is a reply to message #40367] |
Tue, 10 August 2004 09:19   |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
"Robert Schaefer" <robertschaefer@gmx.de> wrote in message
news:bffaee64.0408100002.6f8cf5ef@posting.google.com...
> "Karl Schultz" <kschultz_no_spam@rsinc.com> wrote in message
news:<10hf9gscqmtdj41@corp.supernews.com>...
>> "Robert Schaefer" <robertschaefer@gmx.de> wrote in message
>> news:bffaee64.0408090124.5906ed23@posting.google.com...
>>> Hello, I want to get the volume out of a 3d object.
>>> First i tried with mesh_volume, but the returned values weren't
>>> similar to my calculated. I checked with mesh_issolid: return value:1,
>>> so it ios solid and should return the volume.
>>> When i check with tetra_volume the volume is similar to my calculated
>>> volume.
>>>
>>> Now my question: what is the difference between mesh_volume and
>>> tetra_volume?
>>
>> MESH_VOLUME works by summing:
>>
>> ( a dot ( b cross c ) ) / 6
>> for every triangle in the mesh where a, b, and c are the verts of each
>> triangle in the mesh. This effectively calculates the signed volume of
a
>> tetrahedron formed by the origin and the 3 triangle verts for each
triangle
>> and then adds them up.
>>
>> TETRA_VOLUME just adds up the volume of all the tets in the mesh using
the
>> same idea as above.
>>
>> How big a difference are you seeing? Is there anything strange about
your
>> mesh, like being self-intersecting? How did you generate both the
polygonal
>> mesh and the tetrahedral mesh?
>>
>> Karl
>
> My testobjekt is generated by dilatation of one point. I can not see
> any strange about the mesh.
> With computemesh i generate the triangles, like D.fanning in his
> example (http://www.dfanning.com/graphics_tips/mesh.html). I signed
> the calculated values between tetra_volume and mesh_volume are very
> differnt:
>
> accord sphere formula : 4./3.*!pi*16.^3 = 17157.3
> total (vol) : 17611.0
> volume with tetra_volume: 16308.0
> mesh_volume : 11988.0
>
> Any idea?
>
> Robert
Not really. I think I'd have to see your code to understand better what is
going on.
Here is an example that might help.
It makes a volume where each sample value is the distance from the volume
center.
I use that to create an isosurface where the isovalue is some arbitrary
radius value.
I print out the ideal volume of the sphere and then the volume of the
isosurface according to MESH_VOLUME.
I don't know how you are getting your tetrahedral mesh, but I use
INTERVAL_VOLUME and then use TETRA_VOLUME to compute the volume that way. I
also extract the surface of the tet mesh and compute the volume enclosed by
that with MESH_VOLUME.
The results are printed below. Note that all of the values except the ideal
volume are very close. The reason why the ideal volume is a bit different
is because the volume is performing discrete sampling, and so there is
sampling error . The volumes of the various meshes will approach the ideal
volume as you increase sampling.
I hope this helps you solve your problem.
Karl
pro t
n = 40
mid = n / 2
radius = n / 3.5
vol = BYTARR(n,n,n)
for i=0, n-1 do begin
for j=0, n-1 do begin
for k=0, n-1 do begin
vol[i,j,k] = SQRT( (i-mid)^2 + (j-mid)^2 + (k-mid)^2 ) + 0.5
endfor
endfor
endfor
ISOSURFACE, vol, radius, v, c
print, "Ideal volume", 4./3.*!pi*radius^3
print, MESH_ISSOLID(c)
print, "Isosurface volume", MESH_VOLUME(v, c)
INTERVAL_VOLUME, vol, 0, radius, tet_verts, tet_conn
print, "Tetrahedral volume", TETRA_VOLUME(tet_verts, tet_conn)
surf_conn = TETRA_SURFACE(tet_verts, tet_conn)
print, MESH_ISSOLID(surf_conn)
print, "Tetrahedral volume by surface", MESH_VOLUME(tet_verts,
surf_conn)
end
IDL> t
Ideal volume 6252.66
1
Isosurface volume 6321.85
Tetrahedral volume 6321.87
1
Tetrahedral volume by surface 6321.85
|
|
|