Assign connectivity ID to 2D triangular mesh

版本 1.2.0.0 (2.7 KB) 作者: David Gingras
This function assigns an ID based on the connectivity for each cell of a 2D triangular mesh.
1.2K 次下载
更新时间 2009/6/19

查看许可证

This function takes an unrestricted triangulation (only the list of triangles, not the node coordinates) and assigns an ID to each group of triangles. If some cells are connected together, each cell of that group will have the same ID. It works like the connectivity-filter of the graphical library VTK.

function groupID=connectivityTri(TRI)
Input :
"TRI" is mx3 matrix which is the standard list of index of vertices
Output :
"groupID" is mx1 matrix which is the list of ID-group of each cell

Simple example :

X=[2 1 3 2 5 5 8 6 7 5 8 9 10 12 10 12 13 15 1 0 2 1];
Y=[2 4 4 6 6 8 8 4 2 2 4 6 8 7 5 5 3 2 7 8 8 9];
Z=zeros(size(X));
TRI=[1 2 3;2 4 3;4 3 5;5 6 7;10 8 9;8 9 11;12 13 14;15 16 17;17 16 18;4 6 5;20 19 21;22 21 20];
groupID=connectivityTri(TRI);

trisurf(TRI,X,Y,Z,groupID) (the screenshot of the soumission)

引用格式

David Gingras (2024). Assign connectivity ID to 2D triangular mesh (https://www.mathworks.com/matlabcentral/fileexchange/24005-assign-connectivity-id-to-2d-triangular-mesh), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2009a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Triangulation Representation 的更多信息
致谢

参考作品: Toolbox Wavelets on Meshes

启发作品: Remove Unconnected Triangle

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.2.0.0

The code can takes care of integer inputs.

1.0.0.0