Volume Enclosed by a Triangulated Surface
Gets the Volume enclosed by the surface defined by p,t,tnorm. The surface must be closed and manifold, there is no check for this.
The algorithm compute the volume of 3 tetraedrons for each triangle. The normals orientation define the sign of volume, it is just a numerical integration.
Input:
- p: nx3 array containing 3D set of points
- t: triangles ids referring to p array. First point flagged as one.
- tnorm: outwards triangles normals orientation
Output:
- V: the Volume enclosed by the surface
For bugs,infos: giaccariluigi@msn.com
Download Now
Popularity: 4% [?]
Related Posts
Comments
4 Comments on Volume Enclosed by a Triangulated Surface
-
Christopher Clark on
Mon, 16th Aug 2010 16:10
-
Luigi Giaccari on
Tue, 17th Aug 2010 18:35
-
Luigi Giaccari on
Wed, 18th Aug 2010 13:34
Hi,
Thanks for your code this looks like exactly what i need.
I do have one problem though. i have both the p and t matrices that i can use to draw my surface using trisurf but i do not have a tnorm matrix. Can you tell me any way to calculate this matrix is it is possible?
thanks
[Reply]
You can compute the normals performing cross product on triangles edges.
Be carefull that normals must points all outwards, otherwise there is no volume defined.
Setting the normal orientation can be painfull, I suggest you to give a look at computational toolbox from the latest Matlab realeases. They have specific functions for this.
[Reply]
That’s a bug,
I forgot to change that after a function renaming.
Just change “CCTetra” with “TetraVolume”. That’s the correct function name.
It’s weird that nobody noticed it before!
Since I don’t have time to test the scripti please give me feedback in case you have problems!
The new corrected version is on the way to Matlab file exchange.
[Reply]
Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
Include MATLAB code in your comment by doing the following:
<pre lang="MATLAB">
%insert code here
</pre>



















































Christopher Clark Reply:
August 18th, 2010 at 11:18
Thank you.
Do you have any idea of which methods could do this?
When i use this function on some meshes it causes an error
??? Undefined function or method ‘CCTetra’ for input arguments of type ‘double’.
Line 67
i cannot find a method CCTetra
on some meshes it never enters this while loop so never crashes.
Can you tell me how to fix this?
Thank you
[Reply]