~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to man/graphics/plot3d.cat

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
plot3d            Scilab Group            Scilab Function            plot3d
 
2
NAME
 
3
   plot3d - 3D plot of a surface
 
4
  
 
5
CALLING SEQUENCE
 
6
 plot3d(x,y,z,[theta,alpha,leg,flag,ebox])
 
7
 plot3d(x,y,z,<opt_args>)
 
8
 
 
9
 plot3d(xf,yf,zf,[theta,alpha,leg,flag,ebox])
 
10
 plot3d(xf,yf,zf,<opt_args>)
 
11
 
 
12
 plot3d(xf,yf,list(zf,colors),[theta,alpha,leg,flag,ebox])
 
13
 plot3d(xf,yf,list(zf,colors),<opt_args>)
 
14
PARAMETERS
 
15
 x,y           : row vectors of sizes n1 and n2 (x-axis and y-axis
 
16
               coordinates). These coordinates must be monotone.
 
17
               
 
18
 z             : matrix of size (n1,n2). z(i,j) is the value of the
 
19
               surface at the point (x(i),y(j)).
 
20
               
 
21
 xf,yf,zf      : matrices of size (nf,n).  They define the facets used to
 
22
               draw the surface. There are n facets. Each facet i is
 
23
               defined by a polygon with nf points.  The x-axis, y-axis and
 
24
               z-axis coordinates of the points of the ith facet are given
 
25
               respectively by xf(:,i), yf(:,i) and zf(:,i).
 
26
               
 
27
 colors        : a vector of size n giving the color of each facets or a
 
28
               matrix of size (nf,n) giving color near each facet boundary
 
29
               (facet color is interpolated ) 
 
30
               
 
31
 <opt_args>    : This represents a sequence of statements key1=value1,
 
32
               key2=value2,... where key1, key2,... can be one of the
 
33
               following: theta, alpha ,leg,flag,ebox (see definition
 
34
               below) 
 
35
               
 
36
 theta, alpha  : real values giving in degree the spherical coordinates of
 
37
                the observation point.
 
38
               
 
39
 leg           : string defining the captions for each axis with @ as a
 
40
               field separator, for example "X@Y@Z".
 
41
               
 
42
 flag          : a real vector of size three flag=[mode,type,box].
 
43
               
 
44
              mode  : string (treatment of hidden parts).
 
45
                    
 
46
                   mode>0
 
47
                                           the hidden parts of the surface are removed and the
 
48
                        surface is painted  with color mode.
 
49
                        
 
50
                   mode=0
 
51
                                           the hidden parts of the surface are drawn.
 
52
                        
 
53
                   mode<0
 
54
                                           only the shadow of the surface is painted with color or
 
55
                        pattern id -mode. Use xset() to see the meaning of
 
56
                        the ids.
 
57
                        
 
58
              type  : an integer (scaling).
 
59
                    
 
60
                   type=0   the plot is made using the current 3D scaling
 
61
                            (set by a previous call to param3d, plot3d,
 
62
                            contour or plot3d1).
 
63
                            
 
64
                   type=1   rescales automatically 3d boxes with extreme
 
65
                            aspect ratios, the boundaries are specified by
 
66
                            the value of the optional argument ebox.
 
67
                            
 
68
                   type=2   rescales automatically 3d boxes with extreme
 
69
                            aspect ratios, the boundaries are computed
 
70
                            using the given data.
 
71
                            
 
72
                   type=3   3d isometric with box bounds given by optional
 
73
                            ebox, similarily to type=1
 
74
                            
 
75
                   type=4   3d isometric bounds  derived from the data, to
 
76
                            similarilytype=2
 
77
                            
 
78
                   type=5   3d expanded isometric bounds  with box bounds
 
79
                            given by optional ebox, similarily to type=1
 
80
                            
 
81
                   type=6   3d expanded isometric bounds  derived from the
 
82
                            data, similarily to type=2
 
83
                            
 
84
              box   : an integer (frame around the plot).
 
85
                    
 
86
                   box=0
 
87
                                           nothing is drawn around the plot.
 
88
                        
 
89
                   box=1
 
90
                                           unimplemented (like box=0).
 
91
                        
 
92
                   box=2
 
93
                                           only the axes behind the surface are drawn.
 
94
                        
 
95
                   box=3
 
96
                                           a box surrounding the surface is drawn and captions are
 
97
                        added.
 
98
                        
 
99
                   box=4
 
100
                                           a box surrounding the surface is drawn, captions and
 
