5.0

5.0 | 1 rating Rate this file 33 downloads (last 30 days) File Size: 2.69 KB File ID: #24005

Assign connectivity ID to 2D triangular mesh

by David Gingras

 

05 May 2009 (Updated 19 Jun 2009)

Code covered by BSD License  

This function assigns an ID based on the connectivity for each cell of a 2D triangular mesh.

Download Now | Watch this File

File Information
Description

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)

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Toolbox Wavelets on Meshes

MATLAB release MATLAB 7.8 (R2009a)
Zip File Content  
Other Files connectivityTri.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
19 Jun 2009 Óscar J. Rubio Martín

Nice work, fast and accurate. It will let me save a lot of time.

Please login to add a comment or rating.
Updates
19 Jun 2009

The code can takes care of integer inputs.

Tag Activity for this File
Tag Applied By Date/Time
mesh David Gingras 06 May 2009 09:27:35
triangulation David Gingras 06 May 2009 09:27:35
connectivity David Gingras 06 May 2009 09:27:35
triangular mesh David Gingras 06 May 2009 09:27:35
unrestricted triangulation David Gingras 06 May 2009 09:27:35
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com