Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.84 KB | None | 0 0
  1. function [V1, V2] = mesh_boundaries(V, F)
  2.     VV = zeros(size(V, 1));
  3.     for i = 1 : size(F, 1)
  4.         a = F(i, 1);
  5.         b = F(i, 2);
  6.         c = F(i, 3);
  7.         if a > b
  8.             VV(b, a) = VV(b, a) + 1;
  9.         else
  10.             VV(a, b) = VV(a, b) + 1;
  11.         end
  12.         if a > c
  13.             VV(c, a) = VV(c, a) + 1;
  14.         else
  15.             VV(a, c) = VV(a, c) + 1;
  16.         end
  17.         if c > b
  18.             VV(b, c) = VV(b, c) + 1;
  19.         else
  20.             VV(c, b) = VV(c, b) + 1;
  21.         end
  22.     end
  23.    
  24.     trisurf(F, V(:, 1), V(:, 2), V(:, 3));
  25.     for i = 1 : size(VV, 1)
  26.         for j = 1 : size(VV, 2)
  27.             if VV(i, j) == 1
  28.                 hold on;
  29.                 plot3([V(i, 1); V(j, 1)], [V(i, 2); V(j, 2)], [V(i, 3); V(j, 3)], 'r');
  30.             end
  31.         end
  32.     end
  33.     hold off;
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement