Mercurial > octave
annotate scripts/plot/draw/patch.m @ 27923:bd51beb6205e
update formatting of copyright notices
* Use <https://octave.org/copyright/> instead of
<https://octave.org/COPYRIGHT.html/>.
* For consistency with other comments in the Octave sources, use
C++-style comments for copyright blocks in C and C++ files.
* Use delimiters above and below copyright blocks that are appropriate
for the language used in the file.
* Eliminate extra spacing inside copyright blocks.
* lex.ll (looks_like_copyright): Also allow newlines and carriage
returns before the word "Copyright".
* scripts/mk-doc.pl (gethelp): Also skip empty comment lines.
* bp-table.cc, type.m: Adjust tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 08 Jan 2020 11:59:41 -0500 |
parents | 1891570abac8 |
children | 05c1217d0dae |
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 ## |
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
3 ## Copyright (C) 2005-2020 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 | 7 ## |
8 ## This file is part of Octave. | |
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 | 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 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
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 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 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 | 25 |
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{}) |
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
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 | 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 | 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 |
a7b6502b5cb5
doc: Add @ref from graphic object creation functions to list of graphic properties (bug #52816).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
75 ## @ref{Patch Properties,,Patch Properties}. Useful patch properties include: |
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 | 79 ## @end deftypefn |
80 | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17039
diff
changeset
|
81 function h = patch (varargin) |
6807 | 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 |
17039
854cfc72c64f
patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14363
diff
changeset
|
85 if (isempty (hax)) |
854cfc72c64f
patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14363
diff
changeset
|
86 hax = gca (); |
18821
87c3848cf3c0
Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents:
18768
diff
changeset
|
87 else |
87c3848cf3c0
Fix bug when hggroup used with primitive graphic object (bug #42532).
Rik <rik@octave.org>
parents:
18768
diff
changeset
|
88 hax = hax(1); |
17039
854cfc72c64f
patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14363
diff
changeset
|
89 endif |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
90 |
17039
854cfc72c64f
patch.m: Update to use new __plt_get_axis_arg__.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
14363
diff
changeset
|
91 [htmp, failed] = __patch__ (hax, varargin{:}); |
7216 | 92 |
13802
630d3c80b541
allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents:
13299
diff
changeset
|
93 if (failed) |
630d3c80b541
allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents:
13299
diff
changeset
|
94 print_usage (); |
630d3c80b541
allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents:
13299
diff
changeset
|
95 endif |
7020 | 96 |
25606
959657cab846
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
25329
diff
changeset
|
97 ## FIXME: ishold called this way is very slow. |
25329
c8fc547ab5dd
Fix extra figure window pop-up when using waitbar (bug #53778)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
98 if (! ishold (hax)) |
c8fc547ab5dd
Fix extra figure window pop-up when using waitbar (bug #53778)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
99 ## FIXME: This is a hack to get 'layer' command to work for 2D patches |
c8fc547ab5dd
Fix extra figure window pop-up when using waitbar (bug #53778)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
100 ## Alternative is much more complicated surgery in graphics.cc. |
c8fc547ab5dd
Fix extra figure window pop-up when using waitbar (bug #53778)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
101 ## of get_children_limits() for 'z' axis and 'patch' object type. |
18768
75f8926deef1
Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
102 if (isempty (get (htmp, "zdata"))) |
75f8926deef1
Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
103 set (hax, "zlim", [-1 1]); |
75f8926deef1
Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
104 endif |
75f8926deef1
Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
105 endif |
75f8926deef1
Fix Z-order stacking of patches and axes grid lines (bug #40722).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
106 |
6807 | 107 if (nargout > 0) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17039
diff
changeset
|
108 h = htmp; |
6807 | 109 endif |
110 | |
111 endfunction | |
7020 | 112 |
14237
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
113 |
7020 | 114 %!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
|
115 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
116 %! 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
|
117 %! 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
|
118 %! 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
|
119 %! 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
|
120 %! 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
|
121 %! y2 = cos (t2); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
122 %! patch ([x1,x2], [y1,y2], "r"); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
123 %! title ("patches with same number of vertices"); |
7020 | 124 |
125 %!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
|
126 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
127 %! 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
|
128 %! 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
|
129 %! 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
|
130 %! 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
|
131 %! 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
|
132 %! y2 = cos (t2); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
133 %! 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
|
134 %! title ("Unclosed patch by using NaN"); |
7020 | 135 |
136 %!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
|
137 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
138 %! 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
|
139 %! 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
|
140 %! 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
|
141 %! 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
|
142 %! 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
|
143 %! y2 = cos (t2); |
7020 | 144 %! vert = [x1, y1; x2, y2]; |
145 %! fac = [1:8,NaN(1,8);9:24]; | |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
146 %! 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
|
147 %! title ("patch() with separate specification of Faces and Vertices"); |
7020 | 148 |
149 %!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
|
150 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
151 %! 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
|
152 %! 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
|
153 %! 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
|
154 %! 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
|
155 %! 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
|
156 %! 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
|
157 %! 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
|
158 %! 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
|
159 %! p.FaceColor = "flat"; |
e15b89c4c2dd
patch.m: Update docstring and demo (bug #47672)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22323
diff
changeset
|
160 %! 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
|
161 %! 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
|
162 |
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 %!demo |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
164 %! ## 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
|
165 %! clf; |
11949c9795a0
Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
166 %! 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
|
167 %! 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
|
168 %! 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
|
169 %! 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
|
170 %! 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
|
171 %! y2 = cos (t2); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
172 %! h = patch ([x1,x2], [y1,y2], cat (3, [0,0],[1,0],[0,1])); |
7020 | 173 %! pause (1); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
174 %! set (h, "FaceColor", "r"); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
175 %! 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
|
176 |
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
|
177 %!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
|
178 %! 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
|
179 %! 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
|
180 %! 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
|
181 %! 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
|
182 %! 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
|
183 %! 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
|
184 %! 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
|
185 %! 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
|
186 %! 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
|
187 %! 4, 1, 5]; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
188 %! patch ("Vertices", vertices, "Faces", faces, ... |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
189 %! "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
|
190 %! view (-37.5, 30); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
191 %! box off; |
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
192 %! title ('"FaceColor" = "flat"'); |
12533 | 193 |
194 %!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
|
195 %! clf; |
12533 | 196 %! vertices = [0, 0, 0; |
197 %! 1, 0, 0; | |
198 %! 1, 1, 0; | |
199 %! 0, 1, 0; | |
200 %! 0.5, 0.5, 1]; | |
201 %! faces = [1, 2, 5; | |
202 %! 2, 3, 5; | |
203 %! 3, 4, 5; | |
204 %! 4, 1, 5]; | |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
205 %! patch ("Vertices", vertices, "Faces", faces, ... |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
206 %! "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
|
207 %! view (-37.5, 30); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
208 %! box off; |
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
209 %! title ('"FaceColor" = "interp"'); |
12533 | 210 |
13299
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); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
217 %! 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
|
218 %! 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
|
219 %! 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
|
220 %! 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
|
221 %! subplot (2,1,2); |
22312
533c3c4059a3
Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents:
22302
diff
changeset
|
222 %! 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
|
223 %! 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
|
224 %! 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
|
225 %! 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
|
226 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
227 %!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
|
228 %! clf; |
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 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 1 1]; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14359
diff
changeset
|
232 %! subplot (2,1,1); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
233 %! title ("Blue horizontal bars: Dark to Light"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
234 %! patch (x, y + 0, 1, "cdatamapping", "direct"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
235 %! patch (x, y + 1, 9, "cdatamapping", "direct"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
236 %! 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
|
237 %! subplot (2,1,2); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
238 %! title ("Blue vertical bars: Dark to Light"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
239 %! 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
|
240 %! 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
|
241 %! 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
|
242 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
243 %!demo |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
244 %! 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
|
245 %! colormap (jet (64)); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
246 %! 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
|
247 %! y = [ 0 0; 0 1; 1 1 ]; |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
248 %! p = patch (x, y, "b"); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
249 %! set (p, "cdatamapping", "direct", "facecolor", "flat", "cdata", [1 32]); |
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
250 %! 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
|
251 |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
252 %!demo |
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
253 %! 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
|
254 %! colormap (jet (64)); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
255 %! 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
|
256 %! 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
|
257 %! p = patch (x, y, [1 32]); |
22302
1c4cd12987f5
Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents:
21394
diff
changeset
|
258 %! 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
|
259 |
25418
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
260 %!demo |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
261 %! clf; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
262 %! 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; |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
263 %! 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
|
264 %! ha = axes (); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
265 %! hp = patch ('Vertices', vertices, 'Faces', faces, 'FaceColor', 'g'); |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
266 %! xlabel('x'), ylabel('y'), zlabel('z') |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
267 %! view(3) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
268 %! set (ha, "XTick", [], "YTick", [], "ZTick", []) |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
269 %! text (vertices(1,1), vertices(1,2), vertices(1,3), "1") |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
270 %! text (vertices(2,1), vertices(2,2), vertices(2,3), "2") |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
271 %! text (vertices(3,1), vertices(3,2), vertices(3,3), "3") |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
272 %! text (vertices(4,1), vertices(4,2), vertices(4,3), "4") |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
273 %! text (vertices(5,1), vertices(5,2), vertices(5,3), "5") |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
274 %! text (vertices(6,1), vertices(6,2), vertices(6,3), "6") |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
275 %! text (vertices(7,1), vertices(7,2), vertices(7,3), "7") |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
276 %! title ("Non-coplanar patch") |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
277 |
762eb2e33a7f
Enable support of non-coplanar faces in patches for OpenGL (bug #47677).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
25329
diff
changeset
|
278 |
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
|
279 %!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
|
280 %! 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
|
281 %! 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
|
282 %! 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
|
283 %! assert (findobj (hf, "type", "patch"), h); |
13811 | 284 %! assert (get (h, "xdata"), [0; 1; 0], eps); |
285 %! 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
|
286 %! 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
|
287 %! 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
|
288 %! assert (get (h, "faces"), [1, 2, 3], eps); |
13811 | 289 %! 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
|
290 %! 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
|
291 %! 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
|
292 %! 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
|
293 %! 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
|
294 %! assert (get (h, "type"), "patch"); |
13811 | 295 %! 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
|
296 %! 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
|
297 %! 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
|
298 %! 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
|
299 %! assert (get (h, "markersize"), get (0, "defaultpatchmarkersize")); |
25425
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
300 %! hl = light; |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
301 %! 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
|
302 %! 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
|
303 %! assert (get (h, "vertexnormals"), []); |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
304 %! set (h, "facelighting", "gouraud") |
107920dd7715
Automatically calculate normals for patch objects (patch #8951).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25418
diff
changeset
|
305 %! 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
|
306 %! 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
|
307 %! 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
|
308 %! end_unwind_protect |
13247
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
309 |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
310 %!test |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
311 %! hf = figure ("visible", "off"); |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
312 %! c = 0.9; |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
313 %! unwind_protect |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
314 %! 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
|
315 %! 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
|
316 %! 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
|
317 %! assert (get (gca, "clim"), [c, 2 * c]); |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
318 %! unwind_protect_cleanup |
e36c2f4ea8f5
Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents:
13141
diff
changeset
|
319 %! close (hf); |
13299
e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents:
13247
diff
changeset
|
320 %! end_unwind_protect |