Create voxels from a sphere pack and store as boolean -
i'm trying convert output file matlab code has output of position vectors , sphere radius. intend create voxels these spheres , store in boolean form i.e 1 sphere, 0 void. please how advise go this. here's example of output.
pos (x) , pos (y), pos (z) radius -0.34316 -0.18477 -0.00897 0.0900 -0.18425 -0.20463 0.08040 0.020 -0.46883 -0.49809 0.36954 0.020 0.24727 -0.19437 -0.28274 0.0876 0.39771 0.49293 -0.49469 0.0200 -0.04368 0.26251 -0.07504 0.0200 -0.34705 0.04092 0.37070 0.0200
here's snippet of matlab code i'm working with. spheres in lattice space.thanks
coords=zeros(n,3); % list of 3d positions of particles overlap=(6*phi/(pi*n))^(1/3); % create initial, evenly-spaced lattice numcell=(ceil(n^(1/3))); cellside=1/numcell; hh=linspace(-.5+.5*cellside,.5-.5*cellside,numcell); ii=1:n coords(ii,1)=hh(ceil(ii/ceil(n/numcell))); coords(ii,2)=hh(floor(mod(ii,ceil(n/numcell))/numcell)+1); coords(ii,3)=hh(mod(ii,numcell)+1); end scatter3(coords(:,1),coords(:,2),coords(:,3),'filled');
Comments
Post a Comment