function [pts,mean_dist] = BR_study3D(num_pts,lenx,leny,lenz)
%

pts = [[lenx*(0.5-rand(num_pts,1))],[leny*(0.5-rand(num_pts,1))],...
    [lenz*(0.5-rand(num_pts,1))]];
ns = createns(pts,'nsmethod','kdtree');
[idx, dists] = knnsearch(ns,pts,'k',2);
%idx = rangesearch(ns,pts,0.351);
mean_dist = 2*mean(dists(:,2));
tch = 0;
