Get vertices that create surface mesh from trisurf
17 views (last 30 days)
Show older comments
Hi,
I am trying to obtain the vertices on the surface of my triangulated mesh only. So far, I have managed to create the mesh and plot it using the following code:
tri = triangulation(T, P);
tMesh= trisurf(tri,'Facecolor','red','FaceAlpha',.1,'EdgeColor','red');
where:
- T = Triangulation connectivity list, specified as an m-by-n matrix, where m is the number of triangles or tetrahedra, and n is the number of vertices per triangle or tetrahedron. Each row of T contains the vertex IDs that define a triangle or tetrahedron.
- P = Points, specified as a matrix whose columns are the x-coordinates, y-coordinates, and (possibly) z-coordinates of the triangulation points. The row numbers of P are the vertex IDs in the triangulation.
Is there anyway I can obtain the vertices which 'trisurf' uses to produce the triangulated surface mesh? Otherwise, is there an alternative way I can find the surface vertices?
Any help would be greatly appreciated!
Thank you kindly.
0 Comments
Answers (1)
DGM
on 1 Jul 2025
It really sounds like this question isn't the question that's been asked.
You don't need to get the vertices from trisurf(), because it doesn't "produce" them. You have the vertices to begin with.
% you already have this
F = [1 2 3; 2 1 4; 5 6 7; 2 6 5; 4 6 2; 6 4 8; 9 5 7;
5 9 10; 11 9 12; 9 11 10; 10 2 5; 2 10 3; 11 13 10;
11 14 13; 14 1 15; 1 14 11; 16 10 13; 15 10 16; 15 3 10;
3 15 1; 4 17 8; 1 17 4; 11 17 1; 17 11 12; 6 18 15;
8 18 6; 18 8 17; 15 18 14; 19 9 20; 9 19 12; 17 19 18;
19 17 12; 6 20 7; 15 20 6; 20 15 16; 7 20 9; 13 20 16;
20 13 19; 13 18 19; 18 13 14];
V = [-0.5 -0.5 -0.5; -0.5 0.5 0.5; -0.5 0.5 -0.5; -0.5 -0.5 0.5;
0.5 0.5 0.5; -0.25 0.25 0.5; 0.5 0.25 0.5; -0.25 -0.5 0.5;
0.5 0.25 0; 0.5 0.5 -0.5; 0.5 -0.5 -0.5; 0.5 -0.5 0;
0.25 -0.25 -0.5; -0.25 -0.25 -0.5; -0.25 0.25 -0.5; 0.25 0.25 -0.5;
-0.25 -0.5 0; -0.25 -0.25 0; 0.25 -0.25 0; 0.25 0.25 0];
% then you put it in a triangulation object
T = triangulation(F,V);
% then you put it in a patch object
hp = trisurf(T,'Facecolor','red','FaceAlpha',0.1,'EdgeColor','k');
% they are all the exact same data you started with
% because that's what you put in them
[isequal(F,T.ConnectivityList) isequal(F,hp.Faces)] % faces
[isequal(V,T.Points) isequal(V,hp.Vertices)] % vertices
I don't get it.
I'll note the phrase "surface vertices". If this were about finding the boundary of a tetrahedral mesh, maybe that's a thing, but it's clearly not a tetrahedral mesh. If this were about finding and removing interior faces/vertices, then maybe that's a good question, but now I'm guessing about something which was never asked about a model which was never shown.
0 Comments
See Also
Categories
Find more on Triangulation Representation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!