how can I create a unique patch object
Afficher commentaires plus anciens
I would like to create a unique object p (patch) so as to preserve some features like faces' color and surface , upon wich i can plot another figures , so as to preserve the previous figures , modifyng only the S.Vertices.
surf=gca;
xlim(surf,[-10 10]);
xlabel('x');
zlim(surf,[-10 10]);
zlabel('z');
ylim(surf,[-10 9]);
ylabel('y');
daspect([1 1 1]);
%first figure
S.Vertices=[1,1,1;4,1,1;4,4,1;1,4,1; 1,1,4;4,1,4;4,4,4;1,4,4];
S.faces=[1,2,3,4;1,2,6,5;3,2,6,7;4,3,7,8;4,1,5,8;5,6,7,8];
p=patch(gca,S);
p.FaceVertexCData=[1 0 0; 0 1 0 ; 0 0 1 ; 0 1 1 ; 1 0 1 ; 1 1 0 ];
p.FaceColor="flat";
%simple object rotation
theta=pi/2;
mry=[ cos(theta) 0 sin(theta) ;
0 1 0 ;
-sin(theta) 0 cos(theta)];
S.Vertices=mry*S.Vertices';
S.Vertices=S.Vertices';
% second figure
p=patch(S);
p.FaceVertexCData=[1 0 0; 0 1 0 ; 0 0 1 ; 0 1 1 ; 1 0 1 ; 1 1 0 ];
p.FaceColor="flat";
2 commentaires
Walter Roberson
le 2 Mai 2020
copyobj() perhaps?
Make a copy of the patch into the current axes, and modify the vertices in the copy.
Andrea Gusmara
le 2 Mai 2020
Réponses (0)
Catégories
En savoir plus sur Polygons dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!