MATLAB: Adding a polyshape to a 3D plot (a la patch)

patchplotpolyshape

In the attached .mat file is a polyshape object which, when plotted in 2D, looks like an annulus,
Hpgon = plot(pgon); axis equal
Now, however, I would like to add this shape to the xy-plane of a 3D plot axis, filled with the same color. My first thought was to use patch(), as follows
vertices3D=pgon.Vertices;
vertices3D(:,3)=0;
faces3D=1:size(vertices3D,1);
patch('Vertices',vertices3D,'Faces',faces3D,'FaceColor',Hpgon.FaceColor);
camva auto
axis vis3d
This fails however, resulting in the unfilled plot below. I can see that patch() is having trouble interpreting this as a closed shape, but am not sure what the most efficient remedy would be. What is the best way to give patch() the same smarts as polyshape.plot()? Might there be an altogether different alternative to patch? It seems a shame that I cannot somehow do this directly with the polyshape object

Best Answer

Happily, I found a solution that circumvents patch() altogether and pretty much makes direct use of polyshape, as I was hoping for. It seems that any 2D plotting command can also be used to plot into an existing 3D axis. So, I can just use plot.polyshape() to add the annulus to a 3D plot directly. One can also apparently use hgtransforms to re-orient polyshapes in 3D space arbitrarily, as in the example below. This is great - it basically means that the full power of polyshape is directly available in 3D as well as 2D.
load('example.mat')
t = 0:pi/10:2*pi;
figure
[X,Y,Z] = cylinder((2+cos(t))*10);
surf(X,Y,Z-.5)
M=[ 1.0000 0 -0.0035 0
0 1.0000 0 0
0.0035 0 1.0000 0
0 0 0 1.0000];
t=hgtransform('Matrix',M);
Hpgon=plot(pgon,'Parent',t,'FaceColor','r');
axis vis3d