필터 지우기
필터 지우기

Patch

조회 수: 5 (최근 30일)
zhiping
zhiping 2011년 6월 8일
hi, I use the command 'patch' to create one or more strip. And I realise this function, but for now I want to add the information associated in the center of each polygon, how can I do? I found nothing similar. Thanks in advance.
Here is the code %%%%%%
figure y=[0 0 1 1;1 1 2 2]'; x=[0 10 10 0;0 10 10 0]'; c=[20 30]'; set(gca,'CLim',[0 40]); p=patch(x,y,''); set(p,'FaceColor','flat','FaceVertexCData',c,'CDataMapping','scaled'); %%%

답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 6월 8일
So you want to be able to see a smaller polygon inside a bigger one?
Use the facealpha and edgealpha properties to make the larger patch object more translucent and the inside one less translucent.
%Rendering overlay example
I1 = false(100,100,100); %First image
I1(10:90,10:90,30:70) = true; %make rectangular part of I true
[xx yy zz] = meshgrid(1:100,1:100,1:100); %second image sphere with radius 10 centered at (50,50,50)
I2 = sqrt((xx-50).^2+(yy-50).^2+(zz-50).^2)<10;
fv1 = isosurface(I1,0); %Make the triangles
fv2 = isosurface(I2,0);
%Blue ball inside light green box
figure; hold on
patch(fv1,'facecolor',[0 1 0],'facealpha',0.3,'edgecolor','none');%[.5 .5 0],'edgealpha',0.3);
patch(fv2,'facecolor',[0 0 1],'facealpha',0.7,'edgecolor','none');
view(19,28)
  댓글 수: 1
zhiping
zhiping 2011년 6월 8일
no, excuse me, I gave few details, there are a part of code
%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure
y=[0 0 1 1;1 1 2 2]';
x=[0 10 10 0;0 10 10 0]';
c=[20 30]';
set(gca,'CLim',[0 40]);
p=patch(x,y,'');
set(p,'FaceColor','flat','FaceVertexCData',c,'CDataMapping','scaled');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I want to write some information associated in the centre of each strip, for example, the width of each strip( different color)... etc

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

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by