annotate scripts/plot/cylinder.m @ 13141:e81ddf9cacd5

maint: untabify and remove trailing whitespace from source files * bicg.m, gmres.m, pkg.m: Untabify and remove trailing whitespace. * libcruft/Makefile.am, libcruft/blas-xtra/cdotc3.f, libcruft/blas-xtra/cmatm3.f, libcruft/blas-xtra/ddot3.f, libcruft/blas-xtra/dmatm3.f, libcruft/blas-xtra/sdot3.f, libcruft/blas-xtra/smatm3.f, libcruft/blas-xtra/zdotc3.f, libcruft/blas-xtra/zmatm3.f, libcruft/lapack-xtra/crsf2csf.f, libcruft/lapack-xtra/zrsf2csf.f, liboctave/Array.cc, liboctave/DASPK-opts.in, liboctave/DASRT-opts.in, liboctave/DASSL-opts.in, liboctave/LSODE-opts.in, liboctave/Makefile.a,mliboctave/Quad-opts.in, liboctave/Sparse-perm-op-defs.h, scripts/Makefile.a,mscripts/deprecated/glpkmex.m, scripts/general/blkdiag.m, scripts/general/interp1.m, scripts/general/profshow.m, scripts/general/quadl.m, scripts/general/triplequad.m, scripts/help/__makeinfo__.m, scripts/io/strread.m, scripts/io/textread.m, scripts/io/textscan.m, scripts/linear-algebra/rank.m, scripts/miscellaneous/gzip.m, scripts/miscellaneous/private/__xzip__.m, scripts/miscellaneous/tempdir.m, scripts/miscellaneous/unpack.m, scripts/pkg/pkg.m, scripts/plot/allchild.m, scripts/plot/ancestor.m, scripts/plot/cla.m, scripts/plot/clf.m, scripts/plot/findall.m, scripts/plot/findobj.m, scripts/plot/gca.m, scripts/plot/gcf.m, scripts/plot/hggroup.m, scripts/plot/isfigure.m, scripts/plot/ishghandle.m, scripts/plot/legend.m, scripts/plot/line.m, scripts/plot/loglog.m, scripts/plot/patch.m, scripts/plot/print.m, scripts/plot/private/__quiver__.m, scripts/plot/private/__scatter__.m, scripts/plot/rectangle.m, scripts/plot/semilogx.m, scripts/plot/semilogy.m, scripts/plot/surface.m, scripts/plot/text.m, scripts/plot/title.m, scripts/plot/trisurf.m, scripts/plot/view.m, scripts/plot/whitebg.m, scripts/plot/xlabel.m, scripts/plot/xlim.m, scripts/plot/ylabel.m, scripts/plot/ylim.m, scripts/plot/zlabel.m, scripts/plot/zlim.m, scripts/polynomial/mkpp.m, scripts/polynomial/polygcd.m, scripts/polynomial/ppint.m, scripts/polynomial/ppjumps.m, scripts/polynomial/ppval.m, scripts/set/setxor.m, scripts/sparse/bicgstab.m, scripts/sparse/cgs.m, scripts/sparse/spconvert.m, scripts/specfun/nthroot.m, scripts/strings/strmatch.m, scripts/strings/untabify.m, scripts/testfun/demo.m, scripts/testfun/example.m, src/DLD-FUNCTIONS/filter.cc, src/DLD-FUNCTIONS/mgorth.cc, src/DLD-FUNCTIONS/quadcc.cc, src/DLD-FUNCTIONS/str2double.cc, src/Makefile.a,msrc/gl-render.cc, src/gl2ps-renderer.cc, src/graphics.cc, src/octave-config.cc.in, src/octave-config.in, src/ov-class.h, src/ov-fcn.h, src/profiler.cc, src/profiler.h, src/pt-binop.cc, src/pt-unop.cc, src/symtab.cc, src/txt-eng-ft.cc: Remove trailing whitespace.
author John W. Eaton <jwe@octave.org>
date Thu, 15 Sep 2011 12:51:10 -0400
parents d0b799dafede
children 22c50cbad2ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 11472
diff changeset
1 ## Copyright (C) 2007-2011 Michael Goffioul and Kai Habel
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
2 ##
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
4 ##
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
9 ##
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
14 ##
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
18
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 10549
diff changeset
20 ## @deftypefn {Function File} {} cylinder
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefnx {Function File} {} cylinder (@var{r})
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
22 ## @deftypefnx {Function File} {} cylinder (@var{r}, @var{n})
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
23 ## @deftypefnx {Function File} {[@var{x}, @var{y}, @var{z}] =} cylinder (@dots{})
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
24 ## @deftypefnx {Function File} {} cylinder (@var{ax}, @dots{})
12575
d0b799dafede Grammarcheck files for 3.4.1 release.
Rik <octave@nomad.inbox5.com>
parents: 12129
diff changeset
25 ## Generate three matrices in @code{meshgrid} format, such that
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
26 ## @code{surf (@var{x}, @var{y}, @var{z})} generates a unit cylinder.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
27 ## The matrices are of size @code{@var{n}+1}-by-@code{@var{n}+1}.
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
28 ## @var{r} is a vector containing the radius along the z-axis.
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
29 ## If @var{n} or @var{r} are omitted then default values of 20 or [1 1]
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
30 ## are assumed.
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
31 ##
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
32 ## Called with no return arguments, @code{cylinder} calls directly
9040
dbd0c77e575e Cleanup documentation file plot.texi
Rik <rdrider0-list@yahoo.com>
parents: 7245
diff changeset
33 ## @code{surf (@var{x}, @var{y}, @var{z})}. If an axes handle @var{ax}
7182
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
34 ## is passed as the first argument, the surface is plotted to this set
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
35 ## of axes.
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
36 ##
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
37 ## Examples:
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
38 ##
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
39 ## @example
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
40 ## @group
7182
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
41 ## [x, y, z] = cylinder (10:-1:0,50);
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
42 ## surf (x, y, z);
12129
80fc70a53400 cylinder.m: Remove console output from demo.
Ben Abbott <bpabbott@mac.com>
parents: 11589
diff changeset
43 ## title ("a cone")
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 9040
diff changeset
44 ## @end group
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
45 ## @end example
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
46 ## @seealso{sphere}
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
47 ## @end deftypefn
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
48
7182
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
49 function [xx, yy, zz] = cylinder (varargin)
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
50
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
51 [ax, args, nargs] = __plt_get_axis_arg__ ((nargout > 0), "cylinder",
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
52 varargin{:});
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
53
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
54 if (nargs == 0)
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
55 n = 20;
7182
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
56 r = [1, 1];
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
57 elseif (nargs == 1)
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
58 n = 20;
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
59 r = args{1};
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
60 elseif (nargs == 2)
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
61 r = args{1};
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
62 n = args{2};
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
63 else
7182
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
64 print_usage ();
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
65 endif
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
66
7182
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
67 if (length (r) < 2)
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
68 error ("cylinder: length(R) must be larger than 2");
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
69 endif
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
70
7182
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
71 phi = linspace (0, 2*pi, n+1);
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
72 idx = 1:length(r);
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
73 [phi, idx] = meshgrid(phi, idx);
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
74 z = (idx - 1) / (length(r) - 1);
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
75 r = r(idx);
7182
71579d54d4b9 [project @ 2007-11-26 18:16:40 by jwe]
jwe
parents: 7181
diff changeset
76 [x, y] = pol2cart (phi, r);
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
77
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
78 if (nargout > 0)
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
79 xx = x;
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
80 yy = y;
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
81 zz = z;
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
82 else
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7187
diff changeset
83 surf (ax, x, y, z);
7181
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
84 endif
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
85
8d0e90d4caf6 [project @ 2007-11-26 18:14:52 by jwe]
jwe
parents:
diff changeset
86 endfunction
7245
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7215
diff changeset
87
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7215
diff changeset
88 %!demo
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7215
diff changeset
89 %! [x, y, z] = cylinder (10:-1:0,50);
d65670971cbc [project @ 2007-12-04 03:03:54 by jwe]
jwe
parents: 7215
diff changeset
90 %! surf (x, y, z);
12129
80fc70a53400 cylinder.m: Remove console output from demo.
Ben Abbott <bpabbott@mac.com>
parents: 11589
diff changeset
91 %! title ("a cone")