annotate scripts/plot/patch.m @ 13811:240d6810204c

update tests for patch * patch.m: Update tests for new default property values.
author John W. Eaton <jwe@octave.org>
date Fri, 04 Nov 2011 04:47:24 -0400
parents 630d3c80b541
children 5f0bb45e615c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
1 ## Copyright (C) 2005-2011 John W. Eaton
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: 6988
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: 6988
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: 6988
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: 6988
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
18
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
10793
be55736a0783 Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents: 9110
diff changeset
20 ## @deftypefn {Function File} {} patch ()
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{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
22 ## @deftypefnx {Function File} {} patch (@var{x}, @var{y}, @var{z}, @var{c})
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
23 ## @deftypefnx {Function File} {} patch (@var{fv})
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
24 ## @deftypefnx {Function File} {} patch ('Faces', @var{f}, 'Vertices', @var{v}, @dots{})
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
25 ## @deftypefnx {Function File} {} patch (@dots{}, @var{prop}, @var{val})
6988
c7484dcadd4d [project @ 2007-10-09 19:58:32 by dbateman]
dbateman
parents: 6895
diff changeset
26 ## @deftypefnx {Function File} {} patch (@var{h}, @dots{})
7650
eb7bdde776f2 Texinfo fixes
John W. Eaton <jwe@octave.org>
parents: 7216
diff changeset
27 ## @deftypefnx {Function File} {@var{h} =} patch (@dots{})
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6807
diff changeset
28 ## Create patch object from @var{x} and @var{y} with color @var{c} and
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6807
diff changeset
29 ## insert in the current axes object. Return handle to patch object.
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6807
diff changeset
30 ##
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6807
diff changeset
31 ## For a uniform colored patch, @var{c} can be given as an RGB vector,
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6807
diff changeset
32 ## scalar value referring to the current colormap, or string value (for
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 ## example, "r" or "red").
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
34 ##
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
35 ## If passed a structure @var{fv} contain the fields "vertices", "faces"
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
36 ## and optionally "facevertexcdata", create the patch based on these
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
37 ## properties.
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
38 ## @end deftypefn
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
39
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
40 ## Author: jwe
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
41
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
42 function retval = patch (varargin)
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
43
7215
dd88d61d443f [project @ 2007-11-29 16:44:45 by jwe]
jwe
parents: 7208
diff changeset
44 [h, varargin] = __plt_get_axis_arg__ ("patch", varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
45
13802
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
46 [tmp, failed] = __patch__ (h, varargin{:});
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
47
13802
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
48 if (failed)
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
49 print_usage ();
630d3c80b541 allow axes handle to be passed to patch function
John W. Eaton <jwe@octave.org>
parents: 13299
diff changeset
50 endif
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
51
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
52 if (nargout > 0)
7216
5389a52df87b [project @ 2007-11-29 19:07:29 by jwe]
jwe
parents: 7215
diff changeset
53 retval = tmp;
6807
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
54 endif
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
55
0089a504fdd6 [project @ 2007-08-10 17:34:59 by jwe]
jwe
parents:
diff changeset
56 endfunction
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
57
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
58 %!demo
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
59 %! ## Patches with same number of vertices
8790
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 7650
diff changeset
60 %! clf
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
61 %! t1 = (1/16:1/8:1)'*2*pi;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
62 %! t2 = ((1/16:1/8:1)' + 1/32)*2*pi;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
63 %! x1 = sin(t1) - 0.8;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
64 %! y1 = cos(t1);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
65 %! x2 = sin(t2) + 0.8;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
66 %! y2 = cos(t2);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
67 %! patch([x1,x2],[y1,y2],'r');
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
68
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
69 %!demo
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
70 %! ## Unclosed patch
8790
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 7650
diff changeset
71 %! clf
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
72 %! t1 = (1/16:1/8:1)'*2*pi;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
73 %! t2 = ((1/16:1/16:1)' + 1/32)*2*pi;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
74 %! x1 = sin(t1) - 0.8;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
75 %! y1 = cos(t1);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
76 %! x2 = sin(t2) + 0.8;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
77 %! y2 = cos(t2);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
78 %! patch([[x1;NaN(8,1)],x2],[[y1;NaN(8,1)],y2],'r');
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
79
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
80 %!demo
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
81 %! ## Specify vertices and faces separately
8790
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 7650
diff changeset
82 %! clf
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
83 %! t1 = (1/16:1/8:1)'*2*pi;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
84 %! t2 = ((1/16:1/16:1)' + 1/32)*2*pi;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
85 %! x1 = sin(t1) - 0.8;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
86 %! y1 = cos(t1);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
87 %! x2 = sin(t2) + 0.8;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
88 %! y2 = cos(t2);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
89 %! vert = [x1, y1; x2, y2];
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
90 %! fac = [1:8,NaN(1,8);9:24];
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
91 %! patch('Faces',fac,'Vertices',vert,'FaceColor','r');
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
92
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
93 %!demo
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
94 %! ## Specify vertices and faces separately
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
95 %! clf
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
96 %! t1 = (1/16:1/8:1)'*2*pi;
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
97 %! t2 = ((1/16:1/16:1)' + 1/32)*2*pi;
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
98 %! x1 = sin(t1) - 0.8;
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
99 %! y1 = cos(t1);
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
100 %! x2 = sin(t2) + 0.8;
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 %! y2 = cos(t2);
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 %! vert = [x1, y1; x2, y2];
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 %! fac = [1:8,NaN(1,8);9:24];
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 %! patch('Faces',fac,'Vertices',vert,'FaceVertexCData', [0, 1, 0; 0, 0, 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
105
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 %!demo
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
107 %! ## Property change on multiple patches
8790
a013ff655ca4 Trivial changes to demos to produce a more pleasant output for octave+gnuplot+aquaterm.
Ben Abbott <bpabbott@mac.com>
parents: 7650
diff changeset
108 %! clf
7020
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
109 %! t1 = (1/16:1/8:1)'*2*pi;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
110 %! t2 = ((1/16:1/8:1)' + 1/32)*2*pi;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
111 %! x1 = sin(t1) - 0.8;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
112 %! y1 = cos(t1);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
113 %! x2 = sin(t2) + 0.8;
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
114 %! y2 = cos(t2);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
115 %! h = patch([x1,x2],[y1,y2],cat (3,[0,0],[1,0],[0,1]));
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
116 %! pause (1);
e31f12bb9194 [project @ 2007-10-13 05:13:28 by dbateman]
dbateman
parents: 7017
diff changeset
117 %! set (h, 'FaceColor', 'r');
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
118
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
119 %!demo
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
120 %! clf
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
121 %! 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
122 %! 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
123 %! 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
124 %! 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
125 %! 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
126 %! 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
127 %! 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
128 %! 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
129 %! 4, 1, 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
130 %! patch('Vertices', vertices, 'Faces', 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
131 %! 'FaceVertexCData', jet(4), 'FaceColor', 'flat')
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
132 %! view (-37.5, 30)
12533
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
133
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
134 %!demo
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
135 %! clf
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
136 %! vertices = [0, 0, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
137 %! 1, 0, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
138 %! 1, 1, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
139 %! 0, 1, 0;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
140 %! 0.5, 0.5, 1];
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
141 %! faces = [1, 2, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
142 %! 2, 3, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
143 %! 3, 4, 5;
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
144 %! 4, 1, 5];
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
145 %! patch('Vertices', vertices, 'Faces', faces, ...
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
146 %! 'FaceVertexCData', jet(5), 'FaceColor', 'interp')
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
147 %! view (-37.5, 30)
35f6e9a25296 patch.m: Add demo.
Ben Abbott <bpabbott@mac.com>
parents: 11587
diff changeset
148
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
149 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
150 %! clf
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
151 %! colormap (jet)
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
152 %! 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
153 %! y = [0 0 1 1];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
154 %! subplot (2, 1, 1)
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
155 %! title ("Blue, Light-Green, and Red Horizontal Bars")
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
156 %! patch (x, y + 0, 1);
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
157 %! patch (x, y + 1, 2);
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
158 %! patch (x, y + 2, 3);
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
159 %! subplot (2, 1, 2)
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
160 %! title ("Blue, Light-Green, and Red Vertical Bars")
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
161 %! patch (x + 0, y, 1 * ones (size (x)));
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
162 %! patch (x + 1, y, 2 * ones (size (x)));
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
163 %! patch (x + 2, y, 3 * ones (size (x)));
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
164
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
165 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
166 %! clf
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
167 %! colormap (jet)
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
168 %! 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
169 %! y = [0 0 1 1];
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
170 %! subplot (2, 1, 1)
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
171 %! title ("Blue horizontal bars: Dark to Light")
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
172 %! patch (x, y + 0, 1, "cdatamapping", "direct");
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
173 %! patch (x, y + 1, 9, "cdatamapping", "direct");
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
174 %! patch (x, y + 2, 17, "cdatamapping", "direct");
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
175 %! subplot (2, 1, 2)
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
176 %! title ("Blue vertical bars: Dark to Light")
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
177 %! patch (x + 0, y, 1 * ones (size (x)), "cdatamapping", "direct");
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
178 %! patch (x + 1, y, 9 * ones (size (x)), "cdatamapping", "direct");
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
179 %! patch (x + 2, y, 17 * ones (size (x)), "cdatamapping", "direct");
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
180
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
181 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
182 %! clf;
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
183 %! colormap (jet);
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
184 %! 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
185 %! 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
186 %! p = patch (x, y, "facecolor", "b");
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
187 %! title ("Two blue triangles")
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
188 %! set (p, "cdatamapping", "direct", "facecolor", "flat", "cdata", [1 32])
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
189 %! title ("Direct mapping of colors: Light-Green UL and Blue LR triangles")
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
190
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
191 %!demo
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
192 %! clf;
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
193 %! colormap (jet);
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
194 %! 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
195 %! 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
196 %! p = patch (x, y, [1 32]);
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
197 %! title ("Autoscaling of colors: Red UL and Blue LR triangles")
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
198
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
199 %!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
200 %! 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
201 %! unwind_protect
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
202 %! h = patch;
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
203 %! assert (findobj (hf, "type", "patch"), h);
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
204 %! assert (get (h, "xdata"), [0; 1; 0], eps);
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
205 %! assert (get (h, "ydata"), [1; 1; 0], 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
206 %! assert (isempty(get (h, "zdata")));
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
207 %! assert (isempty(get (h, "cdata")));
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
208 %! assert (get (h, "faces"), [1, 2, 3], eps);
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
209 %! assert (get (h, "vertices"), [0 1; 1 1; 0 0], 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
210 %! assert (get (h, "type"), "patch");
13811
240d6810204c update tests for patch
John W. Eaton <jwe@octave.org>
parents: 13802
diff changeset
211 %! 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
212 %! 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
213 %! 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
214 %! 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
215 %! assert (get (h, "markersize"), get (0, "defaultpatchmarkersize"));
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
216 %! 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
217 %! 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
218 %! end_unwind_protect
13247
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
219
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
220 %!test
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
221 %! hf = figure ("visible", "off");
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
222 %! c = 0.9;
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
223 %! unwind_protect
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
224 %! 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
225 %! 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
226 %! 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
227 %! assert (get (gca, "clim"), [c, 2 * c]);
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
228 %! unwind_protect_cleanup
e36c2f4ea8f5 Set clim correctly for patch objects:
Kai Habel <kai.habel@gmx.de>
parents: 13141
diff changeset
229 %! close (hf);
13299
e9f6a6edec42 Improvements to patch() and fix for bugs reported in #34417.
Ben Abbott <bpabbott@mac.com>
parents: 13247
diff changeset
230 %! end_unwind_protect