How to plot 3d patch with Faces and vertices

42 vues (au cours des 30 derniers jours)
Maximilian Krahn
Maximilian Krahn le 15 Juil 2021
I found the patch function, which allows me to plot patches given faces and vertices. As I am working with 3d data, my faces data is a 10670x3 matrix and the vertices are a 6136 x 3 matrix. When I try to display them with
patch('Faces', faces, 'Vertices', vertices)
It just plots the data projected to a 2d plane. How can I plot them in 3d?

Réponse acceptée

KSSV
KSSV le 15 Juil 2021
Try this:
patch('faces',faces,'vertices',vertices(:,1:2),'facevertexcdata',vertices(:,3),'facecolor','interp','edgecolor','none') ;
colorbar
  2 commentaires
Maximilian Krahn
Maximilian Krahn le 15 Juil 2021
it does add color to display the 3d part, but I was looking for a 3d graph, where the poinst are plotted in 3d space
KSSV
KSSV le 15 Juil 2021
There is edgecolor option....you change it to black or someother color. HAve a look on triplot, trimesh.

Connectez-vous pour commenter.

Plus de réponses (2)

Maximilian Krahn
Maximilian Krahn le 15 Juil 2021
trimesh(faces, vertices(:,1),vertices(:,2),vertices(:,3))
solved it for me. Thanks KSSV
  1 commentaire
KSSV
KSSV le 15 Juil 2021
Thanks is accepting the answer... who helped you...

Connectez-vous pour commenter.


Joerg Wensch
Joerg Wensch le 1 Juil 2022
Simply type view(3).

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by