Alternatives to Delaunay triangulation
22 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am in need of calculating the volume of a shape that is given as a cloud of points. I thought a first step would be to triangulate using delaunay but the results are not satisfactory. I have attached some images to show what is unsatisfactory. I zoomed in to look at a part of the cloud that is kind of shaped like the cone of an airplane. I have provided two angles so a sense can be gotten. The super elongated triangles do not seem like they will be useful in getting me surface area and volume.
Does anyone know of alternatives that would produce better results?
![dots_s.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246473/dots_s.png)
![dots2_s.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246474/dots2_s.png)
![triangs_s.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246475/triangs_s.png)
![triangs2_s.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246476/triangs2_s.png)
Thanks.
4 件のコメント
回答 (4 件)
Richard Brown
2019 年 11 月 7 日
編集済み: Richard Brown
2019 年 11 月 7 日
As David Wilson suggested, use alphashape:
U = csvread('Coords.txt');
shp = alphashape(U(:, 1), U(:, 2), U(:, 3));
plot(shp)
disp(shp.vol)
I get a volume of 3.59e-8. The picture is here:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247146/image.png)
Or, I just noticed that the commands are different in R2019a (I did the previous with R2018a by accident):
U = csvread('Coords.txt');
shp = alphaShape(U(:, 1), U(:, 2), U(:, 3));
plot(shp)
disp(shp.volume)
0 件のコメント
darova
2019 年 11 月 6 日
Volume can be found as summation volume of pyramids. Here is an idea:
![img1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247019/img1.png)
clc,clear
load Coords.txt
x = Coords(:,1);
y = Coords(:,2);
z = Coords(:,3);
% move to origin
x = x-mean(x);
y = y-mean(y);
z = z-mean(z);
% convert to spherical system
[t,p,r] = cart2sph(x,y,z);
tri = delaunay(t,p);
trisurf(tri,x,y,z)
% indices of triangle
i1 = tri(:,1);
i2 = tri(:,2);
i3 = tri(:,3);
% vectors of triangle base
v1 = [x(i1)-x(i2) y(i1)-y(i2) z(i1)-z(i2)];
v2 = [x(i1)-x(i3) y(i1)-y(i3) z(i1)-z(i3)];
A = 1/2*cross(v1,v2,2); % surface of a triangle
V = 1/3*dot(A,[x(i1) y(i1) z(i1)],2); % volume of a triangle
V = sum(abs(V));
3 件のコメント
darova
2019 年 11 月 7 日
Maybe it's because of wrong triangulation in this place:
![img1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247196/img1.png)
alphashape should be cool in this case then
darova
2019 年 11 月 7 日
編集済み: darova
2019 年 11 月 7 日
It's because of converting cartesian coordinates to spherical
[t,p,r] = cart2sph(x,y,z);
Geometrically -pi and +pi are the same, but delaunay interprets it as different numbers.
That is why there is a gap between -pi and +pi
Don't know how to resolve it
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247198/image.png)
参考
カテゴリ
Help Center および File Exchange で Bounding Regions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!