Graphics Programs Reference
In-Depth Information
xt = x([1 9 10 1]);
yt = y([1 9 10 1]);
xh = x(3:7);
yh = y(3:7);
hold on
plot(xt,yt,'k',xh,yh,'k')
Overlapping patches are drawn in order:
1
0.8
0.6
0.4
0.2
0
0
0.5
1
x1=[0110];
y1=[0011];
x2=x1+.5;
y2=y1+.5;
clf
subplot(221)
patch(x1,y1,'y')
patch(x2,y2,'y')
subplot(222)
patch(x2,y2,'y')
patch(x1,y1,'y')
When patches with holes overlap, the one underneath shows through the
hole:
x = [0 .5 .5 .4 .5 .6 .5 .5 1 .5];
y = [0 0 .1 .2 .3.2 .1 0 0 1];
x1=x+.5;
y1=y+.2;
clf
patch(x1,y1,'r')
patch(x,y,'y')
1.5
1.5
1
1
0.5
0.5
0
0
0
0.5
1
1.5
0
0.5
1
1.5
1.5
1
0.5
0
0
0.5
1
1.5
Patches defined by vectors that contain NaN s leave a gap in the edge at
the NaN point and leave the enclosed region unfilled:
t = linspace(0,2*pi,10);
x = cos(t);y = sin(t);
subplot(221)
patch(x,y,'y')
x(5) = NaN;y(5) = NaN;
subplot(222)
patch(x,y,'y')
1
1
0.5
0.5
0
0
−0.5
−0.5
−1
−1
−1
0
1
−1
0
1
Three-dimensional Patches
Three-dimensional patches are produced by giving the patch command
x , y , and z data. The following generates an inclined triangle:
Search WWH ::




Custom Search