fix: surface

This commit is contained in:
Damien Guillotin 2022-04-06 11:49:55 +02:00
parent ac8b9c337b
commit 8cb615031e
4 changed files with 6 additions and 42 deletions

View file

@ -254,6 +254,7 @@ for i = 1:size(pts, 1)
end;
fprintf('Calcul des points 3D termine : %d points trouves. \n', size(X, 2));
view(80, -10);
%affichage du nuage de points 3D
figure;
@ -339,6 +340,7 @@ nb_barycentres = length(to_save);
fprintf('Retrait des tetraedres exterieurs a la forme 3D termine : %d tetraedres restants. \n',size(T,1));
figure;
tetramesh(triBis, T.Points);
view(80, -10);
% Sauvegarde des donnees
save donnees;

View file

@ -1,37 +0,0 @@
load donnees;
% Calcul des faces du maillage à garder
% nope = [];
% for i = 1:nb_barycentres
% tetra_i = T.Points(triBis(i, :), :);
% for j = i+1:nb_barycentres
% tetra_j = T.Points(triBis(j, :), :);
% if size(unique([tetra_i; tetra_j], 'rows'), 1) < 6
% for ki = 1:4
% tri_ki = sort(triBis(i,[1:ki - 1 ki + 1:4]));
% for kj = 1:4
% tri_kj = sort(triBis(j,[1:kj - 1 kj + 1:4]));
% if tri_ki == tri_kj
% nope = [nope; i ki; j kj];
% end
% end
% end
% end
% end
% i
% size(nope)
% end
FACES = [triBis(:, [2 3 4]); triBis(:, [1 3 4]); triBis(:, [1 2 4]); triBis(:, [1 2 3])];
FACES = sortrows(FACES);
FACESFACES(1:end-1, :) == FACES(2:end, :)
fprintf('Calcul du maillage final termine : %d faces. \n',size(FACES,1));
% Affichage du maillage final
figure;
hold on
for i = 1:size(FACES,1)
plot3([X(1,FACES(i,1)) X(1,FACES(i,2))],[X(2,FACES(i,1)) X(2,FACES(i,2))],[X(3,FACES(i,1)) X(3,FACES(i,2))],'r');
plot3([X(1,FACES(i,1)) X(1,FACES(i,3))],[X(2,FACES(i,1)) X(2,FACES(i,3))],[X(3,FACES(i,1)) X(3,FACES(i,3))],'r');
plot3([X(1,FACES(i,3)) X(1,FACES(i,2))],[X(2,FACES(i,3)) X(2,FACES(i,2))],[X(3,FACES(i,3)) X(3,FACES(i,2))],'r');
end;

View file

@ -1,12 +1,10 @@
load donnees;
size(triBis)
% Calcul des faces du maillage à garder
FACES = [triBis(:, [2 3 4]); triBis(:, [1 3 4]); triBis(:, [1 2 4]); triBis(:, [1 2 3])];
size(FACES)
FACES = [sort(triBis(:, [2 3 4]), 2); sort(triBis(:, [1 3 4]), 2); sort(triBis(:, [1 2 4]), 2); sort(triBis(:, [1 2 3]), 2)];
FACES = sortrows(FACES);
rep = sum(FACES(1:end-1, :) == FACES(2:end, :), 2) < 3;
FACES([0; rep] & [rep; 0], :) = [];
rep = sum(FACES(1:end-1, :) == FACES(2:end, :), 2) == 3;
FACES([0; rep] | [rep; 0], :) = [];
fprintf('Calcul du maillage final termine : %d faces. \n',size(FACES,1));
@ -18,3 +16,4 @@ for i = 1:size(FACES,1)
plot3([X(1,FACES(i,1)) X(1,FACES(i,3))],[X(2,FACES(i,1)) X(2,FACES(i,3))],[X(3,FACES(i,1)) X(3,FACES(i,3))],'r');
plot3([X(1,FACES(i,3)) X(1,FACES(i,2))],[X(2,FACES(i,3)) X(2,FACES(i,2))],[X(3,FACES(i,3)) X(3,FACES(i,2))],'r');
end;
view(80, -10);

Binary file not shown.