How to develop MATLAB code for 3D Voronoi in cubical volume?

I just started using MATLAB for the research. My research is concentrated on composite material model. I want to develop fiber composite and porosity material model. From my literature study, voronoi technique is powerful to develop fiber and porosity material. In the MATLAB coding, in 2D or cell problem is already develope but I really need to understand in 3D or volume study case using MATLAB

 Accepted Answer

What have you tried so far? The voronoin function is the starting point.

3 Comments

Dear Mr Mike Garrity Thank you a lot to settle my problem. Now I can run the 3D voronoi, unfortunately when I come to visualization the voronoi perform in surface area. What I need the 3D voronoi look like construction network. Here I present my MATLAB coding below
clear all close all clc
r1=10; %distance between node [nm] rad=r1/2; % radius of distance [nm] numparticles = 200; %Number node launching top=50; %maximum distance of RVE box [nm] num=top/r1; %number of coordinate points along axis (x,y,z)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Data save ix_save=zeros(1,length(numparticles)); iy_save=zeros(1,length(numparticles)); iz_save=zeros(1,length(numparticles));
Ixstore=zeros(1,length(numparticles)); Iystore=zeros(1,length(numparticles)); Izstore=zeros(1,length(numparticles));
% Particle seed
a = [rad:r1:top];
b = [rad:r1:top];
c = [rad:r1:top];
xi=a(randint(1,1,[1,num]));
yi=b(randint(1,1,[1,num]));
zi=c(randint(1,1,[1,num]));
Ixstore(1,1)=xi;
Iystore(1,1)=yi;
Izstore(1,1)=zi;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Launching Partikel terhadap partikel terdekat dengan menggunakan random
for i=2:numparticles; ix(i) = a(randint(1,1,[1,num])); iy(i) = b(randint(1,1,[1,num])); iz(i) = c(randint(1,1,[1,num]));
Ixstore(1,i)=ix(i);
Iystore(1,i)=iy(i);
Izstore(1,i)=iz(i);
end X = [Ixstore(1,:)', Iystore(1,:)', Izstore(1,:)'];
[V,C] = voronoin(X); for i=1:length(C), disp(C{i}), end
for k=1:length(C) if all(C{k}~=1) VertCell = V(C{k},:); KVert = convhulln(VertCell); patch('Vertices',VertCell,Faces,KVert,'FaceColor','g','FaceAlpha',0.5)
end
end
I'm sorry, but I'm not following what you mean by "construction network".

Sign in to comment.

More Answers (0)

Categories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!