annotate scripts/plot/draw/private/__patch__.m @ 19867:9fc020886ae9

maint: Clean up m-files to follow Octave coding conventions. Try to trim long lines to < 80 chars. Use '##' for single line comments. Use '(...)' around tests for if/elseif/switch/while. Abut cell indexing operator '{' next to variable. Abut array indexing operator '(' next to variable. Use space between negation operator '!' and following expression. Use two newlines between endfunction and start of %!test or %!demo code. Remove unnecessary parens grouping between short-circuit operators. Remove stray extra spaces (typos) between variables and assignment operators. Remove stray extra spaces from ends of lines.
author Rik <rik@octave.org>
date Mon, 23 Feb 2015 14:54:39 -0800
parents 4197fc428c7d
children 85dcbed19753
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19630
diff changeset
1 ## Copyright (C) 2007-2015 John W. Eaton, Shai Ayal, Kai Habel
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
2 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
4 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6925
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6925
diff changeset
8 ## your option) any later version.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
9 ##
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
10 ## 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
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
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 ## 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: 6925
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6925
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
18
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
19 ## -*- texinfo -*-
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
20 ## @deftypefn {Function File} {[@var{h}, @var{fail}] =} __patch__ (@var{p}, @dots{})
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6886
diff changeset
21 ## Undocumented internal function.
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8190
diff changeset
22 ## @end deftypefn
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6886
diff changeset
23
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6886
diff changeset
24 ## __patch__ (p, x, y, c)
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6886
diff changeset
25 ## Create patch object from x and y with color c and parent p.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
26 ## Return handle to patch object.
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
27
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
28 ## Author: Kai Habel
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
29
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
30 function [h, failed] = __patch__ (p, varargin)
7191
b48a21816f2e [project @ 2007-11-26 21:24:32 by jwe]
jwe
parents: 7189
diff changeset
31
13954
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
32 h = NaN;
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
33 failed = false;
6885
987a7bf45c99 [project @ 2007-09-10 20:51:09 by jwe]
jwe
parents: 6807
diff changeset
34
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
35 is_numeric_arg = cellfun (@isnumeric, varargin);
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
36
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12931
diff changeset
37 if (isempty (varargin))
18935
df972b9d080a Translate patch property listeners to C++ (bug #42159)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18928
diff changeset
38 args = varargin;
13115
cd808de114c1 Allow surface and patch to be called w/o arguments. Adding and fixing tests.
Kai Habel <kai.habel@gmx.de>
parents: 12931
diff changeset
39 elseif (isstruct (varargin{1}))
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
40 if (isfield (varargin{1}, "vertices") && isfield (varargin{1}, "faces"))
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
41 args{1} = "faces";
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14552
diff changeset
42 args{2} = getfield (varargin{1}, "faces");
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
43 args{3} = "vertices";
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14552
diff changeset
44 args{4} = getfield (varargin{1}, "vertices");
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
45 args{5} = "facevertexcdata";
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
46 if (isfield (varargin{1}, "facevertexcdata"))
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14552
diff changeset
47 args{6} = getfield (varargin{1}, "facevertexcdata");
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
48 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
49 args{6} = [];
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
50 endif
19381
2da8f0c6e8a3 __patch__.m: Fix incorrect concatenation of input args (bug #43670).
Rik <rik@octave.org>
parents: 17744
diff changeset
51 args = [args, varargin(2:end)];
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 else
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
53 failed = true;
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7016
diff changeset
54 endif
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
55 elseif (is_numeric_arg(1))
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
56 if (nargin < 3 || ! is_numeric_arg(2))
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
57 failed = true;
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7016
diff changeset
58 else
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
59 if (nargin > 4 && all (is_numeric_arg(1:4)))
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
60 x = varargin{1};
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
61 y = varargin{2};
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
62 z = varargin{3};
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
63 c = varargin{4};
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
64 iarg = 5;
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
65 elseif (nargin > 3 && all (is_numeric_arg(1:3)))
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
66 x = varargin{1};
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
67 y = varargin{2};
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
68 iarg = 4;
13308
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
69 if (rem (nargin - iarg, 2) == 1)
18307
a97ed15d1ea8 __patch__.m: Follow Octave coding conventions.
Rik <rik@octave.org>
parents: 17744
diff changeset
70 c = varargin{iarg};
13308
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
71 z = varargin{3};
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
72 iarg = 5;
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
73 else
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
74 z = [];
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
75 c = varargin{3};
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
76 endif
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
77 elseif (nargin > 2 && all (is_numeric_arg(1:2)))
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
78 x = varargin{1};
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
79 y = varargin{2};
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
80 z = [];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
81 iarg = 3;
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
82 if (rem (nargin - iarg, 2) == 1)
18307
a97ed15d1ea8 __patch__.m: Follow Octave coding conventions.
Rik <rik@octave.org>
parents: 17744
diff changeset
83 c = varargin{iarg};
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19381
diff changeset
84 iarg++;
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
85 else
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
86 c = [];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
87 endif
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
88 endif
6885
987a7bf45c99 [project @ 2007-09-10 20:51:09 by jwe]
jwe
parents: 6807
diff changeset
89
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
90 if (isvector (x))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
91 x = x(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
92 y = y(:);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
93 z = z(:);
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
94 if (isnumeric (c))
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
95 if (isvector (c) && numel (c) == numel (x))
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
96 c = c(:);
14872
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14868
diff changeset
97 elseif (rows (c) != numel (x) && columns (c) == numel (x))
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
98 c = c.';
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
99 endif
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
100 endif
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
101 endif
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
102 args{1} = "xdata";
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
103 args{2} = x;
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
104 args{3} = "ydata";
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
105 args{4} = y;
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
106 args{5} = "zdata";
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
107 args{6} = z;
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
108
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
109 if (isnumeric (c))
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
110
14872
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14868
diff changeset
111 if (ndims (c) == 3 && columns (c) == 1)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
112 c = permute (c, [1, 3, 2]);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
113 endif
6885
987a7bf45c99 [project @ 2007-09-10 20:51:09 by jwe]
jwe
parents: 6807
diff changeset
114
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
115 if (isvector (c) && numel (c) == columns (x))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
116 if (isnan (c))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
117 args{7} = "facecolor";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
118 args{8} = [1, 1, 1];
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
119 args{9} = "cdata";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
120 args{10} = c;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
121 elseif (isnumeric (c))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
122 args{7} = "facecolor";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
123 args{8} = "flat";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
124 args{9} = "cdata";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
125 args{10} = c;
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
126 else
18307
a97ed15d1ea8 __patch__.m: Follow Octave coding conventions.
Rik <rik@octave.org>
parents: 17744
diff changeset
127 error ("patch: color data C must be numeric");
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
128 endif
13954
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
129 elseif (isvector (c) && numel (c) == 3)
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
130 args{7} = "facecolor";
13808
d5bfaa582eaa correctly handle RGB color spec for patch object
John W. Eaton <jwe@octave.org>
parents: 13779
diff changeset
131 args{8} = c;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
132 args{9} = "cdata";
13808
d5bfaa582eaa correctly handle RGB color spec for patch object
John W. Eaton <jwe@octave.org>
parents: 13779
diff changeset
133 args{10} = [];
13954
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
134 elseif (ndims (c) == 3 && size (c, 3) == 3)
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
135 ## CDATA is specified as RGB data
14872
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14868
diff changeset
136 if ((rows (c) == 1 && columns (c) == 1) ...
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14868
diff changeset
137 || (rows (c) == 1 && columns (c) == columns (x)))
13954
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
138 ## Single patch color or per-face color
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
139 args{7} = "facecolor";
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
140 args{8} = "flat";
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
141 args{9} = "cdata";
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
142 args{10} = c;
14872
c2dbdeaa25df maint: use rows() and columns() to clarify m-files.
Rik <octave@nomad.inbox5.com>
parents: 14868
diff changeset
143 elseif (rows (c) == rows (x) && columns (c) == columns (x))
13954
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
144 ## Per-vertex color
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
145 args{7} = "facecolor";
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
146 args{8} = "interp";
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
147 args{9} = "cdata";
17347
1391dc953ae2 __patch__.m: Fix typo and close bug #34417.
Rik <rik@octave.org>
parents: 17338
diff changeset
148 args{10} = c;
13954
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
149 else
18307
a97ed15d1ea8 __patch__.m: Follow Octave coding conventions.
Rik <rik@octave.org>
parents: 17744
diff changeset
150 error ("patch: Invalid TrueColor data C");
13954
2ebbc6c9961b [Bug #34559] Clean-up __patch__.m and add support for RGB cdata.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13809
diff changeset
151 endif
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
152 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
153 ## Color Vectors
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
154 if (isempty (c))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
155 args{7} = "facecolor";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
156 args{8} = "interp";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
157 args{9} = "cdata";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
158 args{10} = [];
18307
a97ed15d1ea8 __patch__.m: Follow Octave coding conventions.
Rik <rik@octave.org>
parents: 17744
diff changeset
159 elseif (size_equal (c, x) && size_equal (c, y))
13308
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
160 args{7} = "facecolor";
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
161 args{8} = "interp";
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
162 args{9} = "cdata";
9a83ec29aec9 Fix regression introduced by e9f6a6edec42.
Ben Abbott <bpabbott@mac.com>
parents: 13299
diff changeset
163 args{10} = c;
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
164 else
18307
a97ed15d1ea8 __patch__.m: Follow Octave coding conventions.
Rik <rik@octave.org>
parents: 17744
diff changeset
165 error ("patch: size of X, Y, and C must be equal");
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
166 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
167 endif
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13256
diff changeset
168 elseif (ischar (c) && rem (nargin - iarg, 2) == 0)
18307
a97ed15d1ea8 __patch__.m: Follow Octave coding conventions.
Rik <rik@octave.org>
parents: 17744
diff changeset
169 ## Assume any additional argument over an even number is a color string.
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
170 args{7} = "facecolor";
19867
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19731
diff changeset
171 args{8} = tolower (c);
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
172 args{9} = "cdata";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
173 args{10} = [];
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
174 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
175 args{7} = "facecolor";
18928
24332f256940 Set default patch color to black rather than green for Matlab compatibility.
Rik <rik@octave.org>
parents: 18307
diff changeset
176 args{8} = [0, 0, 0];
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
177 args{9} = "cdata";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 10524
diff changeset
178 args{10} = [];
6925
1401a79af68c [project @ 2007-09-26 18:58:52 by dbateman]
dbateman
parents: 6895
diff changeset
179 endif
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
180
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 args = [args, varargin(iarg:end)];
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 endif
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 else
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 args = varargin;
6885
987a7bf45c99 [project @ 2007-09-10 20:51:09 by jwe]
jwe
parents: 6807
diff changeset
185 endif
987a7bf45c99 [project @ 2007-09-10 20:51:09 by jwe]
jwe
parents: 6807
diff changeset
186
19867
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19731
diff changeset
187 if (! failed)
18307
a97ed15d1ea8 __patch__.m: Follow Octave coding conventions.
Rik <rik@octave.org>
parents: 17744
diff changeset
188 h = __go_patch__ (p, args{:});
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
189 endif
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
190 endfunction