-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.m
More file actions
26 lines (22 loc) · 974 Bytes
/
main.m
File metadata and controls
26 lines (22 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
clear all;close all;clc;
addpath('toolbox_graph');
[vertices, faces] = read_off('bumpy.off');
%[vertices, faces] = ply_to_tri_mesh('cow.ply');
trisurf(faces',vertices(1,:),vertices(2,:),vertices(3,:));axis equal;
threshold = 0.01; % distance between vertices
nIter = 100; % number of iterations define the number of edges to be removed
nIter2 = 100; % number of iterations define the number of faces to be removed
newVertices = vertices;
newFaces = faces;
%% Project : Simplify mesh by removing edges.
for i = 1:nIter
[newFaces,newVertices] = simplifyMesh(newFaces,newVertices,threshold);
end
figure;
trisurf(newFaces',newVertices(1,:),newVertices(2,:),newVertices(3,:));axis equal;
%% Extension of the project : Simplify mesh by removing traingles instead of edges
for i = 1:nIter2
[newFaces,newVertices] = simplifyMeshTri(newFaces,newVertices,threshold);
end
figure;
trisurf(newFaces',newVertices(1,:),newVertices(2,:),newVertices(3,:)); axis equal;