• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Untitled a guest May 23rd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. function [BOOL] = chk_Euler_rule(V, F)
2.     V_n = size(V, 1);
3.     F_n = size(F, 2);
4.     arr = zeros(V_n, V_n);
5.
6.     for i = 1 : F_n
7.         a = F(1, i);
8.         b = F(2, i);
9.         c = F(3, i);
10.
11.         if a < b
12.             arr(a,b) = 1;
13.         else
14.             arr(b,a) = 1;
15.         end
16.
17.         if a < c
18.             arr(a,c) = 1;
19.         else
20.             arr(c,a) = 1;
21.         end
22.
23.         if b < c
24.             arr(b,c) = 1;
25.         else
26.             arr(c,b) = 1;
27.         end
28.     end
29.
30.     E_n = sum(arr(:) == 1);
31.     BOOL = (V_n - E_n + F_n) == 2;
32.
33.
34.
35. function [] = show()
36.     [V, F] = off('sphere.off');
37.     trimesh(F, V(:,1), V(:,2), V(:,3));
38.
39.
40.
41. function [V, F] = off (filename)
42.     fid = fopen(filename, 'r');
43.     str = fgets(fid);
44.     p = fscanf(fid,'%d %d %d\n', 3);
45.     V = fscanf(fid,'%f %f %f\n', [3 p(1)]);
46.     V = V';
47.     F = fscanf(fid,'%d %d %d %d\n', [4 p(2)]);
48.     F = F(2:4,:)+1;
49.     F = F;
50.     fclose(fid);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!

Top