File Exchange

image thumbnail

Volume of a surface triangulation

version 1.0.0.0 (1.43 KB) by Krishnan Suresh
Given a surface triangulation, compute the volume enclosed using divergence theorem.

3 Downloads

Updated 17 Mar 2010

View License

Given a surface triangulation, compute the volume enclosed using divergence theorem.
Assumption:Triangle nodes are ordered correctly, i.e.,computed normal is outwards
Input: p: (3xnPoints), t: (3xnTriangles)
Output: total volume enclosed, and total area of surface

Comments and Ratings (11)

Hi,

Somebody can help me to running this function, I can´t, please.

:)

Uwe22

Hej Suresh,

Thank you for your inputs. I think it is equally suitable calculating volume of triangular patches of isosurfaces?

I look forward hearing from you.
Uwe

Cool application.

Nice application, but here's a cleaned up version (with V = p' and F = f'):
% 'z' coordinate of triangle centers.
FaceCentroidZ = ( V(F(:, 1), 3) + V(F(:, 2), 3) + V(F(:, 3), 3) ) /3;
% Face normal vectors, with length equal to triangle area.
FNdA = cross( (V(F(:, 2), :) - V(F(:, 1), :)), ...
(V(F(:, 3), :) - V(F(:, 2), :)) , 2 ) / 2;
% Volume from divergence theorem (using vector field along z).
V = FaceCentroidZ' * FNdA(:, 3);

JiaDa

Naoto

Lu

ahmed

Thanks a lot. I have difficult running the code. My input value representing the number of facets if presented in EXCEL file. How can I get the volume and surface area?

Ur response is apprecied in advance.

Matt Kindig

Thanks! This is exactly what I needed!

One thing: I wonder what happens if the volume is not closed? It might be nice if an open volume returned NaN or threw an error or something.

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux