3-D patch with polygons having different number of vertices not coloring faces with polygons padded with NaNs
1 view (last 30 days)
Show older comments
Here's a simple example where the two polygons with three vertices were padded with NaNs and then with the last vertex repeated. I'd like to keep the NaNs form as I use the vertex data later, and the NaNs would make those computations more efficient.
x=[1 0 0 1;0 0 0 0;1 0 0 1;1 0 0 NaN;1 0 0 NaN]'; y=[0 1 1 0;0 1 1 0;0 0 0 0;0 1 0 NaN;0 1 0 NaN]'; z=[0 0 1 1;0 0 1 1;0 0 1 1;0 0 0 NaN;1 1 1 NaN]'; C(1,1:3,:)=ones(3,1)*[1 0 0]; %red C(1,4,:)=[0 1 0]; %green C(1,5,:)=[0 0 1]; %blue figure,patch(x,y,z,C) view(-37.5+180,30)
x=[1 0 0 1;0 0 0 0;1 0 0 1;1 0 0 0;1 0 0 0]'; y=[0 1 1 0;0 1 1 0;0 0 0 0;0 1 0 0;0 1 0 0]'; z=[0 0 1 1;0 0 1 1;0 0 1 1;0 0 0 0;1 1 1 1]'; C(1,1:3,:)=ones(3,1)*[1 0 0]; %red C(1,4,:)=[0 1 0]; %green C(1,5,:)=[0 0 1]; %blue figure,patch(x,y,z,C) view(-37.5+180,30)
0 Comments
Answers (0)
See Also
Categories
Find more on Polygons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!