Volumetric Meshes
This tour explores the processing of volumetric tetrahedral meshes.
Contents
Installing toolboxes and setting up the path.
You need to download the following files: signal toolbox, general toolbox, graph toolbox and additional toolbox.
You need to unzip these toolboxes in your working directory, so that you have toolbox_signal, toolbox_general, toolbox_graph and toolbox_additional 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/'); getd('toolbox_additional/');
Tetrahedral Mesh Loading and Displaying
You can load and display volumetric tetrahedral meshes. Important: .tet files and not included in the toolbox distribution (too large files). You should download them from
Load a volumetric mesh.
[vertex,faces] = read_tet('hand.tet');
Display it.
clear options;
options.plot_points = 1;
clf; plot_mesh(vertex,faces,options);
Display it.
options.cutting_plane = [0 0 1]; options.plot_points = 0; clf; plot_mesh(vertex,faces,options);
Another view.
options.cutting_plane = [0 -1 0];
options.plot_points = 0;
options.cutting_offs = -.2;
options.face_vertex_color = vertex(1,:)';
clf; plot_mesh(vertex,faces,options);
view(-20,45);zoom(.8);
colormap jet(256);
Difusion Inside the Volume
One can compute averaging operator inside the mesh.
Exercice 1: (the solution is exo1.m) Compute the combinatorial adjacency matrix W.
exo1;
Compute the combinatorial Laplacian, stored as a sparse matrix.
n = size(W,1); D = spdiags(sum(W)', 0, n,n); L = D-W;
Compute a set of random sources.
i = round( rand(20,1)*n ) + 1; b = zeros(n,1); b(i) = (-1).^(1:length(i));
Compute the diffusion with fixed boundary conditions.
L1 = L; L1(i,:) = 0; L1(i+(i-1)*n) = 1; v = L1\b;
Display.
options.face_vertex_color = v; clf; plot_mesh(vertex,faces,options); view(-20,45);zoom(.8); shading interp; colormap jet(256);