# volume calculation from the DelaunayTri(x,y,z) function

13 visualizaciones (últimos 30 días)
Nikola Soukupová el 21 de Abr. de 2024
Comentada: Matt J el 22 de Abr. de 2024
I have the data in X,Y,Z format.
Then I entered a function into script:
rng default;
DT=DelaunayTri(x,y,z)
tetramesh(DT,'FaceAlpha',0.3)
The question is, how do I calculate the volume from this Delaunay Triangulation?
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

John D'Errico el 21 de Abr. de 2024
Editada: John D'Errico el 21 de Abr. de 2024
Its not THAT hard. You compute the volume of each simplex in the tessellation. Sum the absolute values up. (Since those simplexes may have random signs.)
As an example, I'll create a set of simplexes that lie in a rectangular box, of edge lengths [1 2 4]. So the volume would be just a little less than 8.
xyz = rand(10000,3).*[1 2 4];
Tess = delaunayTriangulation(xyz)
Tess =
delaunayTriangulation with properties: Points: [10000x3 double] ConnectivityList: [66176x4 double] Constraints: []
Now, to write a little code, probably something I should have posted online before. I've attached the DTvolume code to this response.
V = DTvolume(Tess)
V = 7.9009
The code I wrote does a little extra, to avoid numerical problems to whatever extent possible. And of course, it is fully vectorized, and even works for 2-d triangulations.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Más respuestas (1)

Walter Roberson el 21 de Abr. de 2024
DT = DelaunayTri(x,y,z);
[~, Volume] = convexhull(DT);
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Matt J el 22 de Abr. de 2024
That would work, but only for convex regions.

Iniciar sesión para comentar.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by