Clear Filters
Clear Filters

create mesh of a 3D geometry with delaunay

41 views (last 30 days)
Alberto Acri
Alberto Acri on 24 Nov 2022
Moved: John D'Errico on 31 Aug 2023
Hello! I would like to create the mesh of a 3D geometry. I have the nodes of which the mesh is composed (Nodes_finger.txt).
I tried to use the function 'delaunay' but with no results.
folder = 'C:\Users\Alberto\Desktop\....';
filename_file = fullfile(folder, 'Nodes_finger.txt');
Nodes_finger = importdata(filename_file);
%% TEST 1
x = Nodes_finger(:,1);
y = Nodes_finger(:,2);
z = Nodes_finger(:,3);
tri = delaunay(x, y);
trimesh(tri, x, y, z);
%% TEST 2
DT = delaunayTriangulation(Nodes_finger);
tetramesh(DT,'FaceAlpha',0.3);
How can I get the mesh like the one in the figure? (even similar, not necessarily the same !)
Even a ready-made code would be perfect!

Answers (2)

Shubham
Shubham on 31 Aug 2023
Here is a working code for creating the mesh for the provided 3D geometry.
% Load the node coordinates from the file
nodes = load('Nodes_finger.txt');
% Create the Delaunay triangulation
tri = delaunayTriangulation(nodes);
% Access the triangulation information
tri.Points % Coordinates of the nodes
tri.ConnectivityList % Indices of the nodes forming each triangle/tetrahedron
% Visualize the mesh
trisurf(tri.ConnectivityList, tri.Points(:,1), tri.Points(:,2), tri.Points(:,3));
This produces the following figure in mesh:
Hope this helps!
  1 Comment
Bruno Luong
Bruno Luong on 31 Aug 2023
This is NOT working, the convex triangulation produces a elongated tetrahedron on the boundary that are not desired.

Sign in to comment.


John D'Errico
John D'Errico on 31 Aug 2023
Moved: John D'Errico on 31 Aug 2023
Do you want only a surface triangulation? Note that delaunay will not do what you want, since a delaunay triangulation will be a CONVEX thing. You will see long thin triangles, exactly as shown by @Shubham in that answer. Any tessellation will actually have long edges inside the domain, since your point cloud is almost surely only composed of surface points. (Getting interior points inside what appears to be a human finger might be problematic. Doable, but it would seem painful to me.)
You might be best off using an alpha shape. But even then, you need to consider what happens at the base of the finger. So you might almost want to generate some extra points inside the base of the finger. I cannot answer yet since I don't know if you want a volume tessellation, or a surface triangulation.
xyz = load('Nodes_finger.txt');
plot3(xyz(:,1),xyz(:,2),xyz(:,3),'.')
view(-225,13)
As you can see, the base of the finger is essentially a big hole. An alpha shape will erode the object, due to that hole. And that suggests a possibly better solution than an alpha shape, IF you want only a surface triangulation, is to use a 3-d CRUST code, which can reconstruct the surface triangulation from the point cloud.
As I recall, CRUST is available on the file exchange, here:

Categories

Find more on Delaunay Triangulation in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!