Drawing 3D voronoi polyhedrons over human body points in MATLAB -


i trying draw voronoi polyhedrons in 3d around set of points (which coordinates of position of sensors) placed on human frame. found couple of ways in matlab. except none of them giving me right kind of polyhedrons. understand voronoi in 3d set of points should appear this.

how expected graph like: how expected graph like.

for set of data points, voronoi polyhedrons not encapsulate of points. voronoi polyhedrons formed out of data points this:

the voronoi polyhedrons formed out of data points.

the coordinates of data set :

x= [116,191,0;     108,183,0;     120,175,0;     100,162,12;     116,166,8;     133,158,14;     100,150,0;     116,166,15;     125,144,8;     90,133,5;     108,133,2.5;     144,133,5;     116,116,15;     144,116,6.5;     108,100,-5;     150,100,15;     83,100,15;     108,83,14;     100,58,13;     133,50,13;     100,25,11;     133,30,12;     100,8.3,14;     133,8.3,14]; 

i used code in link (http://www.mathworks.com/help/matlab/math/voronoi-diagrams.html) drawing voronoi on these points , error this:

error using convhull coordinates of input points must finite values; inf , nan not permitted.  error in best3d_original (line 38) k = convhull(xr10); 

basically, vector v hold vertices of polygons has inf values in first row. if forcefully remove first row, dont required results. code shown below:

dt = delaunaytriangulation(x); figure [v,r] = voronoidiagram(dt); tid = nearestneighbor(dt,0,0,0); xr10 = v(r{tid},:); k = convhull(xr10); k defaultfacecolor  = [0.6875 0.8750 0.8984]; trisurf(k, xr10(:,1) ,xr10(:,2) ,xr10(:,3) , ...         'facecolor', defaultfacecolor, 'facealpha',0.9) title('3-d voronoi region') 

i have tried incorporating patch function separately in script same set of data points. code looks this:

 x=[x y z];   [v,c]=voronoin(x);   k=1:length(c)       disp(c{k})   end   k=2: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 not sure happened, first row of v contains inf values, causes errors further on.

dt = delaunaytriangulation(x); figure [v,r] = voronoidiagram(dt); v(1,:) = []; %// interesting line, removes inf values tid = nearestneighbor(dt,0,0,0); xr10 = v(r{tid},:); k = convhull(xr10); defaultfacecolor  = [0.6875 0.8750 0.8984]; trisurf(k, xr10(:,1) ,xr10(:,2) ,xr10(:,3) , ...         'facecolor', defaultfacecolor, 'facealpha',0.9) title('3-d voronoi region') 

i following plot:

enter image description here


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -