Mesh Simplification

This tour explore the simplication of a highly detailed mesh into a coarser one.

Contents

Installing toolboxes and setting up the path.

You need to download the following files: signal toolbox, general toolbox and graph toolbox.

You need to unzip these toolboxes in your working directory, so that you have toolbox_signal, toolbox_general and toolbox_graph in your directory.

For Scilab user: you must replace the Matlab comment '%' by its Scilab counterpart '//'.

Recommandation: You should create a text file named for instance numericaltour.sce (in Scilab) or numericaltour.m (in Matlab) to write all the Scilab/Matlab command you want to execute. Then, simply run exec('numericaltour.sce'); (in Scilab) or numericaltour; (in Matlab) to run the commands.

Execute this line only if you are using Matlab.

getd = @(p)path(p,path); % scilab users must *not* execute this

Then you can add the toolboxes to the path.

getd('toolbox_signal/');
getd('toolbox_general/');
getd('toolbox_graph/');

Random Edge Contraction

Simplest way to perform mesh simplification is through edge collapse. Each step replaces two vertex joined by an edge by a single vertex, and removes the edge.

Load a model.

name = 'venus';
options.name = name;
[vertex,faces] = read_mesh(name);
n = size(vertex,2);

Display full quality.

plot_mesh(vertex,faces,options);
shading faceted;

Initialize the simplification.

faces1 = faces;
vertex1 = vertex;

Compute the collection of edges.

edges = compute_edges(faces1);
nedges = size(edges,2);

Select an edge. Here selection is done at random.

k = floor(rand*(nedges-1))+1;
e = edges(:,k);

Change the vertex location, and remove one of the two vertices.

vertex1(:,e(1)) = mean( vertex1(:,e),2 );
vertex1(:,e(2)) = Inf;

Change the face indexing.

faces1(faces1==e(2)) = e(1);
a = sum( diff(sort(faces1))==0 );
faces1(:,a>0) = [];

Exercice 1: (the solution is exo1.m) Perform iterative collapse to reach p = round(2*n/3) vertices.

exo1;

Exercice 2: (the solution is exo2.m) As a post processing, find a way to remove from faces1 and vertex1 the unecessary information (remove vertex and faces that are not used).

exo2;

Error Driven Edge Contraction

To ameliorate the quality of the output mesh, it is necessary to order to select the edge to collapse according to some quality priority.

Exercice 3: (the solution is exo3.m) Perform iterative collapse to reach p = round(2*n/3) vertices. Use an ordering of the edge by their length.

exo3;

Exercice 4: (the solution is exo4.m) Try to use other criteria.

exo4;