5.0

5.0 | 1 rating Rate this file 18 Downloads (last 30 days) File Size: 2.2 KB File ID: #28327
image thumbnail

mesh2tri

by Kevin Moerman

 

29 Jul 2010 (Updated 05 Apr 2011)

Creates regular triangulation of meshgrid data

| Watch this File

File Information
Description

Converts a regular mesh defined by X,Y and Z into a regular triangulation. The output is patch data (triangles) in the faces ā€œFā€ and vertices ā€œVā€ format. The quadrilateral mesh faces are converted to triangles by splitting the faces into triangles according to the setting tri_type:
tri_type ='f' -> forward slash division of quadrilateral
tri_type ='b' -> back slash division of quadrilateral
tri_type ='x' -> Cross division of quadrilateral
The output coordinates "V" are in the form of V=[X(:),Y(:),Z(:)];
For forward and back slash subdivision no extra coordinates are introduced and therefore the original meshgrid formatted coordinates can still be used for plotting, see examples below. For cross division extra points are created at the centre of each quadrilateral face using the mean of the input coordinates. The extra coordinates are the last prod(size(X)-1) points (e.g. V((numel(X)+1):end,:) ) and can therefore be replaced by interpolated coordinates if desired, see example.

Acknowledgements
This submission has inspired the following:
stlwrite - Write binary or ascii STL file
MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
22 Feb 2011 James

Works perfectly!

Please login to add a comment or rating.
Updates
29 Jul 2010

Updated the vertex order for the triangles so that they are compatible with functions such as PDEGRAD

05 Apr 2011

Fix of face order

Tag Activity for this File
Tag Applied By Date/Time
triangulation Kevin Moerman 29 Jul 2010 10:12:58
meshgrid Kevin Moerman 29 Jul 2010 10:12:58
data exploration Kevin Moerman 29 Jul 2010 10:12:58
signal processing Kevin Moerman 29 Jul 2010 10:12:58
patch Kevin Moerman 29 Jul 2010 10:12:58

Contact us at files@mathworks.com