Code covered by the BSD License  

Highlights from
Remove Unconnected Triangle

Be the first to rate this file! 5 Downloads (last 30 days) File Size: 3.93 KB File ID: #25953
image thumbnail

Remove Unconnected Triangle

by David Gingras

 

25 Nov 2009

This function takes a triangular mesh and remove the unconnected cells.

| Watch this File

File Information
Description

This function takes a triangulation and remove the unconnected cells. The group of cells to keep can be specified with an index of triangle contained in this group. If no triangle index is specified, the filter will keep the group with the maximum number of cells.

Input :
"XYZ1" is nx3 matrix which are vertices coordinates
"TRI1" is mx3 matrix which are the standard indexes vertices "triID" is a triangle index of "TRI1" contained on the group of cells to keep. (optionnal)

Output :
"XYZ2" is px3 matrix which are vertices coordinates of output
"TRI2" is qx3 matrix which are the standard indexes of vertices

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];
[TRI2 XYZ2]=removeUnconnectedTri(TRI,[X' Y' Z']);

subplot(2,1,1)
trisurf(TRI,X,Y,Z), title('Before filter')
axis([min(X) max(X) min(Y) max(Y)]);
campos([7.5 6 10])
camtarget([7.5 6 0])
subplot(2,1,2)
trisurf(TRI2,XYZ2(:,1),XYZ2(:,2),XYZ2(:,3)), title('After filter')
axis([min(X) max(X) min(Y) max(Y)]);
campos([7.5 6 10])
camtarget([7.5 6 0])

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Toolbox Wavelets on Meshes, Assign connectivity ID to 2D triangular mesh, MESH2D - Automatic Mesh Generation

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
delaunay David Gingras 30 Nov 2009 11:24:10
triangulation David Gingras 30 Nov 2009 11:24:10
mesh David Gingras 30 Nov 2009 11:24:10
3d David Gingras 30 Nov 2009 11:24:10
unrestricted triangulation David Gingras 30 Nov 2009 11:24:10
triangular mesh David Gingras 30 Nov 2009 11:24:10
connectivity David Gingras 30 Nov 2009 11:24:10

Contact us at files@mathworks.com