-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsmt_newIdAssign.m
48 lines (42 loc) · 1.01 KB
/
smt_newIdAssign.m
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
%% Reassign geometic ID
function [vrtxN,edgeN,faceN]=smt_newIdAssign(vrtx,edge,face,rg,vVl,eVl,fVl)
[vrtxN,edgeN,faceN]=deal(vrtx,edge,face);
% face id
for ii=1:size(face{2},1)
fvr=face{2}{ii};
fed=face{3}{ii};
for jj=1:size(fvr,2)
fvr(jj)=find(vVl==fvr(jj));
fed(jj)=sign(fed(jj))*find(eVl==abs(fed(jj)));
end
faceN{2}{ii}=fvr;
faceN{3}{ii}=fed;
end
% vertex id
for ii=1:size(vrtx,1)
ved=vrtxN(ii,rg.vi(1):rg.vf(1));
for jj=1:3
if ved(jj)>0
vrtxN(ii,rg.vi(1)-1+jj)=find(eVl==ved(jj));
end
end
vfa=vrtxN(ii,rg.vi(2):rg.vf(2));
for jj=1:3
if vfa(jj)>0
vrtxN(ii,rg.vi(2)-1+jj)=find(fVl==vfa(jj));
end
end
end
% edge id
for ii=1:size(edge{1},1)
for jj=1:2
edgeN{1}(ii,rg.ei(1)-1+jj)=find(vVl==edgeN{1}(ii,rg.ei(1)-1+jj));
end
efa=edgeN{1}(ii,rg.ei(2):rg.ef(2));
for jj=1:2
if efa(jj)>0
edgeN{1}(ii,rg.ei(2)-1+jj)=find(fVl==efa(jj));
end
end
end
end