inverse distances between Vref and Vnew d = Dinv = vb_sparse_inv_distance(Vref,Vnew, Rmax); overlap.Noverlap = number of duplicate point overlap.Ovlist(n) = n-th duplicate point index of Vref overlap.Nmulti(n) = number of multiple point (Vnew) corresponding to the same Vref overlap.Inew{n} = index list of new vertex for Vref Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [overlap, ddmin,Indx] = vb_find_overlap(d) 0002 % inverse distances between Vref and Vnew 0003 % d = Dinv = vb_sparse_inv_distance(Vref,Vnew, Rmax); 0004 % 0005 % overlap.Noverlap = number of duplicate point 0006 % overlap.Ovlist(n) = n-th duplicate point index of Vref 0007 % overlap.Nmulti(n) = number of multiple point (Vnew) 0008 % corresponding to the same Vref 0009 % overlap.Inew{n} = index list of new vertex for Vref 0010 % 0011 % Copyright (C) 2011, ATR All Rights Reserved. 0012 % License : New BSD License(see VBMEG_LICENSE.txt) 0013 0014 [Nref, Nnew] = size(d); 0015 0016 % Find nearest points from Vnew 0017 [ddmin,Indx] = max(d,[],1); 0018 ddmin = 1./ddmin; 0019 0020 % duplicate index of Vref 0021 Iref = zeros(Nref,1); 0022 Inew = cell(Nref,1); 0023 0024 for v=1:Nnew 0025 ref_index = Indx(v); 0026 % count same index 0027 Iref(ref_index) = Iref(ref_index) + 1; 0028 Inew{ref_index} = [Inew{ref_index} , v]; 0029 end 0030 0031 overlap.Ovlist = find( Iref > 1); 0032 overlap.Noverlap = length(overlap.Ovlist); 0033 overlap.Nmulti = Iref(overlap.Ovlist); 0034 0035 overlap.Inew = cell(overlap.Noverlap,1); 0036 0037 for n=1:overlap.Noverlap 0038 ref_index = overlap.Ovlist(n); 0039 overlap.Inew{n} = Inew{ref_index}; 0040 end 0041 0042 return 0043 0044 if overlap.Noverlap > 1, 0045 fprintf('Noverlap = %d , Multiplicity = %d\n', ... 0046 overlap.Noverlap, sum(overlap.Nmulti)), 0047 end; 0048 0049 %return