MATLAB: To make a convex rectangular 2d patch in 3d

convexpatch

I have several patch objects (please see the attached figure).
Is there some function that will deliver a rectangular convex shape of yellow and orange patches? Also, some function to fill the holes in the grey patch object?
I need only surfaces, so I do not think that alpha shape is a good choice.

Best Answer

I tried griddata. Can't figure out why doesn't it work
clc,clear,cla
load('isosurface_orange.mat');
[f,v] = isosurface(xq, yq, zq, vq, level); % extract data
xdata = v(:,1)-max(v(:,1)); % move to origin
ydata = v(:,2)-max(v(:,2))-0.1;
[th,rho] = cart2pol(xdata,ydata); % convert to polar/cylindrical system
th0 = linspace(min(th),max(th),100);
z0 = linspace(min(v(:,3)),max(v(:,3)),100);
[TH0,Z0] = meshgrid(th0,z0);
RHO0 = griddata(th,v(:,3),rho,TH0,Z0); % interpolation
% [X0,Y0] = pol2cart(TH0,RHO0);
% patch('faces',f,'vertices',v,'facecolor','g')
plot3(th*180/pi,v(:,3),rho,'.r')
hold on
surf(TH0*180/pi,Z0,RHO0,'facecolor','b','edgecolor','none')
% surf(X0+max(v(:,1))-30*0,Y0+max(v(:,2))-30*0,Z0,'facecolor','b')
hold off
camlight('headlight');
material('dull');
axis equal
img1.png