필터 지우기
필터 지우기

Coloring of specific elements using trimesh

조회 수: 11 (최근 30일)
David
David 2015년 6월 23일
댓글: David 2015년 6월 24일
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?

채택된 답변

Kelly Kearney
Kelly Kearney 2015년 6월 23일
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
David
David 2015년 6월 24일
Thanks Kelly! That was exactly was I was looking for! Thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by