To generate vertice mesh from a series of contours

4 visualizaciones (últimos 30 días)
Erhong
Erhong el 21 de Abr. de 2011
Editada: Jiexian Ma el 12 de Abr. de 2025
Hello,
As beginner in MATLAB, now I have a series of contours, which define a structure. On each contour there are isolated points whose cartesian coordinates are known. Now I would like to generate a mesh from these contours (or points). The MyRobustCrust.m from file exchange does generate a mesh with faces, but without vertices' coordinates. And the vertices are needed for my calculation.
Does any one have any hints? Thank you very much.
Erhong

Respuesta aceptada

Sarah Wait Zaranek
Sarah Wait Zaranek el 22 de Abr. de 2011
I believe this should work for you.
% Generating some contour data
x = rand(100,1)*4-2;
y = rand(100,1)*4-2;
z = x.*exp(-x.^2-y.^2);
scatter3(x,y,z,'b','filled')
hold on
% Calculating Triangulation
dt = DelaunayTri(x,y,z);
% Finding the surface boundary
[tri xf] = freeBoundary(dt);
trisurf(tri, xf(:,1),xf(:,2),xf(:,3), ...
'FaceColor','cyan', 'FaceAlpha', 0.8);
% Getting the vertices
t1v = xf(tri(:,1),:); %x,y,z for first point in triangles
t2v = xf(tri(:,2),:); %x,y,z for second point in triangles
t3v = xf(tri(:,3),:); %x,y,z for third point in triangles
vert = [t1v; t2v ;t3v];
scatter3(vert(:,1), vert(:,2), vert(:,3),'g','filled')
hold off

Más respuestas (1)

Jiexian Ma
Jiexian Ma el 12 de Abr. de 2025
Editada: Jiexian Ma el 12 de Abr. de 2025
If you plan to work with 2D finite element mesh, the following methods may be helpful.
Personally, I perfer method 2 because you can edit polyshape object easily.
You could check demo14 to demo17 in Im2mesh package. I provide a few examples.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by