Color a delaunay triangulation

14 visualizaciones (últimos 30 días)
Cristina Garozzo
Cristina Garozzo el 10 de Sept. de 2014
Comentada: Fabio Freschi el 11 de Sept. de 2014
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

Respuesta aceptada

Fabio Freschi
Fabio Freschi el 10 de Sept. de 2014
Editada: Fabio Freschi el 10 de Sept. de 2014
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 comentarios
Cristina Garozzo
Cristina Garozzo el 11 de Sept. de 2014
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 el 11 de Sept. de 2014
could you post the outputs of the following commands
>> size(x)
>> size(TRI)
>> size(alpha)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by