% creates the data for ICDSC2011 example

%a=rand(3,3); a'*a; % how to create a positive semi-definite symmetric matrix

x =  [];
%x = [x; mvnrnd([1 1 2], [2 0 0; 0 3 0; 0 0 1], 10000)];
%x = [x; mvnrnd([7 5 7], [1 0 0; 0 4 0; 0 0 2], 10000)];
x = [x; mvnrnd([2 6 6], [1 0 0; 0 1 0; 0 0 1], 10000)];
x = [x; mvnrnd([6 1 2], [0.4 0 0; 0 0.6 0; 0 0 2], 10000)];

x(:,1) = 639 * (x(:,1) - min(x(:,1))) / (max(x(:,1))-min(x(:,1)));
x(:,2) = 479 * (x(:,2) - min(x(:,2))) / (max(x(:,2))-min(x(:,2)));
x(:,3) = 399 * (x(:,3) - min(x(:,3))) / (max(x(:,3))-min(x(:,3)));

x = [x; 639*rand(1000,1), 479*rand(1000,1), 399*rand(1000,1)];

%scatter3(x(:,1), x(:,2), x(:,3));

m = zeros(48,64,40);
for i=1:length(x(:,1))
    xx = int32(floor(x(i,1)/10)) +1;
    yy = int32(floor(x(i,2)/10)) +1;
    zz = int32(floor(x(i,3)/10)) +1;
    m(yy,xx,zz)=m(yy,xx,zz)+1;
end
m = smooth3(m);


