function [box zero range eigvec]=make_box2(points)
eps=10^-6;
%OK

N=size(points,1);
dim=size(points,2);
num_of_points=round(N^(1/dim));
eigvec=eye(2);

range=(max(points)-min(points))';


box=zeros(N,dim);
pointer=min(points);
step=range/(num_of_points-1);
jump=[1 num_of_points ];
for i=1:N
    for k=1:dim
        box(i,k)=pointer(k)+step(k)*mod(floor((i-1)/jump(k)),num_of_points);
    end
end  

range=ones(dim,1)./(2*range);
zero=box(1,:);

%plot(box(:,1), box(:,2),'b.' ); hold on; plot(points(:,1), points(:,2), 'r.' ); hold off
end