Borrar filtros
Borrar filtros

Coloring of specific elements using trimesh

11 visualizaciones (últimos 30 días)
David
David el 23 de Jun. de 2015
Comentada: David el 24 de Jun. de 2015
Hi,
I'm using trimesh to plot a triangular mesh having all nodal positions stored in x,y,z and a corresponding nodal connection vector in Tri, generating a mesh following the trimesh-command as:
m = trimesh(Tri,X,Y,Z);
I understand how to use the handle m to change e.g. 'FaceColor' and 'EdgeColor' to a specific RGB-value. However, now I would like to color specific elements differently from the whole mesh. I.e. I have a list of all nodal points 'belonging' to a specific color and would like to somehow fix that using the trimesh-handle.
Anyone have an idea on how to achieve that?

Respuesta aceptada

Kelly Kearney
Kelly Kearney el 23 de Jun. de 2015
I think the easiest way to do this would be to simply create two separate meshes, one that includes all points and one that only includes the ones you want to treat specially.
[x,y] = meshgrid(1:15,1:15);
tri = delaunay(x,y);
z = peaks(15);
isspecial = rand(size(tri,1),1) < 0.1;
trimesh(tri,x,y,z, 'facecolor', 'interp', 'edgecolor', 'k')
hold on
trimesh(tri(isspecial,:),x,y,z, 'facecolor', 'r')
  1 comentario
David
David el 24 de Jun. de 2015
Thanks Kelly! That was exactly was I was looking for! Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by