TP-modelisation-images/TP_maillage_suite.m

22 lines
872 B
Mathematica
Raw Normal View History

2022-04-06 09:12:38 +00:00
load donnees;
% Calcul des faces du maillage à garder
2022-04-06 09:49:55 +00:00
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)];
2022-04-06 09:12:38 +00:00
FACES = sortrows(FACES);
2022-04-06 20:17:11 +00:00
rep = sum(FACES(1:end - 1, :) == FACES(2:end, :), 2) == 3;
2022-04-06 09:49:55 +00:00
FACES([0; rep] | [rep; 0], :) = [];
2022-04-06 09:12:38 +00:00
2022-04-06 20:17:11 +00:00
fprintf('Calcul du maillage final termine : %d faces. \n', size(FACES, 1));
2022-04-06 09:12:38 +00:00
% Affichage du maillage final
figure;
hold on
2022-04-06 20:17:11 +00:00
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');
2022-04-06 09:12:38 +00:00
end;
2022-04-06 20:17:11 +00:00
view(80, -10);