Commit 88f2704e authored by Jan-Gerrit Richter's avatar Jan-Gerrit Richter

bugfix: if more than one point is found in findnearest, search sph domain (usually needed at poles)

parent d7ae6197
......@@ -34,6 +34,12 @@ else
dists = sqrt(sum((this.cart-repmat(coords.cart(idinput,:),size(this.cart,1),1)).^2,2));
for idx = 1:num
[dist(idinput, idx), ind(idinput, idx)] = min(dists); %#ok<AGROW>
if sum(dists == min(dists)) > 1
distsSph = sqrt(sum((this.sph-repmat(coords.sph(idinput,:),size(this.sph,1),1)).^2,2));
[dist(idinput, idx), ind(idinput, idx)] = min(distsSph);
dists(ind(idinput, idx)) = inf;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment