How to simply downsample a triangular mesh?

2.7k views Asked by At

This requirement occur when I show the surface mesh in Matlab by trisurf, because the mesh is dense (high-resolution) and it is rendered slowly and can not be rotated. So I am wondering there is some intuitive method to downsample the mesh while keep the basic shape ?

Before I post the question here, I have Googled. A popular tool iso2mesh, has a similar function, remeshsurf. But it firstly reconstruct the volume by the original mesh and the construct the new mesh according to the desired resolution. An important flaw, in my opinion, is that it change the original shape.

Anyone has some idea ? The Matlab function would be the best since it is easy to be tested.

Thanks.

Nico

2

There are 2 answers

2
Rash On

You should downsample your data,

[x,y]=meshgrid(1:15,1:15);
tri = delaunay(x,y);
z = peaks(15);
trisurf(tri,x,y,z)
figure
x1 = x(1 : 2 : end,1 : 2 : end);
y1 = y(1 : 2 : end,1 : 2 : end);
z1 = z(1 : 2 : end,1 : 2 : end);
tri1 = delaunay(x1,y1);
trisurf(tri1,x1,y1,z1)

enter image description here

enter image description here

You could even use downsample function on each data.

0
nicozuo On

@Kamtal (Originally I added this post as a comments but it prompts "too long post")Many thanks. I guess, your method is a good choice only when the hull of the shape is obviouse. For other cases, for an instance, the cortex of a human brain, the Matlab delaunay function is not smart enough to re-generate the triangular mesh while reserving the basic shape (fold). Here (about 1.7M) I have uploaded an example which describes a surface of the cortex (both left and right hemisphere). It could be displayed by the following code, load mysurf.mat; figure, trisurf(mysurf.tri, mysurf.coord(:,1),mysurf.coord(:,2),mysurf.coord(:,3)); view(-90,0); daspect([1 1 1]); axis tight; camlight; axis vis3d off; lighting phong; material shiny;
shading interp;