필터 지우기
필터 지우기

Color a delaunay triangulation

조회 수: 14 (최근 30일)
Cristina Garozzo
Cristina Garozzo 2014년 9월 10일
댓글: Fabio Freschi 2014년 9월 11일
I have a delaunay triangulation like the one in attach
. I need to color inside every triangle with a color. I'd like to show the orientation of the triangles. Because I need to highlight the order. Like the second figure

채택된 답변

Fabio Freschi
Fabio Freschi 2014년 9월 10일
편집: Fabio Freschi 2014년 9월 10일
Let's suppose that your triangulation is organized as follows
  • P: Nx2: node coordinates
  • T: Mx3: triangulation
  • F: Mx1: scalar field to be plotted, this case orientation
you can plot with the following command
>> figure;
>> patch('Faces',T,'Vertices',P,'FaceVertexCData',F,'FaceColor','flat');
Fabio
  댓글 수: 2
Cristina Garozzo
Cristina Garozzo 2014년 9월 11일
Hi fabio thank you for the suggestion. I'm trying to use your code like this
%P: Nx2: node coordinates %T: Mx3: triangulation %F: Mx1: scalar field to be plotted, this case orientation
P=[x y]; T=TRI; F=alpha;
figure; patch('Faces',T,'Vertices',P,'FaceVertexCData',F,'FaceColor','flat');* *
But I have this error
Error using patch FaceVertexCData must be an Mx1 vector (indexed colors) or Mx3 matrix (RGB colors)
Error in provacolore2 (line 29) patch('Faces',T,'Vertices',P,'FaceVertexCData',F,'FaceColor','flat');
could you help me?
Fabio Freschi
Fabio Freschi 2014년 9월 11일
could you post the outputs of the following commands
>> size(x)
>> size(TRI)
>> size(alpha)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by