How to plot 3d patch with Faces and vertices

조회 수: 55 (최근 30일)
Maximilian Krahn
Maximilian Krahn 2021년 7월 15일
답변: Joerg Wensch 2022년 7월 1일
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?

채택된 답변

KSSV
KSSV 2021년 7월 15일
Try this:
patch('faces',faces,'vertices',vertices(:,1:2),'facevertexcdata',vertices(:,3),'facecolor','interp','edgecolor','none') ;
colorbar
  댓글 수: 2
Maximilian Krahn
Maximilian Krahn 2021년 7월 15일
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 2021년 7월 15일
There is edgecolor option....you change it to black or someother color. HAve a look on triplot, trimesh.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Maximilian Krahn
Maximilian Krahn 2021년 7월 15일
trimesh(faces, vertices(:,1),vertices(:,2),vertices(:,3))
solved it for me. Thanks KSSV
  댓글 수: 1
KSSV
KSSV 2021년 7월 15일
Thanks is accepting the answer... who helped you...

댓글을 달려면 로그인하십시오.


Joerg Wensch
Joerg Wensch 2022년 7월 1일
Simply type view(3).

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by