101
                        axes are added.
 
102
                        
 
103
 ebox          : used when type in flag is 1. It specifies the boundaries
 
104
               of the plot as the vector [xmin,xmax,ymin,ymax,zmin,zmax].
 
105
               
 
106
DESCRIPTION
 
107
   plot3d(x,y,z,[theta,alpha,leg,flag,ebox]) draws the surface z=f(x,y).
 
108
  
 
109
   plot3d(xf,yf,zf,[theta,alpha,leg ,flag,ebox]) draws a surface defined by
 
110
  a set of facets. You can draw multiple plots by replacing xf, yf and zf
 
111
  by multiple matrices assembled by rows as [xf1 xf2 ...], [yf1 yf2 ...]
 
112
  and [zf1 zf2 ...].
 
113
  
 
114
   You can give a specific  color for each facet by using list(zf,colors)
 
115
  instead of zf, where colors is a vector of size n. If colors(i) is
 
116
  positive it gives the color of facet i and the boundary of the facet is
 
117
  drawn with current line style and color. If colors(i) is negative, color
 
118
  id -colors(i) is used and the boundary of the facet is not drawn. Use
 
119
  xset() to see the ids of the colors. 
 
120
  
 
121
   It is also possible to get interpolated color for facets. For that the
 
122
  color argument must be a matrix of size nfxn giving the color near each
 
123
  boundary of each facets. In this case positive values for colors mean
 
124
  that the boundary are not drawn.
 
125
  
 
126
   The optional arguments theta,alpha,leg ,flag,ebox, can be passed by a
 
127
  sequence of statements key1=value1, key2=value2, ... In this case, the
 
128
  order has no special meaning.  
 
129
  
 
130
   You can use the function genfac3d to compute four sided facets from the
 
131
  surface z=f(x,y). eval3dp can also be used.  Enter the command  plot3d()
 
132
  to see a demo.
 
133
  
 
134
EXAMPLE
 
135
 // simple plot using z=f(x,y)
 
136
 t=[0:0.3:2*%pi]'; z=sin(t)*cos(t');
 
137
 plot3d(t,t,z)
 
138
 // same plot using facets computed by genfac3d
 
139
 [xx,yy,zz]=genfac3d(t,t,z);
 
140
 xbasc()
 
141
 plot3d(xx,yy,zz)
 
142
 // multiple plots
 
143
 xbasc()
 
144
 plot3d([xx xx],[yy yy],[zz 4+zz])
 
145
 // multiple plots using colors
 
146
 xbasc()
 
147
 plot3d([xx xx],[yy yy],list([zz zz+4],[4*ones(1,400) 5*ones(1,400)]))
 
148
 // simple plot with viewpoint and captions
 
149
 xbasc()
 
150
 plot3d(1:10,1:20,10*rand(10,20),35,45,"X@Y@Z",[2,2,3])
 
151
 // plot of a sphere using facets computed by eval3dp
 
152
 deff("[x,y,z]=sph(alp,tet)",["x=r*cos(alp).*cos(tet)+orig(1)*ones(tet)";..
 
153
   "y=r*cos(alp).*sin(tet)+orig(2)*ones(tet)";..
 
154
   "z=r*sin(alp)+orig(3)*ones(tet)"]);
 
155
 r=1; orig=[0 0 0];
 
156
 [xx,yy,zz]=eval3dp(sph,linspace(-%pi/2,%pi/2,40),linspace(0,%pi*2,20));
 
157
 xbasc();plot3d(xx,yy,zz)
 
158
 
 
159
 xbasc();xset('colormap',hotcolormap(128));
 
160
 r=0.3;orig=[1.5 0 0];
 
161
 [xx1,yy1,zz1]=eval3dp(sph,linspace(-%pi/2,%pi/2,40),linspace(0,%pi*2,20));
 
162
 cc=(xx+zz+2)*32;cc1=(xx1-orig(1)+zz1/r+2)*32;   
 
163
 xbasc();plot3d1([xx xx1],[yy yy1],list([zz,zz1],[cc cc1]),70,80)
 
164
 
 
165
 xbasc();plot3d1([xx xx1],[yy yy1],list([zz,zz1],[cc cc1]),theta=70,alpha=80,flag=[5,6,3])
 
166
SEE ALSO
 
167
   eval3dp, genfac3d, geom3d, param3d, plot3d1, xset
 
168
  
 
169
AUTHOR
 
170
   J.Ph.C.
 
171