0001 function [Indx ,ddmin] = vb_find_nearest_point_no_overlap(Vref,Vnew,Rmax)
0002
0003 fprintf('Ver2 vb_find_nearest_point_no_overlap start\n\n')
0004
0005
0006 d = vb_sparse_inv_distance(Vref,Vnew, Rmax);
0007
0008 [overlap0,ddmin0,Indx0] = vb_find_overlap(d);
0009
0010
0011 dmin0 = max(ddmin0(:));
0012 fprintf('max distance of ddmin at 1st stage = %g\n',dmin0)
0013
0014 if overlap0.Noverlap == 0,
0015 ddmin = ddmin0;
0016 Indx = Indx0;
0017 fprintf('No overlap at 1st stage\n')
0018 clear d
0019
0020 return;
0021 else
0022 fprintf('Noverlap at 1st stage = %d , Mean Multiplicity = %g\n', ...
0023 overlap0.Noverlap, mean(overlap0.Nmulti)),
0024 end;
0025
0026 [d1, overlap, ddmin, Indx, iter] = vb_find_no_overlap(d,overlap0,Rmax);
0027
0028
0029 dmin1 = max(ddmin(:));
0030 fprintf('max distance of ddmin at 2nd stage = %g\n',dmin1)
0031
0032 if overlap.Noverlap == 0,
0033 fprintf('No overlap at 2nd stage (after iter = %d)\n', iter)
0034 else
0035 fprintf('Noverlap (after iter = %d) = %d , Mean Multiplicity = %g\n', ...
0036 iter,overlap.Noverlap, mean(overlap.Nmulti)),
0037 end;
0038
0039 clear d d1
0040
0041
0042 return