Calculating volume of a tetramesh

조회 수: 10 (최근 30일)
Ellen
Ellen 2020년 5월 25일
댓글: M.S. Khan 2020년 8월 30일
Hi!
I am trying to calculate the volume of a complex 3D shape made with the function tetramesh. Does someone know if there is a function for that?
Thank you!

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 25일

추가 답변 (1개)

Ellen
Ellen 2020년 5월 26일
Thank you for your answer!
I tried the Mesh2Tetra on a 1x1x1 cube as follows:
A = importdata('cube.txt');
x = A(:,1);
y = A(:,2);
z = A(:,3);
k=boundary([x,y,z]);
Tc = Mesh2Tetra([x y z],k);
which gives me the correct results:
Swap Face orientation
Volume inside boundary mesh is : 1
.
Start Delaunay to Tetrahedrons
-Number of objects : 1
-Starting Volume : 1
-Processing object : 1
-Number of Faces : 12
-Object Volume : 1
However, it also gives me a lot of errors which makes me wonder what I did wrong:
Error using builtin
QH6154 qhull precision error: initial facet 1 is coplanar with the interior point
ERRONEOUS FACET:
While executing: | qhull d Qt Qbb Qc
Options selected for Qhull 2010.1 2010/01/14:
run-id 1670392318 delaunay Qtriangulate Qbbound-last Qcoplanar-keep
_pre-merge _zero-centrum Qinterior-keep Pgood _max-width 1
Error-roundoff 2e-15 _one-merge 1.8e-14 Visible-distance 1.2e-14
U-coplanar-distance 1.2e-14 Width-outside 2.4e-14 _wide-facet 7.3e-14
The input to qhull appears to be less than 4 dimensional, or a
computation has overflowed.
Qhull could not construct a clearly convex simplex from points:
The center point is coplanar with a facet, or a vertex is coplanar
with a neighboring facet. The maximum round off error for
computing distances is 2e-15. The center point, facets and distances
to the center point are as follows:
facet p4 p1 p2 p0 distance= 0
facet p6 p1 p2 p0 distance= 0
facet p6 p4 p2 p0 distance= -0.14
facet p6 p4 p1 p0 distance= -1.1e-16
facet p6 p4 p1 p2 distance= -5.6e-17
These points either have a maximum or minimum x-coordinate, or
they maximize the determinant for k coordinates. Trial points
are first selected from points that maximize a coordinate.
The min and max coordinates for each dimension are:
0: 0 1 difference= 1
1: 0 1 difference= 1
2: 0 1 difference= 1
3: 0 1 difference= 1
If the input should be full dimensional, you have several options that
may determine an initial simplex:
- use 'QJ' to joggle the input and make it full dimensional
- use 'QbB' to scale the points to the unit cube
- use 'QR0' to randomly rotate the input for different maximum points
- use 'Qs' to search all points for the initial simplex
- use 'En' to specify a maximum roundoff error less than 2e-15.
- trace execution with 'T3' to see the determinant for each point.
If the input is lower dimensional:
- use 'QJ' to joggle the input and make it full dimensional
- use 'Qbk:0Bk:0' to delete coordinate k from the input. You should
pick the coordinate with the least range. The hull will have the
correct topology.
- determine the flat containing the points, rotate the points
into a coordinate plane, and delete the other coordinates.
- add one or more points to make the input full dimensional.
This is a Delaunay triangulation and the input is co-circular or co-spherical:
- use 'Qz' to add a point "at infinity" (i.e., above the paraboloid)
- or use 'QJ' to joggle the input and avoid co-circular data
Error in qhullmx
Error in delaunayn (line 101)
t = qhullmx(x', 'd ', opt);
Error in DelaunayInside3D (line 51)
T2 = delaunayn(V2);
Error in Mesh2Tetra (line 119)
[T F]=DelaunayInside3D(V,F,struct('verbose',options.verbose));
Error in forumquestioncode (line 21)
Tc = Mesh2Tetra([x y z],k);
I also tried the triangulationVolume as follows:
A = importdata('cube.txt');
x = A(:,1);
y = A(:,2);
z = A(:,3);
tri = delaunay([x y z]);
[volume,area] = triangulationVolume(tri,x,y,z);
However this gives me an incorrect result: a volume of 0.3333 which should be 1.
Can someone help me with this?
  댓글 수: 1
M.S. Khan
M.S. Khan 2020년 8월 30일
attach file of your coordinates please. So we can try to calculate.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Delaunay Triangulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by