add new vertex by dividing triangle patch locally [Vadd, Iadd, Vnew, Fnew] = vb_add_patch_vertex(overlap,V,F); Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [Vadd, Iadd, Vnew, Fnew] = vb_add_patch_vertex(overlap,V,F) 0002 % add new vertex by dividing triangle patch locally 0003 % [Vadd, Iadd, Vnew, Fnew] = vb_add_patch_vertex(overlap,V,F); 0004 % 0005 % Copyright (C) 2011, ATR All Rights Reserved. 0006 % License : New BSD License(see VBMEG_LICENSE.txt) 0007 0008 add_mode = 1; 0009 % = 1: add overlap vertex 0010 % = 2: add overlap vertex and its next neighbor 0011 0012 [xxD, xxF, xxT]= vb_next_distance(F,V); 0013 % xxF{n} : 頂点 n の 隣接近傍頂点番号 0014 % xxD{n} : 頂点 n と 各隣接近傍点 との 距離 0015 % xxT{n} : 頂点 n の 隣接3角面番号 0016 0017 % vertex index to add 0018 Vindex = []; 0019 0020 for n = 1:overlap.Noverlap 0021 % overlaped old index 0022 ix_old = overlap.Ovlist(n); 0023 % add nearest neighbor point 0024 switch add_mode 0025 case 1 0026 Vindex = [Vindex; ix_old]; 0027 case 2 0028 Vindex = [Vindex; ix_old; xxF{ix_old}]; 0029 end 0030 end 0031 0032 % vertex index for divide 0033 Vindex = unique(Vindex); 0034 0035 % make new vertex at midpoint of triangle edge 0036 [Vnew, Fnew, Iparent] = vb_divide_patch(V, F, xxT, Vindex); 0037 0038 % vertex index for new vertex in Vnew 0039 Iadd = Iparent(:,1); 0040 Vadd = Vnew(Iadd,:); 0041 0042 0043 return