Select vertex and patch from surface [V,F] = vb_trans_index(V,FF,indx) --- Input V : vertex of surface FF : patch index indx : index of selected vertex --- Output V : selected vertex F : patch index which include selected vertex Ver 1.0 by M. Sato 2004-2-10 Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [V,F] = vb_trans_index(V,FF,indx) 0002 % Select vertex and patch from surface 0003 % [V,F] = vb_trans_index(V,FF,indx) 0004 % --- Input 0005 % V : vertex of surface 0006 % FF : patch index 0007 % indx : index of selected vertex 0008 % --- Output 0009 % V : selected vertex 0010 % F : patch index which include selected vertex 0011 % 0012 % Ver 1.0 by M. Sato 2004-2-10 0013 % 0014 % Copyright (C) 2011, ATR All Rights Reserved. 0015 % License : New BSD License(see VBMEG_LICENSE.txt) 0016 0017 % 0018 %------ 3角形番号を新しい頂点情報に対応するように変換 ------- 0019 % 0020 Npoint = size(V,1); % 頂点数 0021 Nnew = length(indx); 0022 V = V(indx,:); 0023 0024 % 旧頂点番号から新しい頂点番号へ変換する変換表 0025 % Itrans(i)=0 : 旧頂点番号 = i は新しい頂点に含まれない 0026 % Itrans(i)=j : 旧頂点番号 = i は新しい頂点 = j に対応 0027 Itrans = zeros(Npoint,1); 0028 Itrans(indx) = 1:Nnew; 0029 0030 % 3角形番号を新しい頂点情報に対応するように変換 0031 % 3角形の全ての頂点が新しい頂点に含まれる3角形を探す 0032 FF = Itrans(FF); 0033 ixF = find(prod(FF ,2) ~= 0 ); 0034 F = FF(ixF,:); 0035 0036 return