# Visualize a mesh from list of 3D point and faces

I have a list of vertices and faces. Now, I want to create a mesh using the given points and faces list and visualize it. Also, I want to play with the mesh by adding an extra point on the faces. Can anybody guide me on how to do this using matlab? Any function name or guide would be helpful. I found a way to create a mesh using the range of the x and y but not using the given point so any direction would be helpful.

Vertex Position
P0 31.1041, 28.3457, 29.165
P1 40.6266, 28.3457, -1.10804
P2 40.0714, 30.4443, -1.10804
P3 40.7155, 31.1438, -1.10804
P4 42.0257, 30.4443, -1.10804
P5 43.4692, 28.3457, -1.10804
P6 37.5425, 28.3457, 14.5117
P7 37.0303, 30.4443, 14.2938
P8 37.6244, 31.1438, 14.5466
P9 38.8331, 30.4443, 15.0609
P10 40.1647, 28.3457, 15.6274
P11 29.0859, 28.3457, 27.1468
P12 28.6917, 30.4443, 26.7527
P13 29.149, 31.1438, 27.2099
P14 30.0792, 30.4443, 28.1402
face id vertices id
face 0 7,6,1
face 1 1,2,7
face 2 8,7,2
face 3 2,3,8
face 4 9,8,3
face 5 3,4,9
face 6 10,9,4
face 7 13,12,7

I think that you are looking for the trimesh function.

In your case, you would have something like

pts = [31.1041, 28.3457, 29.165;
40.6266, 28.3457, -1.10804;
40.0714, 30.4443, -1.10804;
40.7155, 31.1438, -1.10804;
42.0257, 30.4443, -1.10804;
43.4692, 28.3457, -1.10804;
37.5425, 28.3457, 14.5117;
37.0303, 30.4443, 14.2938;
37.6244, 31.1438, 14.5466;
38.8331, 30.4443, 15.0609;
40.1647, 28.3457, 15.6274;
29.0859, 28.3457, 27.1468;
28.6917, 30.4443, 26.7527;
29.149, 31.1438, 27.2099;
30.0792, 30.4443, 28.1402];

T = [7, 6, 1;
1, 2, 7;
8, 7, 2;
2, 3, 8;
9, 8, 3;
3, 4, 9;
10, 9, 4;
13, 12, 7];

trimesh(T, pts(:, 1), pts(:, 2), pts(:, 3))


But it seems to have some overlapping triangles.

• thanks. it is something similar. but rather than fixing the face for the 3 points, I would like to make faces of variable points (3,4, or 6 points). Do you know whether that is possible or not? Mar 4, 2021 at 17:50
• @nKandel, I think that in that case you would need to create your own function. Or find a better visualization library or an external software. Mar 5, 2021 at 21:27