close all; clear all;
%% Data for Agglomerates
N = 1000; % number of spheres
a = 1; % lowest diameter of sphere
b = 200 ; % highest diameter of sphere
Diam = a + (b-a).*rand(N,1);
Diam = round(Diam);
aaa= 0; % minimum x and y coordinate limit for spheres
bbb= sum(Diam) ;% maximum x and y coordinat limit for sphere
M=3 ;
Axes= zeros(N,M);
Axes(:,1)=aaa+(bbb-aaa)*rand(N,1);
for k=2:M
aaa=randperm(N);
Axes(:,k)=Axes(aaa,1);
end
Axes_Label ={'X axis','Y axis','Z axis'};
Data_agglo = [Diam Axes];
Data_Label ={'Diameter','X axis','Y axis','Z axis'};
R = Diam ./2;
s = sum(Axes);
%% Plotting Agglomerates in 3D
f = figure('visible','on');
tic
for i =1:1:size(Data_agglo,1)
p = linspace(-Diam(i),Diam(i),200);
[X,Y,Z] = meshgrid(p,p,p); % box mesh
active = X.^2 + Y.^2 + Z.^2 <= R(i)^2 ;
plot3(Data_agglo(i,2)+X(active),Data_agglo(i,3)+Y(active),Data_agglo(i,4)+Z(active),'o');
hold on
end
hold all
toc