MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何在MATLAB中将多面体分解为四面体? (https://www.labfans.com/bbs/showthread.php?t=22954)

poster 2019-12-10 16:49

如何在MATLAB中将多面体分解为四面体?
 
我有一个多面体,其中包含顶点( v )和曲面( s )的列表。如何将这个多面体分解为一系列的四面体?

我特别想知道是否有内置的MATLAB命令。


回答:
我建议尝试使用内置函数[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/delaunay3.html"]DELAUNAY3[/URL] 。文档链接中给出的示例类似于[URL="https://stackoverflow.com/questions/1838537/break-polyhedron-into-tetrahedron/1838578#1838578"]Aaron的答案[/URL] ,因为它使用了顶点加上多面体的中心点来创建3-D Delaunay细分,但是[URL="https://stackoverflow.com/questions/1838537/break-polyhedron-into-tetrahedron/1841507#1841507"]shabbychef[/URL]指出,您仍然可以在不包括额外点的情况下创建细分。然后,您可以使用[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/tetramesh.html"]TETRAMESH[/URL]可视化生成的四面体元素。

您的代码可能看起来像这样(假设v是顶点坐标值的[B]N×3[/B]矩阵):

v = [v; mean(v)]; %# Add an additional center point, if desired (this code %# adds the mean of the vertices) Tes = delaunay3(v(:,1),v(:,2),v(:,3)); %# Create the triangulation tetramesh(Tes,v); %# Plot the tetrahedrons 由于您在评论中说您的多面体是凸面的,因此您不必担心将曲面指定为约束来进行三角剖分(与下面的评论相比, [URL="https://stackoverflow.com/questions/1838537/break-polyhedron-into-tetrahedron/1841507#1841507"]shabbychef[/URL]似乎提供了更为严格和简洁的证明) 。

[B]注意:[/B]根据文档,DELAUNAY3将在将来的版本中删除,而[URL="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/delaunaytri.html"]DelaunayTri[/URL]将有效地代替它(尽管目前看来,定义约束边仍仅限于二维三角剖分)。为了完整起见,以下是使用DelaunayTri并可视化凸包(即多面体表面)的方法:

DT = DelaunayTri(v); %# Using the same variable v as above tetramesh(DT); %# Plot the tetrahedrons figure; %# Make new figure window ch = convexHull(DT); %# Get the convex hull trisurf(ch,v(:,1),v(:,2),v(:,3),'FaceColor','cyan'); %# Plot the convex hull

[url=https://stackoverflow.com/questions/1838537]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 01:13

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.