3d - Link closest points accross altitudes in Matlab and form chains -
3d - Link closest points accross altitudes in Matlab and form chains -
i have 3d matrix scattered points (nx4 matrix, x-y-z-data). aim link closest points , register each chain in kx4 array (x, y, z, data), k beingness chain length. total number of chains depends on points... particularity these lines go upwards (z+), don't want link points on same z, or go down.
i have been trying different strategies far, 1 beingness array shape (mx4xnz - meaning values stacked per z's instead of beingness on 2d matrix): [edited after progress, using delaunay/nearestneighbor]
pick point @ level zn go level zn+1, closest point in range of coordinates x,y using delaunaytriangulation , nearestneighbor register point vector(i suspect there other possibilities using nearestneighbor nx4 matrix, can't think how 'direct' search upwards , chain successive points... )
i find myself next problem : finding of nearest point upwards seems work in 1 direction only!!
linking doesn't work:
linking works:
during loop have warning : warning: duplicate info points have been detected , removed. triangulation indices defined respect unique set of points in delaunaytriangulation property x.
lign=zeros(max_iter,4,s);
for = 1:s;
pp_id=i; n=1:max_iter-1; wn=w(:,:,n); % w info 3d-matrix mx4xnz wnn=w(:,:,n+1); point_n = wn(pp_id,:); xn= point_n(1); yn= point_n(2); zn= point_n(3); vn= point_n(4); if xn==0|yn==0|zn==0|vn==0; break end % nearest neighbour @ next level dt=delaunaytriangulation(wnn(:,[1:2])); [pp_id, d]=nearestneighbor(dt,[point_n(1),point_n(2)]); % limit range if d>10 break end % extraction of values @ new pp_id point_n=wnn(pp_id,:); % register point in line lign(n,:,i)=point_n; end end
anyone has thought why happens?
matlab 3d delaunay neighbours closest-points
Comments
Post a Comment