gridtrimesh : How to retrieve triangle facets and vertices from a mesh grid

Hi All,
I used gridtrimesh to generate uniform 3D mesh grid.
x = linspace( minx,maxx, (maxx-minx)/res);
y = linspace(miny,maxy,(maxy-miny)/res);
[X,Y] = meshgrid(x,y);
Z = gridtrimesh(F,V,X,Y);
F and V are the original triangle facets and vertices The obtained grid is pretty regular Then I want to retrieve back the facets and the vertices, supposedly regular and uniform, from X Y and Z. I tried delaunyTri vis this code
sizes=size(X);
x_row = reshape(X, sizes(1)*sizes(2), 1) ;
y_row = reshape(Y, sizes(1)*sizes(2), 1) ;
z_row = reshape(Z, sizes(1)*sizes(2), 1) ;
indan= ~isnan(z_row); % remove the NaN values
x_row=x_row(indan);
y_row=y_row(indan);
z_row=z_row(indan);
DT = DelaunayTri(x_row,y_row,z_row) ;
The DT contains triangulation of nx4, while i was expecting nx3. Besides the obtained mesh looks horrible.
Any help?
Thanks

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Asked:

on 27 Mar 2013

Community Treasure Hunt

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

Start Hunting!