use median in bt_tree

This commit is contained in:
Adrian Mariano 2021-10-21 16:12:11 -04:00
parent 247939fec6
commit 814975afaf

View file

@ -494,7 +494,7 @@ function _bt_tree(points, ind, leafsize=25) =
pmc = mean(projc), pmc = mean(projc),
pivot = min_index([for(p=projc) abs(p-pmc)]), pivot = min_index([for(p=projc) abs(p-pmc)]),
radius = max([for(i=ind) norm(points[ind[pivot]]-points[i]) ]), radius = max([for(i=ind) norm(points[ind[pivot]]-points[i]) ]),
median = mean(projc), median = median(projc),
Lind = [for(i=idx(ind)) if(projc[i]<=median && i!=pivot) ind[i] ], Lind = [for(i=idx(ind)) if(projc[i]<=median && i!=pivot) ind[i] ],
Rind = [for(i=idx(ind)) if(projc[i] >median && i!=pivot) ind[i] ] Rind = [for(i=idx(ind)) if(projc[i] >median && i!=pivot) ind[i] ]
) )