next up previous
Next: Drawing surfaces defined by Up: 2D and 3D plotting Previous: Combining subplots in a

Drawing surfaces defined by facets

deff('[x,y,z]=sph(alp,tet)',['x=r*cos(alp).*cos(tet)+orig(1)*ones(tet)';
                             'y=r*cos(alp).*sin(tet)+orig(2)*ones(tet)';
                             'z=r*sin(alp)+orig(3)*ones(tet)']);
r=1;orig=[0 0 0];
[x1,y1,z1]=eval3dp(sph,linspace(-%pi/2,%pi/2,40),linspace(0,%pi*2,20));
[n1,m1]=size(x1);
r=1/2;orig=[-1 0 0];
[x2,y2,z2]=eval3dp(sph,linspace(-%pi/2,%pi/2,40),linspace(0,%pi*2,20));
[n2,m2]=size(x2);
// Merge of surface 1 and 2
x=[x1 x2];y=[y1 y2];z=[z1 z2];
plot3d(x,y,z);
\fbox{\epsfig{file=foo0_28.eps,width=3.75in}}

Scilab group