Graphics Programs Reference
In-Depth Information
xt = [0 1 .5];
yt=[00 1];
zt=[00 1];
clf
patch(xt,yt,zt,'y')
view(3)
box
xyz
1
0.5
0
1
0.5
0.5
y
0
0
x
Remember that patch is a low-level graphics function, so we must set
the view to three dimensional by hand.
A plane is defined by three points, but four points need not lie in a
plane. In such a case the patch may look a bit strange, depending on
the viewing angle:
x=[0110];
y=[0011];
z=[0001];
clf
subplot(221)
patch(x,y,z,'y')
view(-40,10);box;xyz
subplot(222)
patch(x,y,z,'y')
view(33,30);box;xyz
1
1
0.5
0.5
1
0
0
0
0.5
1
0.5
0.5
0.5
0
0
1
0
y
y
x
x
Three-dimensional patches should be planar. The above case, for exam-
ple, is better done as two patches:
x1 = [0 1 1];y1 = [0 0 1];z1 = [0 0 0];
x2 = [0 1 0];y2 = [0 1 1];z2 = [0 0 1];
clf
subplot(221)
patch(x1,y1,z1,'y')
patch(x2,y2,z2,'y')
view(-40,10);box;xyz
subplot(222)
patch(x1,y1,z1,'y')
patch(x2,y2,z2,'y')
view(33,30);box;xyz
1
1
0.5
0.5
1
0
0
0
0.5
1
0.5
0.5
0.5
0
0
1
0
y
y
x
x
Complex three-dimensional objects should be built up using non-
intersectingthree-dimensionalpatches. Thesecanbedrawnwithasingle
call to the patch function, in which x , y , and z are matrices. Each col-
umnofthematrixwilldefineaface. Forexample, considerthetriangular
pyramid:
Search WWH ::

Custom Search