annotate scripts/plot/draw/patch.m @ 31549:ed7b17c7ddf3 stable

maint: Strip trailing spaces and add missing EOL to all files. * README, NEWS.6.md, RELEASE_CHECKLIST.md, README.md, besselj.cc, Array.h, LSODE.cc, set.m, audiorecorder.m, play.m, set.m, patch.m: Strip trailing spaces. * command-widget.cc, led-indicator.cc, led-indicator.h: Add missing EOL to files.
author Rik <rik@octave.org>
date Fri, 25 Nov 2022 21:38:22 -0800
parents 36d940c58c2e
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29359
diff changeset
3 ## Copyright (C) 2005-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27898
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
7 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
8 ## This file is part of Octave.
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22518
diff changeset
13 ## (at your option) any later version.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
14 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22518
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22518
diff changeset
18 ## GNU General Public License for more details.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
19 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6988
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24432
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
25
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
27 ## @deftypefn {} {} patch ()
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
28 ## @deftypefnx {} {} patch (@var{x}, @var{y}, @var{c})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
29 ## @deftypefnx {} {} patch (@var{x}, @var{y}, @var{z}, @var{c})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
30 ## @deftypefnx {} {} patch ("Faces", @var{faces}, "Vertices", @var{verts}, @dots{})
30634
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
31 ## @deftypefnx {} {} patch (@dots{}, "@var{prop}", @var{val}, @dots{})
22518
e15b89c4c2dd patch.m: Update docstring and demo (bug #47672)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22323
diff changeset
32 ## @deftypefnx {} {} patch (@dots{}, @var{propstruct}, @dots{})
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
33 ## @deftypefnx {} {} patch (@var{hax}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19697
diff changeset
34 ## @deftypefnx {} {@var{h} =} patch (@dots{})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
35 ## Create patch object in the current axes with vertices at locations
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
36 ## (@var{x}, @var{y}) and of color @var{c}.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
37 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
38 ## If the vertices are matrices of size @nospell{MxN} then each polygon patch
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
39 ## has M vertices and a total of N polygons will be created. If some polygons
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
40 ## do not have M vertices use NaN to represent "no vertex". If the @var{z}
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
41 ## input is present then 3-D patches will be created.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
42 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
43 ## The color argument @var{c} can take many forms. To create polygons
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
44 ## which all share a single color use a string value (e.g., @qcode{"r"} for
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
45 ## red), a scalar value which is scaled by @code{caxis} and indexed into the
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
46 ## current colormap, or a 3-element RGB vector with the precise TrueColor.
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6807
diff changeset
47 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
48 ## If @var{c} is a vector of length N then the ith polygon will have a color
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
49 ## determined by scaling entry @var{c}(i) according to @code{caxis} and then
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
50 ## indexing into the current colormap. More complicated coloring situations
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
51 ## require directly manipulating patch property/value pairs.
9110
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
52 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
53 ## Instead of specifying polygons by matrices @var{x} and @var{y}, it is
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
54 ## possible to present a unique list of vertices and then a list of polygon
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
55 ## faces created from those vertices. In this case the
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
56 ## @qcode{"Vertices"} matrix will be an @nospell{Nx2} (2-D patch) or
21393
2e21387ce06b patch.m: Fix typo in docstring.
Rik <rik@octave.org>
parents: 19697
diff changeset
57 ## @nospell{Nx3} (3-D patch). The @nospell{MxN} @qcode{"Faces"} matrix
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
58 ## describes M polygons having N vertices---each row describes a
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
59 ## single polygon and each column entry is an index into the
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
60 ## @qcode{"Vertices"} matrix to identify a vertex. The patch object
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
61 ## can be created by directly passing the property/value pairs
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
62 ## @qcode{"Vertices"}/@var{verts}, @qcode{"Faces"}/@var{faces} as
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17190
diff changeset
63 ## inputs.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
64 ##
22518
e15b89c4c2dd patch.m: Update docstring and demo (bug #47672)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22323
diff changeset
65 ## Instead of using property/value pairs, any property can be set by passing a
e15b89c4c2dd patch.m: Update docstring and demo (bug #47672)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22323
diff changeset
66 ## structure @var{propstruct} with the respective field names.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
67 ##
24431
0c6cedafc71e doc: Use 'axes' rather than 'axis' appropriately in docstrings.
Rik <rik@octave.org>
parents: 23219
diff changeset
68 ## If the first argument @var{hax} is an axes handle, then plot into this axes,
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
69 ## rather than the current axes returned by @code{gca}.
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
70 ##
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
71 ## The optional return value @var{h} is a graphics handle to the created patch
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
72 ## object.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
73 ##
24551
a7b6502b5cb5 doc: Add @ref from graphic object creation functions to list of graphic properties (bug #52816).
Rik <rik@octave.org>
parents: 24534
diff changeset
74 ## Programming Note: The full list of properties is documented at
28093
05c1217d0dae doc: Create better looking cross references in Info format (bug #57845).
Rik <rik@octave.org>
parents: 27923
diff changeset
75 ## @ref{Patch Properties}. Useful patch properties include:
24551
a7b6502b5cb5 doc: Add @ref from graphic object creation functions to list of graphic properties (bug #52816).
Rik <rik@octave.org>
parents: 24534
diff changeset
76 ## @qcode{"cdata"}, @qcode{"edgecolor"}, @qcode{"facecolor"}, @qcode{"faces"},
a7b6502b5cb5 doc: Add @ref from graphic object creation functions to list of graphic properties (bug #52816).
Rik <rik@octave.org>
parents: 24534
diff changeset
77 ## and @qcode{"facevertexcdata"}.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
78 ## @seealso{fill, get, set}
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
79 ## @end deftypefn
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
80
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
81 function h = patch (varargin)
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
82
17039
854cfc72c64f patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 14363
diff changeset
83 [hax, varargin] = __plt_get_axis_arg__ ("patch", varargin{:});
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
84
30634
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
85 if (! isempty (hax))
18821
87c3848cf3c0 Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents: 18768
diff changeset
86 hax = hax(1);
31549
ed7b17c7ddf3 maint: Strip trailing spaces and add missing EOL to all files.
Rik <rik@octave.org>
parents: 30634
diff changeset
87 endif
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
88
30634
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
89 htmp = __patch__ (hax, varargin{:});
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
90
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
91 if (nargout > 0)
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17039
diff changeset
92 h = htmp;
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
93 endif
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
94
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
95 endfunction
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
96
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
97
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
98 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
99 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
100 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
101 %! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
102 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
103 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
104 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
105 %! y2 = cos (t2);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
106 %! patch ([x1,x2], [y1,y2], "r");
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
107 %! title ("patches with same number of vertices");
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
108
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
109 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
110 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
111 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
112 %! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
113 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
114 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
115 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
116 %! y2 = cos (t2);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
117 %! patch ([[x1;NaN(8,1)],x2], [[y1;NaN(8,1)],y2], "r");
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
118 %! title ("Unclosed patch by using NaN");
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
119
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
120 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
121 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
122 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
123 %! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
124 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
125 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
126 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
127 %! y2 = cos (t2);
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
128 %! vert = [x1, y1; x2, y2];
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
129 %! fac = [1:8,NaN(1,8);9:24];
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
130 %! patch ("Faces",fac, "Vertices",vert, "FaceColor","r");
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
131 %! title ("patch() with separate specification of Faces and Vertices");
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
132
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
133 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
134 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
135 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
136 %! t2 = ((1/16:1/16:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
137 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
138 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
139 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
140 %! y2 = cos (t2);
9110
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
141 %! vert = [x1, y1; x2, y2];
22518
e15b89c4c2dd patch.m: Update docstring and demo (bug #47672)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22323
diff changeset
142 %! p.Faces = [1:8,NaN(1,8);9:24];
e15b89c4c2dd patch.m: Update docstring and demo (bug #47672)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22323
diff changeset
143 %! p.FaceColor = "flat";
e15b89c4c2dd patch.m: Update docstring and demo (bug #47672)
Markus Mützel <markus.muetzel@gmx.de>
parents: 22323
diff changeset
144 %! patch (p, 'Vertices', vert, 'FaceVertexCData', [0, 1, 0; 0, 0, 1]);
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
145 %! title ("patch() with specification of color for each vertex");
9110
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
146
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
147 %!demo
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
148 %! ## Property change on multiple patches
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
149 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
150 %! t1 = (1/16:1/8:1)' * 2*pi;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
151 %! t2 = ((1/16:1/8:1)' + 1/32) * 2*pi;
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
152 %! x1 = sin (t1) - 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
153 %! y1 = cos (t1);
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
154 %! x2 = sin (t2) + 0.8;
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
155 %! y2 = cos (t2);
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
156 %! h = patch ([x1,x2], [y1,y2], cat (3, [0,0],[1,0],[0,1]));
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
157 %! pause (1);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
158 %! set (h, "FaceColor", "r");
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
159 %! title ("change color on multiple patch() objects");
9110
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
160
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
161 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
162 %! clf;
9110
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
163 %! vertices = [0, 0, 0;
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
164 %! 1, 0, 0;
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
165 %! 1, 1, 0;
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
166 %! 0, 1, 0;
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
167 %! 0.5, 0.5, 1];
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
168 %! faces = [1, 2, 5;
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
169 %! 2, 3, 5;
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
170 %! 3, 4, 5;
22ae6b3411a7 Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents: 8920
diff changeset
171 %! 4, 1, 5];
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
172 %! patch ("Vertices", vertices, "Faces", faces, ...
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
173 %! "FaceVertexCData", jet (4), "FaceColor", "flat");
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
174 %! view (-37.5, 30);
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
175 %! box off;
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
176 %! title ('"FaceColor" = "flat"');
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
177
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
178 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
179 %! clf;
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
180 %! vertices = [0, 0, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
181 %! 1, 0, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
182 %! 1, 1, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
183 %! 0, 1, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
184 %! 0.5, 0.5, 1];
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
185 %! faces = [1, 2, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
186 %! 2, 3, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
187 %! 3, 4, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
188 %! 4, 1, 5];
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
189 %! patch ("Vertices", vertices, "Faces", faces, ...
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
190 %! "FaceVertexCData", jet (5), "FaceColor", "interp");
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
191 %! view (-37.5, 30);
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
192 %! box off;
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
193 %! title ('"FaceColor" = "interp"');
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
194
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
195 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
196 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
197 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
198 %! x = [0 1 1 0];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
199 %! y = [0 0 1 1];
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
200 %! subplot (2,1,1);
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
201 %! title ("Blue, Light Green, and Red Horizontal Bars");
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
202 %! patch (x, y + 0, 1);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
203 %! patch (x, y + 1, 2);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
204 %! patch (x, y + 2, 3);
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
205 %! subplot (2,1,2);
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 22302
diff changeset
206 %! title ("Blue, Light Green, and Red Vertical Bars");
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
207 %! patch (x + 0, y, 1 * ones (size (x)));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
208 %! patch (x + 1, y, 2 * ones (size (x)));
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
209 %! patch (x + 2, y, 3 * ones (size (x)));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
210
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
211 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
212 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
213 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
214 %! x = [0 1 1 0];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
215 %! y = [0 0 1 1];
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
216 %! subplot (2,1,1);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
217 %! title ("Blue horizontal bars: Dark to Light");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
218 %! patch (x, y + 0, 1, "cdatamapping", "direct");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
219 %! patch (x, y + 1, 9, "cdatamapping", "direct");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
220 %! patch (x, y + 2, 17, "cdatamapping", "direct");
14363
f3d52523cde1 Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents: 14359
diff changeset
221 %! subplot (2,1,2);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
222 %! title ("Blue vertical bars: Dark to Light");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
223 %! patch (x + 0, y, 1 * ones (size (x)), "cdatamapping", "direct");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
224 %! patch (x + 1, y, 9 * ones (size (x)), "cdatamapping", "direct");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
225 %! patch (x + 2, y, 17 * ones (size (x)), "cdatamapping", "direct");
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
226
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
227 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
228 %! clf;
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
229 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
230 %! x = [ 0 0; 1 1; 1 0 ];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
231 %! y = [ 0 0; 0 1; 1 1 ];
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
232 %! p = patch (x, y, "b");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
233 %! set (p, "cdatamapping", "direct", "facecolor", "flat", "cdata", [1 32]);
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
234 %! title ("Direct mapping of colors: Light-Green UL and Blue LR triangles");
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
235
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
236 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
237 %! clf;
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
238 %! colormap (jet (64));
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
239 %! x = [ 0 0; 1 1; 1 0 ];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
240 %! y = [ 0 0; 0 1; 1 1 ];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
241 %! p = patch (x, y, [1 32]);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21394
diff changeset
242 %! title ("Autoscaling of colors: Red UL and Blue LR triangles");
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
243
25418
762eb2e33a7f Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 25329
diff changeset
244 %!demo
762eb2e33a7f Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 25329
diff changeset
245 %! clf;
28383
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
246 %! vertices = [0 0 0; 0.5 -0.5 0; 1 0 0; 1 1 0; 0 1 1; 1 0 1; 0 -1 0] + 3;
25418
762eb2e33a7f Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 25329
diff changeset
247 %! faces = [1 2 3 4 5 6 7];
762eb2e33a7f Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 25329
diff changeset
248 %! ha = axes ();
28383
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
249 %! hp = patch ("Vertices", vertices, "Faces", faces, "FaceColor", "g");
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
250 %! xlabel ("x"), ylabel ("y"), zlabel ("z");
28912
0de38a6ef693 maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents: 28892
diff changeset
251 %! view (3);
28383
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
252 %! set (ha, "XTick", [], "YTick", [], "ZTick", []);
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
253 %! text (vertices(1,1), vertices(1,2), vertices(1,3), "1");
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
254 %! text (vertices(2,1), vertices(2,2), vertices(2,3), "2");
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
255 %! text (vertices(3,1), vertices(3,2), vertices(3,3), "3");
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
256 %! text (vertices(4,1), vertices(4,2), vertices(4,3), "4");
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
257 %! text (vertices(5,1), vertices(5,2), vertices(5,3), "5");
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
258 %! text (vertices(6,1), vertices(6,2), vertices(6,3), "6");
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
259 %! text (vertices(7,1), vertices(7,2), vertices(7,3), "7");
fd0789e075bf patch.m: Don't force zlim to manual mode (bug #58228).
Rik <rik@octave.org>
parents: 28093
diff changeset
260 %! title ("Non-coplanar patch");
25418
762eb2e33a7f Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 25329
diff changeset
261
762eb2e33a7f Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 25329
diff changeset
262
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
263 %!test
13124
2ea1658ad049 Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents: 13115
diff changeset
264 %! hf = figure ("visible", "off");
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 13124
diff changeset
265 %! unwind_protect
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
266 %! h = patch ();
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
267 %! assert (findobj (hf, "type", "patch"), h);
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
268 %! assert (get (h, "xdata"), [0; 1; 0], eps);
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
269 %! assert (get (h, "ydata"), [1; 1; 0], eps);
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
270 %! assert (isempty (get (h, "zdata")));
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13811
diff changeset
271 %! assert (isempty (get (h, "cdata")));
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
272 %! assert (get (h, "faces"), [1, 2, 3], eps);
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
273 %! assert (get (h, "vertices"), [0 1; 1 1; 0 0], eps);
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
274 %! assert (get (h, "facenormalsmode"), "auto");
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
275 %! assert (get (h, "facenormals"), get (0, "defaultpatchfacenormals"));
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
276 %! assert (get (h, "vertexnormalsmode"), "auto");
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
277 %! assert (get (h, "vertexnormals"), get (0, "defaultpatchvertexnormals"));
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
278 %! assert (get (h, "type"), "patch");
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
279 %! assert (get (h, "facecolor"), [0 0 0]);
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
280 %! assert (get (h, "linestyle"), get (0, "defaultpatchlinestyle"));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
281 %! assert (get (h, "linewidth"), get (0, "defaultpatchlinewidth"), eps);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
282 %! assert (get (h, "marker"), get (0, "defaultpatchmarker"));
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
283 %! assert (get (h, "markersize"), get (0, "defaultpatchmarkersize"));
28892
3cac3ceb9629 maint: Use coding style with parentheses after function name to distinguish from a variable.
Rik <rik@octave.org>
parents: 28383
diff changeset
284 %! hl = light ();
25425
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
285 %! assert (get (h, "facelighting"), "flat");
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
286 %! assert (get (h, "facenormals"), [0 0 1], eps);
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
287 %! assert (get (h, "vertexnormals"), []);
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
288 %! set (h, "facelighting", "gouraud")
107920dd7715 Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25418
diff changeset
289 %! assert (get (h, "vertexnormals"), [0 0 1; 0 0 1; 0 0 1], eps);
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
290 %! unwind_protect_cleanup
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
291 %! close (hf);
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12533
diff changeset
292 %! end_unwind_protect
13247
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
293
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
294 %!test
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
295 %! hf = figure ("visible", "off");
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
296 %! c = 0.9;
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
297 %! unwind_protect
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
298 %! h = patch ([0 1 0], [0 1 1], c);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
299 %! assert (get (gca, "clim"), [c - 1, c + 1]);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
300 %! h = patch ([0 1 0], [0 1 1], 2 * c);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
301 %! assert (get (gca, "clim"), [c, 2 * c]);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
302 %! unwind_protect_cleanup
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
303 %! close (hf);
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
304 %! end_unwind_protect
30634
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
305
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
306 ## Test input validation
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
307 %!error <invalid color specification C> patch (1, 1, 'x')
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
308 %!error <invalid TrueColor data C> patch (1, 1, rand (1,2,3))
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
309 %!error <size of X, Y, and C must be equal> patch (1, 1, [1, 2])
36d940c58c2e Improve input validation for patch function (bug #61782)
Rik <rik@octave.org>
parents: 30564
diff changeset
310 %!error <invalid color specification C> patch (1, 1, {1})